diff --git a/package.json b/package.json index 876cb06f..027d5c86 100644 --- a/package.json +++ b/package.json @@ -39,4 +39,4 @@ "ts-node": "^10.2.1", "typescript": "^4.4.2" } -} +} \ No newline at end of file diff --git a/packages/hardhat/.openzeppelin/goerli.json b/packages/hardhat/.openzeppelin/goerli.json new file mode 100644 index 00000000..17cc4aa7 --- /dev/null +++ b/packages/hardhat/.openzeppelin/goerli.json @@ -0,0 +1,524 @@ +{ + "manifestVersion": "3.2", + "admin": { + "address": "0xa7F867D22420faB2D684351b9C95f7128e138d52", + "txHash": "0x8be132f70dd70e5c0968f5a6b417f87bc75c3c0754ba876faab1b18f64d25456" + }, + "proxies": [ + { + "address": "0x6bc0CD1e98B66b5644f0720f7dF7786746628C5d", + "txHash": "0x41ea17ea8558f65e3628d0f46dac6bb0a4018588e9a942fca53dcdfedc42c7a9", + "kind": "transparent" + }, + { + "address": "0xBd66CcFceAE3836885F74295C922Da2d8cdD7940", + "txHash": "0x0686abbde2960577f4df420458f582e26cefbbaf60f1225522736cf7ad9566f9", + "kind": "transparent" + }, + { + "address": "0x3E4E6Ea969722382f76858D2eF0cf89E45a848e1", + "txHash": "0x36291cd05033fcbeab07ec5e3abbfa84036bd2a1eeace0980a332b989e933c4a", + "kind": "transparent" + }, + { + "address": "0xbfFEce7c884a488921F52Fb4dd0b0c61B77C9104", + "txHash": "0x79ea242422293cb66ecc3f08d3f929760ba90dbb1c272a3eacd9bb4c74a337c3", + "kind": "transparent" + }, + { + "address": "0x05301D6787430d26bb0D6430Bd98a59B955a27D0", + "txHash": "0xcea8f557f3c834b08b05f85965ad21d2fec5717be730ae5a0fddf016c0b7d5d7", + "kind": "transparent" + } + ], + "impls": { + "32a98c90f0fb31631d3da5e565a60b3bcf5d152d3dc81b21ecd5cc0c8c42df91": { + "address": "0xF2574ba0570E38edf3917eB7f7f1314d40609612", + "txHash": "0xed9e2a5d5913c781f2d16c62217339c4ffe12156c04a1676819e15e855142bab", + "layout": { + "solcVersion": "0.8.2", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:36" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:94" + }, + { + "label": "aragonGovernAddress", + "offset": 0, + "slot": "101", + "type": "t_address", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:15" + }, + { + "label": "createDeposit", + "offset": 0, + "slot": "102", + "type": "t_struct(Deposit)3257_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:16" + }, + { + "label": "playDeposit", + "offset": 0, + "slot": "104", + "type": "t_struct(Deposit)3257_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:17" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20Upgradeable)378": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_struct(Deposit)3257_storage": { + "label": "struct Models.Deposit", + "members": [ + { + "label": "token", + "type": "t_contract(IERC20Upgradeable)378", + "offset": 0, + "slot": "0" + }, + { + "label": "amount", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + } + } + }, + "f79f007915555548f0a15b15684b2d233289de453b81e4943b45d8bc59f15406": { + "address": "0xf8f927FE67bD8b0a9B0673f4Ae9f04b2e51a5974", + "txHash": "0x56fafd877ad959504d65e4ad13ca314041ae0392350a8a87c7f6d65d461b0044", + "layout": { + "solcVersion": "0.8.2", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:36" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:94" + }, + { + "label": "aragonGovernAddress", + "offset": 0, + "slot": "101", + "type": "t_address", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:15" + }, + { + "label": "createDeposit", + "offset": 0, + "slot": "102", + "type": "t_struct(Deposit)3246_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:16" + }, + { + "label": "playDeposit", + "offset": 0, + "slot": "104", + "type": "t_struct(Deposit)3246_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:17" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20Upgradeable)378": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_struct(Deposit)3246_storage": { + "label": "struct Models.Deposit", + "members": [ + { + "label": "token", + "type": "t_contract(IERC20Upgradeable)378", + "offset": 0, + "slot": "0" + }, + { + "label": "amount", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + } + } + }, + "5e9ff64d2f8c29ea479b86854efdb27d8660c24701351b95a6f3997727ae61d1": { + "address": "0x01cf8920D51B579b10e1d8CeaB2afc25708d8C15", + "txHash": "0x93edc2c4e9818257200d9919bca42993174c7f15c2b1419525a935f38d6e5d2c", + "layout": { + "solcVersion": "0.8.2", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:36" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:94" + }, + { + "label": "aragonGovernAddress", + "offset": 0, + "slot": "101", + "type": "t_address", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:15" + }, + { + "label": "createDeposit", + "offset": 0, + "slot": "102", + "type": "t_struct(Deposit)2534_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:16" + }, + { + "label": "playDeposit", + "offset": 0, + "slot": "104", + "type": "t_struct(Deposit)2534_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:17" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20Upgradeable)378": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_struct(Deposit)2534_storage": { + "label": "struct Models.Deposit", + "members": [ + { + "label": "token", + "type": "t_contract(IERC20Upgradeable)378", + "offset": 0, + "slot": "0" + }, + { + "label": "amount", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + } + } + }, + "de52b0ea94600e22bb1a04240f6f598b21211a05d4828563b15fc5a57f57de0a": { + "address": "0x9f2FD32105e18E9047E0C110D8De2bd8442eCe51", + "txHash": "0x7c0402440a6035002c44f30978473f022ca57da789cb208d77ab22fefc9f62ab", + "layout": { + "solcVersion": "0.8.2", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:36" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:94" + }, + { + "label": "aragonGovernAddress", + "offset": 0, + "slot": "101", + "type": "t_address", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:15" + }, + { + "label": "createDeposit", + "offset": 0, + "slot": "102", + "type": "t_struct(Deposit)3246_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:16" + }, + { + "label": "playDeposit", + "offset": 0, + "slot": "104", + "type": "t_struct(Deposit)3246_storage", + "contract": "QuestFactory", + "src": "contracts\\QuestFactory.sol:17" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20Upgradeable)378": { + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_struct(Deposit)3246_storage": { + "label": "struct Models.Deposit", + "members": [ + { + "label": "token", + "type": "t_contract(IERC20Upgradeable)378", + "offset": 0, + "slot": "0" + }, + { + "label": "amount", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + } + } + } + } +} diff --git a/packages/hardhat/contracts/Quest.sol b/packages/hardhat/contracts/Quest.sol index b2a7cfba..e78828a9 100644 --- a/packages/hardhat/contracts/Quest.sol +++ b/packages/hardhat/contracts/Quest.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.1; +pragma solidity ^0.8.2; -import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./libraries/Deposit.sol"; import "./libraries/Models.sol"; @@ -10,19 +10,19 @@ import "./libraries/IExecutable.sol"; contract Quest is IExecutable { using SafeMath for uint256; - using SafeERC20 for IERC20; + using SafeERC20Upgradeable for IERC20Upgradeable; using DepositLib for Models.Deposit; // Quest payload address public questCreator; string public questTitle; bytes public questDetailsRef; - IERC20 public rewardToken; + IERC20Upgradeable public rewardToken; uint256 public expireTime; address public aragonGovernAddress; address payable public fundsRecoveryAddress; uint32 public maxPlayers; // 0 for unlimited players - + bool public isWhiteList; Models.Claim[] public claims; Models.Deposit public createDeposit; Models.Deposit public playDeposit; @@ -33,31 +33,39 @@ contract Quest is IExecutable { event QuestClaimed(bytes evidence, address player, uint256 amount); event QuestPlayed(address player, uint256 timestamp); event QuestUnplayed(address player, uint256 timestamp); + event QuestWhiteListChanged(address[] whiteListPlayers, uint256 timestamp); + modifier OnlyCreator() { + require( + msg.sender == questCreator, + "Only creator can call this function" + ); + _; + } constructor( string memory _questTitle, bytes memory _questDetailsRef, - IERC20 _rewardToken, - uint256 _expireTime, - address _aragonGovernAddress, - address payable _fundsRecoveryAddress, Models.Deposit memory _createDeposit, Models.Deposit memory _playDeposit, - address _questCreator, - uint32 _maxPlayers + Models.QuestParam memory _questParam ) { + require( + !(_questParam.isWhiteList && _questParam.maxPlayers > 0), + "ERROR: Can't create a whiteListed quest with max players greater than 0 (infinity)" + ); questTitle = _questTitle; questDetailsRef = _questDetailsRef; - rewardToken = _rewardToken; - expireTime = _expireTime; - aragonGovernAddress = _aragonGovernAddress; - fundsRecoveryAddress = _fundsRecoveryAddress; - questCreator = _questCreator; + rewardToken = _questParam.rewardToken; + expireTime = _questParam.expireTime; + aragonGovernAddress = _questParam.aragonGovernAddress; + fundsRecoveryAddress = _questParam.fundsRecoveryAddress; + questCreator = _questParam.questCreator; createDeposit = _createDeposit; playDeposit = _playDeposit; isCreateDepositReleased = false; - maxPlayers = _maxPlayers; + maxPlayers = _questParam.maxPlayers; + isWhiteList = _questParam.isWhiteList; } /* @@ -169,6 +177,10 @@ contract Quest is IExecutable { * emit QuestPlayed with player and timestamp */ function play(address _player) external { + require( + isWhiteList == false, + "ERROR: Can't self register and play a whitelisted Quest" + ); require( msg.sender == _player || msg.sender == questCreator, "ERROR: Sender not player nor creator" @@ -187,6 +199,35 @@ contract Quest is IExecutable { emit QuestPlayed(_player, block.timestamp); } + /*** + * Set the white list of players allowed to play the quest. + * + * requires sender to be the quest creator + * @param _players The list of players allowed to play the quest. + * + * emit QuestWhiteListChanged with players and timestamp + */ + function setWhiteList(address[] memory _players) external OnlyCreator { + require( + isWhiteList == true, + "ERROR: Can't set the white list to a non-whitelisted contract" + ); + + bool playerInList = false; + + for(uint32 i =0;i<_players.length;i++){ + + if(findIndexOfPlayer(_players[i])!=-1){ + playerInList = true; + } + } + + require(playerInList == false,"ERROR: One or more players is already in whitelist"); + + playerList = _players; + emit QuestWhiteListChanged(_players, block.timestamp); + } + /** * Unregister a player from the quest. (sender could be the player or quest creator) * @param _player Player address. @@ -197,6 +238,10 @@ contract Quest is IExecutable { * emit QuestUnplayed with player and timestamp */ function unplay(address _player) external { + require( + isWhiteList == false, + "ERROR: can't unplay a whitelisted quest" + ); require( msg.sender == _player || msg.sender == questCreator, "ERROR: Sender not player nor creator" diff --git a/packages/hardhat/contracts/QuestFactory.sol b/packages/hardhat/contracts/QuestFactory.sol index 8ff88372..ea95bca9 100644 --- a/packages/hardhat/contracts/QuestFactory.sol +++ b/packages/hardhat/contracts/QuestFactory.sol @@ -1,19 +1,21 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.1; +pragma solidity ^0.8.2; -import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import "@openzeppelin/contracts/access/Ownable.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "./libraries/Deposit.sol"; import "./libraries/Models.sol"; import "./Quest.sol"; -contract QuestFactory is Ownable { +contract QuestFactory is OwnableUpgradeable { using DepositLib for Models.Deposit; address public aragonGovernAddress; Models.Deposit public createDeposit; Models.Deposit public playDeposit; + uint256 public constant version = 3; event QuestCreated( address questAddress, @@ -22,12 +24,12 @@ contract QuestFactory is Ownable { address rewardTokenAddress, uint256 expireTime, address fundsRecoveryAddress, - address createDepositToken, - uint256 createDepositAmount, - address playDepositToken, - uint256 playDepositAmount, + Models.Deposit createDeposit, + Models.Deposit playDeposit, address creator, - uint32 maxPlayers + uint32 maxPlayers, + bool isWhiteList, + uint256 version ); event CreateDepositChanged( @@ -38,20 +40,14 @@ contract QuestFactory is Ownable { event PlayDepositChanged(uint256 timestamp, address token, uint256 amount); - constructor( - address _aragonGovernAddress, - IERC20 _createDepositToken, - uint256 _createDepositAmount, - IERC20 _playDepositToken, - uint256 _playDepositAmount, - address _initialOwner - ) { + /// @custom:oz-upgrades-unsafe-allow constructor + constructor() { + _disableInitializers(); + } + + function initialize(address _aragonGovernAddress) public initializer { + __Ownable_init(); aragonGovernAddress = _aragonGovernAddress; - setCreateDeposit(_createDepositToken, _createDepositAmount); - setPlayDeposit(_playDepositToken, _playDepositAmount); - if (_initialOwner != msg.sender) { - transferOwnership(_initialOwner); - } } /* @@ -60,7 +56,10 @@ contract QuestFactory is Ownable { * @param _depositAmount The deposit amount. * emit CreateDepositChanged */ - function setCreateDeposit(IERC20 token, uint256 amount) public onlyOwner { + function setCreateDeposit( + IERC20Upgradeable token, + uint256 amount + ) public onlyOwner { createDeposit = Models.Deposit(token, amount); emit CreateDepositChanged(block.timestamp, address(token), amount); } @@ -71,7 +70,10 @@ contract QuestFactory is Ownable { * @param _depositAmount The deposit amount. * emit PlayDepositChanged */ - function setPlayDeposit(IERC20 token, uint256 amount) public onlyOwner { + function setPlayDeposit( + IERC20Upgradeable token, + uint256 amount + ) public onlyOwner { playDeposit = Models.Deposit(token, amount); emit PlayDepositChanged(block.timestamp, address(token), amount); } @@ -91,22 +93,26 @@ contract QuestFactory is Ownable { function createQuest( string memory _questTitle, bytes memory _questDetailsRef, - IERC20 _rewardToken, + IERC20Upgradeable _rewardToken, uint256 _expireTime, address payable _fundsRecoveryAddress, - uint32 _maxPlayers + uint32 _maxPlayers, + bool _isWhiteList ) external returns (address) { Quest quest = new Quest( _questTitle, _questDetailsRef, - _rewardToken, - _expireTime, - aragonGovernAddress, - _fundsRecoveryAddress, Models.Deposit(createDeposit.token, createDeposit.amount), Models.Deposit(playDeposit.token, playDeposit.amount), - msg.sender, - _maxPlayers + Models.QuestParam( + msg.sender, + _maxPlayers, + _rewardToken, + _expireTime, + aragonGovernAddress, + _fundsRecoveryAddress, + _isWhiteList + ) ); // Collect deposit from quest creator and send it to quest @@ -119,12 +125,12 @@ contract QuestFactory is Ownable { address(_rewardToken), _expireTime, _fundsRecoveryAddress, - address(createDeposit.token), - createDeposit.amount, - address(playDeposit.token), - playDeposit.amount, + createDeposit, + playDeposit, msg.sender, - _maxPlayers + _maxPlayers, + _isWhiteList, + version ); return address(quest); diff --git a/packages/hardhat/contracts/libraries/Deposit.sol b/packages/hardhat/contracts/libraries/Deposit.sol index 6595ad8f..e9b90f9b 100644 --- a/packages/hardhat/contracts/libraries/Deposit.sol +++ b/packages/hardhat/contracts/libraries/Deposit.sol @@ -1,13 +1,14 @@ // SPDX-License-Identifier: GPL-3.0 +// Solidity: Package Default Dependencies Directory = "node_modules" -pragma solidity ^0.8.1; +pragma solidity ^0.8.2; -import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "./Models.sol"; library DepositLib { - using SafeERC20 for IERC20; + using SafeERC20Upgradeable for IERC20Upgradeable; /* * Collect deposit from signer and send it to _to address. diff --git a/packages/hardhat/contracts/libraries/IExecutable.sol b/packages/hardhat/contracts/libraries/IExecutable.sol index 2f6adef2..5ee8ed56 100644 --- a/packages/hardhat/contracts/libraries/IExecutable.sol +++ b/packages/hardhat/contracts/libraries/IExecutable.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.1; +pragma solidity ^0.8.2; interface IExecutable { function canExecute(address executer) external returns (bool); diff --git a/packages/hardhat/contracts/libraries/Models.sol b/packages/hardhat/contracts/libraries/Models.sol index 55abfa23..835b4eaa 100644 --- a/packages/hardhat/contracts/libraries/Models.sol +++ b/packages/hardhat/contracts/libraries/Models.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.1; -import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +pragma solidity ^0.8.2; +import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; library Models { struct Deposit { - IERC20 token; + IERC20Upgradeable token; uint256 amount; } struct Claim { @@ -12,4 +12,13 @@ library Models { address player; uint256 amount; } + struct QuestParam { + address questCreator; + uint32 maxPlayers; + IERC20Upgradeable rewardToken; + uint256 expireTime; + address aragonGovernAddress; + address payable fundsRecoveryAddress; + bool isWhiteList; + } } diff --git a/packages/hardhat/coverage.json b/packages/hardhat/coverage.json index 671e81a0..704f191c 100644 --- a/packages/hardhat/coverage.json +++ b/packages/hardhat/coverage.json @@ -1 +1 @@ -{"contracts\\libraries\\Deposit.sol":{"l":{"23":53,"24":51,"35":53,"37":53,"41":53,"46":51,"57":69,"58":69},"path":"C:\\Users\\gossm\\Documents\\Projects\\quests\\packages\\hardhat\\contracts\\libraries\\Deposit.sol","s":{"1":53,"2":51,"3":53,"4":53,"5":53,"6":51,"7":69,"8":69},"b":{"1":[53,0],"2":[51,2],"3":[69,0]},"f":{"1":53,"2":53,"3":69},"fnMap":{"1":{"name":"collectFrom","line":18,"loc":{"start":{"line":18,"column":4},"end":{"line":25,"column":4}}},"2":{"name":"collectFrom","line":32,"loc":{"start":{"line":32,"column":4},"end":{"line":52,"column":4}}},"3":{"name":"releaseTo","line":54,"loc":{"start":{"line":54,"column":4},"end":{"line":60,"column":4}}}},"statementMap":{"1":{"start":{"line":23,"column":8},"end":{"line":23,"column":38}},"2":{"start":{"line":24,"column":8},"end":{"line":24,"column":34}},"3":{"start":{"line":35,"column":8},"end":{"line":35,"column":988}},"4":{"start":{"line":37,"column":12},"end":{"line":37,"column":1069}},"5":{"start":{"line":41,"column":12},"end":{"line":41,"column":1201}},"6":{"start":{"line":46,"column":12},"end":{"line":46,"column":1340}},"7":{"start":{"line":57,"column":8},"end":{"line":57,"column":1606}},"8":{"start":{"line":58,"column":12},"end":{"line":58,"column":66}}},"branchMap":{"1":{"line":35,"type":"if","locations":[{"start":{"line":35,"column":8},"end":{"line":35,"column":8}},{"start":{"line":35,"column":8},"end":{"line":35,"column":8}}]},"2":{"line":41,"type":"if","locations":[{"start":{"line":41,"column":12},"end":{"line":41,"column":12}},{"start":{"line":41,"column":12},"end":{"line":41,"column":12}}]},"3":{"line":57,"type":"if","locations":[{"start":{"line":57,"column":8},"end":{"line":57,"column":8}},{"start":{"line":57,"column":8},"end":{"line":57,"column":8}}]}}},"contracts\\libraries\\IExecutable.sol":{"l":{},"path":"C:\\Users\\gossm\\Documents\\Projects\\quests\\packages\\hardhat\\contracts\\libraries\\IExecutable.sol","s":{},"b":{},"f":{},"fnMap":{},"statementMap":{},"branchMap":{}},"contracts\\libraries\\Models.sol":{"l":{},"path":"C:\\Users\\gossm\\Documents\\Projects\\quests\\packages\\hardhat\\contracts\\libraries\\Models.sol","s":{},"b":{},"f":{},"fnMap":{},"statementMap":{},"branchMap":{}},"contracts\\Quest.sol":{"l":{"49":94,"50":94,"51":94,"52":94,"53":94,"54":94,"55":94,"56":94,"57":94,"59":94,"60":94,"82":22,"83":21,"85":20,"87":20,"89":12,"90":6,"91":6,"93":6,"96":12,"97":6,"100":6,"104":20,"105":7,"106":7,"112":19,"113":19,"116":18,"118":18,"128":16,"131":15,"132":12,"133":12,"136":15,"139":15,"140":3,"145":15,"155":3,"172":44,"176":43,"180":42,"181":41,"182":41,"184":40,"186":39,"187":39,"200":8,"204":7,"205":7,"208":6,"210":6,"212":6,"213":6,"220":5,"226":51,"227":15,"228":8,"231":43},"path":"C:\\Users\\gossm\\Documents\\Projects\\quests\\packages\\hardhat\\contracts\\Quest.sol","s":{"1":22,"2":21,"3":20,"4":20,"5":12,"6":6,"7":12,"8":6,"9":20,"10":7,"11":7,"12":19,"13":19,"14":18,"15":18,"16":16,"17":15,"18":12,"19":15,"20":15,"21":15,"22":3,"23":44,"24":43,"25":42,"26":41,"27":41,"28":40,"29":39,"30":39,"31":8,"32":7,"33":7,"34":6,"35":6,"36":6,"37":5,"38":51,"39":15,"40":8,"41":43},"b":{"1":[21,1],"2":[20,1],"3":[12,8],"4":[6,6],"5":[6,6],"6":[7,13],"7":[6,1],"8":[19,0],"9":[15,1],"10":[12,3],"11":[3,12],"12":[43,1],"13":[22,21],"14":[42,1],"15":[39,3],"16":[41,1],"17":[40,1],"18":[7,1],"19":[3,4],"20":[6,1],"21":[8,7]},"f":{"1":94,"2":22,"3":16,"4":3,"5":44,"6":8,"7":5,"8":51},"fnMap":{"1":{"name":"constructor","line":37,"loc":{"start":{"line":37,"column":4},"end":{"line":61,"column":4}}},"2":{"name":"claim","line":76,"loc":{"start":{"line":76,"column":4},"end":{"line":119,"column":4}}},"3":{"name":"recoverFundsAndDeposit","line":127,"loc":{"start":{"line":127,"column":4},"end":{"line":146,"column":4}}},"4":{"name":"canExecute","line":152,"loc":{"start":{"line":152,"column":4},"end":{"line":156,"column":4}}},"5":{"name":"play","line":171,"loc":{"start":{"line":171,"column":4},"end":{"line":188,"column":4}}},"6":{"name":"unplay","line":199,"loc":{"start":{"line":199,"column":4},"end":{"line":214,"column":4}}},"7":{"name":"getPlayers","line":219,"loc":{"start":{"line":219,"column":4},"end":{"line":221,"column":4}}},"8":{"name":"findIndexOfPlayer","line":225,"loc":{"start":{"line":225,"column":4},"end":{"line":232,"column":4}}}},"statementMap":{"1":{"start":{"line":82,"column":8},"end":{"line":82,"column":77}},"2":{"start":{"line":83,"column":8},"end":{"line":83,"column":59}},"3":{"start":{"line":85,"column":8},"end":{"line":85,"column":62}},"4":{"start":{"line":87,"column":8},"end":{"line":87,"column":2875}},"5":{"start":{"line":89,"column":12},"end":{"line":89,"column":2985}},"6":{"start":{"line":90,"column":16},"end":{"line":90,"column":73}},"7":{"start":{"line":96,"column":12},"end":{"line":96,"column":3328}},"8":{"start":{"line":97,"column":16},"end":{"line":97,"column":3408}},"9":{"start":{"line":104,"column":8},"end":{"line":104,"column":3588}},"10":{"start":{"line":105,"column":12},"end":{"line":105,"column":56}},"11":{"start":{"line":106,"column":12},"end":{"line":106,"column":3724}},"12":{"start":{"line":112,"column":8},"end":{"line":112,"column":3875}},"13":{"start":{"line":113,"column":12},"end":{"line":113,"column":53}},"14":{"start":{"line":116,"column":8},"end":{"line":116,"column":61}},"15":{"start":{"line":118,"column":8},"end":{"line":118,"column":54}},"16":{"start":{"line":128,"column":8},"end":{"line":128,"column":67}},"17":{"start":{"line":131,"column":8},"end":{"line":131,"column":4472}},"18":{"start":{"line":132,"column":12},"end":{"line":132,"column":48}},"19":{"start":{"line":136,"column":8},"end":{"line":136,"column":62}},"20":{"start":{"line":139,"column":8},"end":{"line":139,"column":4762}},"21":{"start":{"line":145,"column":8},"end":{"line":145,"column":62}},"22":{"start":{"line":155,"column":8},"end":{"line":155,"column":48}},"23":{"start":{"line":172,"column":8},"end":{"line":172,"column":5858}},"24":{"start":{"line":176,"column":8},"end":{"line":176,"column":6006}},"25":{"start":{"line":180,"column":8},"end":{"line":180,"column":68}},"26":{"start":{"line":181,"column":8},"end":{"line":181,"column":55}},"27":{"start":{"line":182,"column":8},"end":{"line":182,"column":65}},"28":{"start":{"line":184,"column":8},"end":{"line":184,"column":57}},"29":{"start":{"line":186,"column":8},"end":{"line":186,"column":31}},"30":{"start":{"line":187,"column":8},"end":{"line":187,"column":50}},"31":{"start":{"line":200,"column":8},"end":{"line":200,"column":6868}},"32":{"start":{"line":204,"column":8},"end":{"line":204,"column":55}},"33":{"start":{"line":205,"column":8},"end":{"line":205,"column":62}},"34":{"start":{"line":210,"column":8},"end":{"line":210,"column":23}},"35":{"start":{"line":212,"column":8},"end":{"line":212,"column":37}},"36":{"start":{"line":213,"column":8},"end":{"line":213,"column":52}},"37":{"start":{"line":220,"column":8},"end":{"line":220,"column":25}},"38":{"start":{"line":226,"column":8},"end":{"line":226,"column":7803}},"39":{"start":{"line":227,"column":12},"end":{"line":227,"column":7870}},"40":{"start":{"line":228,"column":16},"end":{"line":228,"column":32}},"41":{"start":{"line":231,"column":8},"end":{"line":231,"column":17}}},"branchMap":{"1":{"line":82,"type":"if","locations":[{"start":{"line":82,"column":8},"end":{"line":82,"column":8}},{"start":{"line":82,"column":8},"end":{"line":82,"column":8}}]},"2":{"line":83,"type":"if","locations":[{"start":{"line":83,"column":8},"end":{"line":83,"column":8}},{"start":{"line":83,"column":8},"end":{"line":83,"column":8}}]},"3":{"line":87,"type":"if","locations":[{"start":{"line":87,"column":8},"end":{"line":87,"column":8}},{"start":{"line":87,"column":8},"end":{"line":87,"column":8}}]},"4":{"line":89,"type":"if","locations":[{"start":{"line":89,"column":12},"end":{"line":89,"column":12}},{"start":{"line":89,"column":12},"end":{"line":89,"column":12}}]},"5":{"line":96,"type":"if","locations":[{"start":{"line":96,"column":12},"end":{"line":96,"column":12}},{"start":{"line":96,"column":12},"end":{"line":96,"column":12}}]},"6":{"line":104,"type":"if","locations":[{"start":{"line":104,"column":8},"end":{"line":104,"column":8}},{"start":{"line":104,"column":8},"end":{"line":104,"column":8}}]},"7":{"line":106,"type":"if","locations":[{"start":{"line":106,"column":12},"end":{"line":106,"column":12}},{"start":{"line":106,"column":12},"end":{"line":106,"column":12}}]},"8":{"line":112,"type":"if","locations":[{"start":{"line":112,"column":8},"end":{"line":112,"column":8}},{"start":{"line":112,"column":8},"end":{"line":112,"column":8}}]},"9":{"line":128,"type":"if","locations":[{"start":{"line":128,"column":8},"end":{"line":128,"column":8}},{"start":{"line":128,"column":8},"end":{"line":128,"column":8}}]},"10":{"line":131,"type":"if","locations":[{"start":{"line":131,"column":8},"end":{"line":131,"column":8}},{"start":{"line":131,"column":8},"end":{"line":131,"column":8}}]},"11":{"line":139,"type":"if","locations":[{"start":{"line":139,"column":8},"end":{"line":139,"column":8}},{"start":{"line":139,"column":8},"end":{"line":139,"column":8}}]},"12":{"line":172,"type":"if","locations":[{"start":{"line":172,"column":8},"end":{"line":172,"column":8}},{"start":{"line":172,"column":8},"end":{"line":172,"column":8}}]},"13":{"line":173,"type":"cond-expr","locations":[{"start":{"line":173,"column":12},"end":{"line":173,"column":32}},{"start":{"line":173,"column":37},"end":{"line":173,"column":62}}]},"14":{"line":176,"type":"if","locations":[{"start":{"line":176,"column":8},"end":{"line":176,"column":8}},{"start":{"line":176,"column":8},"end":{"line":176,"column":8}}]},"15":{"line":177,"type":"cond-expr","locations":[{"start":{"line":177,"column":12},"end":{"line":177,"column":26}},{"start":{"line":177,"column":31},"end":{"line":177,"column":60}}]},"16":{"line":180,"type":"if","locations":[{"start":{"line":180,"column":8},"end":{"line":180,"column":8}},{"start":{"line":180,"column":8},"end":{"line":180,"column":8}}]},"17":{"line":182,"type":"if","locations":[{"start":{"line":182,"column":8},"end":{"line":182,"column":8}},{"start":{"line":182,"column":8},"end":{"line":182,"column":8}}]},"18":{"line":200,"type":"if","locations":[{"start":{"line":200,"column":8},"end":{"line":200,"column":8}},{"start":{"line":200,"column":8},"end":{"line":200,"column":8}}]},"19":{"line":201,"type":"cond-expr","locations":[{"start":{"line":201,"column":12},"end":{"line":201,"column":32}},{"start":{"line":201,"column":37},"end":{"line":201,"column":62}}]},"20":{"line":205,"type":"if","locations":[{"start":{"line":205,"column":8},"end":{"line":205,"column":8}},{"start":{"line":205,"column":8},"end":{"line":205,"column":8}}]},"21":{"line":227,"type":"if","locations":[{"start":{"line":227,"column":12},"end":{"line":227,"column":12}},{"start":{"line":227,"column":12},"end":{"line":227,"column":12}}]}}},"contracts\\QuestFactory.sol":{"l":{"49":42,"50":42,"51":42,"52":42,"53":3,"64":48,"65":48,"75":48,"76":48,"99":13,"113":13,"115":12,"130":12,"141":3},"path":"C:\\Users\\gossm\\Documents\\Projects\\quests\\packages\\hardhat\\contracts\\QuestFactory.sol","s":{"1":42,"2":42,"3":42,"4":3,"5":48,"6":48,"7":13,"8":13,"9":12,"10":12},"b":{"1":[3,39],"2":[48,1],"3":[48,1],"4":[3,1]},"f":{"1":42,"2":48,"3":48,"4":13,"5":3},"fnMap":{"1":{"name":"constructor","line":41,"loc":{"start":{"line":41,"column":4},"end":{"line":55,"column":4}}},"2":{"name":"setCreateDeposit","line":63,"loc":{"start":{"line":63,"column":4},"end":{"line":66,"column":4}}},"3":{"name":"setPlayDeposit","line":74,"loc":{"start":{"line":74,"column":4},"end":{"line":77,"column":4}}},"4":{"name":"createQuest","line":91,"loc":{"start":{"line":91,"column":4},"end":{"line":131,"column":4}}},"5":{"name":"setAragonGovernAddress","line":140,"loc":{"start":{"line":138,"column":4},"end":{"line":142,"column":4}}}},"statementMap":{"1":{"start":{"line":50,"column":8},"end":{"line":50,"column":66}},"2":{"start":{"line":51,"column":8},"end":{"line":51,"column":60}},"3":{"start":{"line":52,"column":8},"end":{"line":52,"column":1623}},"4":{"start":{"line":53,"column":12},"end":{"line":53,"column":43}},"5":{"start":{"line":65,"column":8},"end":{"line":65,"column":74}},"6":{"start":{"line":76,"column":8},"end":{"line":76,"column":72}},"7":{"start":{"line":99,"column":8},"end":{"line":99,"column":3297}},"8":{"start":{"line":113,"column":8},"end":{"line":113,"column":60}},"9":{"start":{"line":115,"column":8},"end":{"line":115,"column":3849}},"10":{"start":{"line":130,"column":8},"end":{"line":130,"column":29}}},"branchMap":{"1":{"line":52,"type":"if","locations":[{"start":{"line":52,"column":8},"end":{"line":52,"column":8}},{"start":{"line":52,"column":8},"end":{"line":52,"column":8}}]},"2":{"line":63,"type":"if","locations":[{"start":{"line":63,"column":67},"end":{"line":63,"column":67}},{"start":{"line":63,"column":67},"end":{"line":63,"column":67}}]},"3":{"line":74,"type":"if","locations":[{"start":{"line":74,"column":65},"end":{"line":74,"column":65}},{"start":{"line":74,"column":65},"end":{"line":74,"column":65}}]},"4":{"line":140,"type":"if","locations":[{"start":{"line":140,"column":15},"end":{"line":140,"column":15}},{"start":{"line":140,"column":15},"end":{"line":140,"column":15}}]}}}} \ No newline at end of file +{"contracts\\libraries\\Deposit.sol":{"l":{"24":45,"25":43,"36":45,"38":45,"42":45,"47":43,"58":61,"59":61},"path":"C:\\Projects\\quests\\packages\\hardhat\\contracts\\libraries\\Deposit.sol","s":{"1":45,"2":43,"3":45,"4":45,"5":45,"6":43,"7":61,"8":61},"b":{"1":[45,0],"2":[43,2],"3":[61,0]},"f":{"1":45,"2":45,"3":61},"fnMap":{"1":{"name":"collectFrom","line":19,"loc":{"start":{"line":19,"column":4},"end":{"line":26,"column":4}}},"2":{"name":"collectFrom","line":33,"loc":{"start":{"line":33,"column":4},"end":{"line":53,"column":4}}},"3":{"name":"releaseTo","line":55,"loc":{"start":{"line":55,"column":4},"end":{"line":61,"column":4}}}},"statementMap":{"1":{"start":{"line":24,"column":8},"end":{"line":24,"column":38}},"2":{"start":{"line":25,"column":8},"end":{"line":25,"column":34}},"3":{"start":{"line":36,"column":8},"end":{"line":36,"column":1126}},"4":{"start":{"line":38,"column":12},"end":{"line":38,"column":1207}},"5":{"start":{"line":42,"column":12},"end":{"line":42,"column":1339}},"6":{"start":{"line":47,"column":12},"end":{"line":47,"column":1478}},"7":{"start":{"line":58,"column":8},"end":{"line":58,"column":1744}},"8":{"start":{"line":59,"column":12},"end":{"line":59,"column":66}}},"branchMap":{"1":{"line":36,"type":"if","locations":[{"start":{"line":36,"column":8},"end":{"line":36,"column":8}},{"start":{"line":36,"column":8},"end":{"line":36,"column":8}}]},"2":{"line":42,"type":"if","locations":[{"start":{"line":42,"column":12},"end":{"line":42,"column":12}},{"start":{"line":42,"column":12},"end":{"line":42,"column":12}}]},"3":{"line":58,"type":"if","locations":[{"start":{"line":58,"column":8},"end":{"line":58,"column":8}},{"start":{"line":58,"column":8},"end":{"line":58,"column":8}}]}}},"contracts\\libraries\\IExecutable.sol":{"l":{},"path":"C:\\Projects\\quests\\packages\\hardhat\\contracts\\libraries\\IExecutable.sol","s":{},"b":{},"f":{},"fnMap":{},"statementMap":{},"branchMap":{}},"contracts\\libraries\\Models.sol":{"l":{},"path":"C:\\Projects\\quests\\packages\\hardhat\\contracts\\libraries\\Models.sol","s":{},"b":{},"f":{},"fnMap":{},"statementMap":{},"branchMap":{}},"contracts\\Quest.sol":{"l":{"38":4,"42":4,"52":99,"56":98,"57":98,"58":98,"59":98,"60":98,"61":98,"62":98,"63":98,"64":98,"66":98,"67":98,"68":98,"90":22,"91":21,"93":20,"95":20,"97":12,"98":6,"99":6,"101":6,"104":12,"105":6,"108":6,"112":20,"113":7,"114":7,"120":19,"121":19,"124":18,"126":18,"136":16,"139":15,"140":12,"141":12,"144":15,"147":15,"148":3,"153":15,"163":5,"180":45,"184":44,"188":43,"192":42,"193":41,"194":41,"196":40,"198":39,"199":39,"211":4,"215":3,"216":3,"229":9,"233":8,"237":7,"238":7,"241":6,"243":6,"245":6,"246":6,"253":6,"259":53,"260":18,"261":10,"264":43},"path":"C:\\Projects\\quests\\packages\\hardhat\\contracts\\Quest.sol","s":{"1":4,"2":99,"3":22,"4":21,"5":20,"6":20,"7":12,"8":6,"9":12,"10":6,"11":20,"12":7,"13":7,"14":19,"15":19,"16":18,"17":18,"18":16,"19":15,"20":12,"21":15,"22":15,"23":15,"24":5,"25":45,"26":44,"27":43,"28":42,"29":41,"30":41,"31":40,"32":39,"33":39,"34":4,"35":3,"36":9,"37":8,"38":7,"39":7,"40":6,"41":6,"42":6,"43":6,"44":53,"45":18,"46":10,"47":43},"b":{"1":[4,0],"2":[98,1],"3":[21,1],"4":[20,1],"5":[12,8],"6":[6,6],"7":[6,6],"8":[7,13],"9":[6,1],"10":[19,0],"11":[15,1],"12":[12,3],"13":[3,12],"14":[44,1],"15":[43,1],"16":[22,21],"17":[42,1],"18":[39,3],"19":[41,1],"20":[40,1],"21":[4,0],"22":[3,1],"23":[8,1],"24":[7,1],"25":[3,4],"26":[6,1],"27":[10,8]},"f":{"1":4,"2":99,"3":22,"4":16,"5":5,"6":45,"7":4,"8":9,"9":6,"10":53},"fnMap":{"1":{"name":"OnlyCreator","line":37,"loc":{"start":{"line":37,"column":4},"end":{"line":43,"column":4}}},"2":{"name":"constructor","line":45,"loc":{"start":{"line":45,"column":4},"end":{"line":69,"column":4}}},"3":{"name":"claim","line":84,"loc":{"start":{"line":84,"column":4},"end":{"line":127,"column":4}}},"4":{"name":"recoverFundsAndDeposit","line":135,"loc":{"start":{"line":135,"column":4},"end":{"line":154,"column":4}}},"5":{"name":"canExecute","line":160,"loc":{"start":{"line":160,"column":4},"end":{"line":164,"column":4}}},"6":{"name":"play","line":179,"loc":{"start":{"line":179,"column":4},"end":{"line":200,"column":4}}},"7":{"name":"setWhiteList","line":210,"loc":{"start":{"line":210,"column":4},"end":{"line":217,"column":4}}},"8":{"name":"unplay","line":228,"loc":{"start":{"line":228,"column":4},"end":{"line":247,"column":4}}},"9":{"name":"getPlayers","line":252,"loc":{"start":{"line":252,"column":4},"end":{"line":254,"column":4}}},"10":{"name":"findIndexOfPlayer","line":258,"loc":{"start":{"line":258,"column":4},"end":{"line":265,"column":4}}}},"statementMap":{"1":{"start":{"line":38,"column":8},"end":{"line":38,"column":1464}},"2":{"start":{"line":52,"column":8},"end":{"line":52,"column":1848}},"3":{"start":{"line":90,"column":8},"end":{"line":90,"column":77}},"4":{"start":{"line":91,"column":8},"end":{"line":91,"column":59}},"5":{"start":{"line":93,"column":8},"end":{"line":93,"column":62}},"6":{"start":{"line":95,"column":8},"end":{"line":95,"column":3386}},"7":{"start":{"line":97,"column":12},"end":{"line":97,"column":3496}},"8":{"start":{"line":98,"column":16},"end":{"line":98,"column":73}},"9":{"start":{"line":104,"column":12},"end":{"line":104,"column":3839}},"10":{"start":{"line":105,"column":16},"end":{"line":105,"column":3919}},"11":{"start":{"line":112,"column":8},"end":{"line":112,"column":4099}},"12":{"start":{"line":113,"column":12},"end":{"line":113,"column":56}},"13":{"start":{"line":114,"column":12},"end":{"line":114,"column":4235}},"14":{"start":{"line":120,"column":8},"end":{"line":120,"column":4386}},"15":{"start":{"line":121,"column":12},"end":{"line":121,"column":53}},"16":{"start":{"line":124,"column":8},"end":{"line":124,"column":61}},"17":{"start":{"line":126,"column":8},"end":{"line":126,"column":54}},"18":{"start":{"line":136,"column":8},"end":{"line":136,"column":67}},"19":{"start":{"line":139,"column":8},"end":{"line":139,"column":4983}},"20":{"start":{"line":140,"column":12},"end":{"line":140,"column":48}},"21":{"start":{"line":144,"column":8},"end":{"line":144,"column":62}},"22":{"start":{"line":147,"column":8},"end":{"line":147,"column":5273}},"23":{"start":{"line":153,"column":8},"end":{"line":153,"column":62}},"24":{"start":{"line":163,"column":8},"end":{"line":163,"column":48}},"25":{"start":{"line":180,"column":8},"end":{"line":180,"column":6369}},"26":{"start":{"line":184,"column":8},"end":{"line":184,"column":6505}},"27":{"start":{"line":188,"column":8},"end":{"line":188,"column":6653}},"28":{"start":{"line":192,"column":8},"end":{"line":192,"column":68}},"29":{"start":{"line":193,"column":8},"end":{"line":193,"column":55}},"30":{"start":{"line":194,"column":8},"end":{"line":194,"column":65}},"31":{"start":{"line":196,"column":8},"end":{"line":196,"column":57}},"32":{"start":{"line":198,"column":8},"end":{"line":198,"column":31}},"33":{"start":{"line":199,"column":8},"end":{"line":199,"column":50}},"34":{"start":{"line":211,"column":8},"end":{"line":211,"column":7510}},"35":{"start":{"line":216,"column":8},"end":{"line":216,"column":61}},"36":{"start":{"line":229,"column":8},"end":{"line":229,"column":8121}},"37":{"start":{"line":233,"column":8},"end":{"line":233,"column":8241}},"38":{"start":{"line":237,"column":8},"end":{"line":237,"column":55}},"39":{"start":{"line":238,"column":8},"end":{"line":238,"column":62}},"40":{"start":{"line":243,"column":8},"end":{"line":243,"column":23}},"41":{"start":{"line":245,"column":8},"end":{"line":245,"column":37}},"42":{"start":{"line":246,"column":8},"end":{"line":246,"column":52}},"43":{"start":{"line":253,"column":8},"end":{"line":253,"column":25}},"44":{"start":{"line":259,"column":8},"end":{"line":259,"column":9176}},"45":{"start":{"line":260,"column":12},"end":{"line":260,"column":9243}},"46":{"start":{"line":261,"column":16},"end":{"line":261,"column":32}},"47":{"start":{"line":264,"column":8},"end":{"line":264,"column":17}}},"branchMap":{"1":{"line":38,"type":"if","locations":[{"start":{"line":38,"column":8},"end":{"line":38,"column":8}},{"start":{"line":38,"column":8},"end":{"line":38,"column":8}}]},"2":{"line":52,"type":"if","locations":[{"start":{"line":52,"column":8},"end":{"line":52,"column":8}},{"start":{"line":52,"column":8},"end":{"line":52,"column":8}}]},"3":{"line":90,"type":"if","locations":[{"start":{"line":90,"column":8},"end":{"line":90,"column":8}},{"start":{"line":90,"column":8},"end":{"line":90,"column":8}}]},"4":{"line":91,"type":"if","locations":[{"start":{"line":91,"column":8},"end":{"line":91,"column":8}},{"start":{"line":91,"column":8},"end":{"line":91,"column":8}}]},"5":{"line":95,"type":"if","locations":[{"start":{"line":95,"column":8},"end":{"line":95,"column":8}},{"start":{"line":95,"column":8},"end":{"line":95,"column":8}}]},"6":{"line":97,"type":"if","locations":[{"start":{"line":97,"column":12},"end":{"line":97,"column":12}},{"start":{"line":97,"column":12},"end":{"line":97,"column":12}}]},"7":{"line":104,"type":"if","locations":[{"start":{"line":104,"column":12},"end":{"line":104,"column":12}},{"start":{"line":104,"column":12},"end":{"line":104,"column":12}}]},"8":{"line":112,"type":"if","locations":[{"start":{"line":112,"column":8},"end":{"line":112,"column":8}},{"start":{"line":112,"column":8},"end":{"line":112,"column":8}}]},"9":{"line":114,"type":"if","locations":[{"start":{"line":114,"column":12},"end":{"line":114,"column":12}},{"start":{"line":114,"column":12},"end":{"line":114,"column":12}}]},"10":{"line":120,"type":"if","locations":[{"start":{"line":120,"column":8},"end":{"line":120,"column":8}},{"start":{"line":120,"column":8},"end":{"line":120,"column":8}}]},"11":{"line":136,"type":"if","locations":[{"start":{"line":136,"column":8},"end":{"line":136,"column":8}},{"start":{"line":136,"column":8},"end":{"line":136,"column":8}}]},"12":{"line":139,"type":"if","locations":[{"start":{"line":139,"column":8},"end":{"line":139,"column":8}},{"start":{"line":139,"column":8},"end":{"line":139,"column":8}}]},"13":{"line":147,"type":"if","locations":[{"start":{"line":147,"column":8},"end":{"line":147,"column":8}},{"start":{"line":147,"column":8},"end":{"line":147,"column":8}}]},"14":{"line":180,"type":"if","locations":[{"start":{"line":180,"column":8},"end":{"line":180,"column":8}},{"start":{"line":180,"column":8},"end":{"line":180,"column":8}}]},"15":{"line":184,"type":"if","locations":[{"start":{"line":184,"column":8},"end":{"line":184,"column":8}},{"start":{"line":184,"column":8},"end":{"line":184,"column":8}}]},"16":{"line":185,"type":"cond-expr","locations":[{"start":{"line":185,"column":12},"end":{"line":185,"column":32}},{"start":{"line":185,"column":37},"end":{"line":185,"column":62}}]},"17":{"line":188,"type":"if","locations":[{"start":{"line":188,"column":8},"end":{"line":188,"column":8}},{"start":{"line":188,"column":8},"end":{"line":188,"column":8}}]},"18":{"line":189,"type":"cond-expr","locations":[{"start":{"line":189,"column":12},"end":{"line":189,"column":26}},{"start":{"line":189,"column":31},"end":{"line":189,"column":60}}]},"19":{"line":192,"type":"if","locations":[{"start":{"line":192,"column":8},"end":{"line":192,"column":8}},{"start":{"line":192,"column":8},"end":{"line":192,"column":8}}]},"20":{"line":194,"type":"if","locations":[{"start":{"line":194,"column":8},"end":{"line":194,"column":8}},{"start":{"line":194,"column":8},"end":{"line":194,"column":8}}]},"21":{"line":210,"type":"if","locations":[{"start":{"line":210,"column":62},"end":{"line":210,"column":62}},{"start":{"line":210,"column":62},"end":{"line":210,"column":62}}]},"22":{"line":211,"type":"if","locations":[{"start":{"line":211,"column":8},"end":{"line":211,"column":8}},{"start":{"line":211,"column":8},"end":{"line":211,"column":8}}]},"23":{"line":229,"type":"if","locations":[{"start":{"line":229,"column":8},"end":{"line":229,"column":8}},{"start":{"line":229,"column":8},"end":{"line":229,"column":8}}]},"24":{"line":233,"type":"if","locations":[{"start":{"line":233,"column":8},"end":{"line":233,"column":8}},{"start":{"line":233,"column":8},"end":{"line":233,"column":8}}]},"25":{"line":234,"type":"cond-expr","locations":[{"start":{"line":234,"column":12},"end":{"line":234,"column":32}},{"start":{"line":234,"column":37},"end":{"line":234,"column":62}}]},"26":{"line":238,"type":"if","locations":[{"start":{"line":238,"column":8},"end":{"line":238,"column":8}},{"start":{"line":238,"column":8},"end":{"line":238,"column":8}}]},"27":{"line":260,"type":"if","locations":[{"start":{"line":260,"column":12},"end":{"line":260,"column":12}},{"start":{"line":260,"column":12},"end":{"line":260,"column":12}}]}}},"contracts\\QuestFactory.sol":{"l":{"45":3,"49":36,"50":36,"63":14,"64":14,"77":14,"78":14,"102":5,"119":5,"121":4,"136":4,"147":1},"path":"C:\\Projects\\quests\\packages\\hardhat\\contracts\\QuestFactory.sol","s":{"1":3,"2":36,"3":14,"4":14,"5":5,"6":5,"7":4,"8":4},"b":{"1":[36,0],"2":[14,1],"3":[14,1],"4":[1,1]},"f":{"1":3,"2":36,"3":14,"4":14,"5":5,"6":1},"fnMap":{"1":{"name":"constructor","line":44,"loc":{"start":{"line":44,"column":4},"end":{"line":46,"column":4}}},"2":{"name":"initialize","line":48,"loc":{"start":{"line":48,"column":4},"end":{"line":51,"column":4}}},"3":{"name":"setCreateDeposit","line":62,"loc":{"start":{"line":59,"column":4},"end":{"line":65,"column":4}}},"4":{"name":"setPlayDeposit","line":76,"loc":{"start":{"line":73,"column":4},"end":{"line":79,"column":4}}},"5":{"name":"createQuest","line":93,"loc":{"start":{"line":93,"column":4},"end":{"line":137,"column":4}}},"6":{"name":"setAragonGovernAddress","line":146,"loc":{"start":{"line":144,"column":4},"end":{"line":148,"column":4}}}},"statementMap":{"1":{"start":{"line":45,"column":8},"end":{"line":45,"column":29}},"2":{"start":{"line":49,"column":8},"end":{"line":49,"column":23}},"3":{"start":{"line":64,"column":8},"end":{"line":64,"column":74}},"4":{"start":{"line":78,"column":8},"end":{"line":78,"column":72}},"5":{"start":{"line":102,"column":8},"end":{"line":102,"column":3329}},"6":{"start":{"line":119,"column":8},"end":{"line":119,"column":60}},"7":{"start":{"line":121,"column":8},"end":{"line":121,"column":3983}},"8":{"start":{"line":136,"column":8},"end":{"line":136,"column":29}}},"branchMap":{"1":{"line":48,"type":"if","locations":[{"start":{"line":48,"column":61},"end":{"line":48,"column":61}},{"start":{"line":48,"column":61},"end":{"line":48,"column":61}}]},"2":{"line":62,"type":"if","locations":[{"start":{"line":62,"column":13},"end":{"line":62,"column":13}},{"start":{"line":62,"column":13},"end":{"line":62,"column":13}}]},"3":{"line":76,"type":"if","locations":[{"start":{"line":76,"column":13},"end":{"line":76,"column":13}},{"start":{"line":76,"column":13},"end":{"line":76,"column":13}}]},"4":{"line":146,"type":"if","locations":[{"start":{"line":146,"column":15},"end":{"line":146,"column":15}},{"start":{"line":146,"column":15},"end":{"line":146,"column":15}}]}}}} \ No newline at end of file diff --git a/packages/hardhat/default-config.json b/packages/hardhat/default-config.json index 45e8ac10..a05e1d79 100644 --- a/packages/hardhat/default-config.json +++ b/packages/hardhat/default-config.json @@ -1,68 +1,88 @@ { - "GovernQueueFactory": { - "xdai": "0xA6591419f78C044979bf63Aa81edD5e100C0E957", - "goerli": "0xEA6015008c7926E84C76b70344EbD31a48A6fd2c" - }, - "GovernFactory": { - "xdai": "0x8De393cd9F84D7989A1164191a1f6CDd5D2a7F9B", - "goerli": "0xd0A50194CeFf1A33E2a831F80EBfa2b11aC44B78" - }, - "CreateQuestDeposit": { - "xdai": { - "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", - "amount": 2 + "GovernQueueFactory": { + "xdai": "0xA6591419f78C044979bf63Aa81edD5e100C0E957", + "goerli": "0xEA6015008c7926E84C76b70344EbD31a48A6fd2c" }, - "goerli": { - "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", - "amount": 0.01 - } - }, - "PlayQuestDeposit": { - "xdai": { - "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", - "amount": 0.5 + "GovernFactory": { + "xdai": "0x8De393cd9F84D7989A1164191a1f6CDd5D2a7F9B", + "goerli": "0xd0A50194CeFf1A33E2a831F80EBfa2b11aC44B78" }, - "goerli": { - "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", - "amount": 0.01 - } - }, - "ScheduleDeposit": { - "xdai": { - "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", - "amount": 0.5 + "CreateQuestDeposit": { + "xdai": { + "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", + "amount": 2 + }, + "goerli": { + "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", + "amount": 0.01 + }, + "localhost": { + "token": "0x0000000000000000000000000000000000000000", + "amount": 0 + } }, - "goerli": { - "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", - "amount": 0.01 - } - }, - "ChallengeDeposit": { - "xdai": { - "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", - "amount": 0.3 + "PlayQuestDeposit": { + "xdai": { + "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", + "amount": 0.5 + }, + "goerli": { + "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", + "amount": 0.01 + }, + "localhost": { + "token": "0x0000000000000000000000000000000000000000", + "amount": 0 + } }, - "goerli": { - "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", - "amount": 0.01 - } - }, - "ChallengeFee": { - "goerli": { - "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", - "amount": 0.05 + "ScheduleDeposit": { + "xdai": { + "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", + "amount": 0.5 + }, + "goerli": { + "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", + "amount": 0.01 + }, + "localhost": { + "token": "0x0000000000000000000000000000000000000000", + "amount": 0 + } + }, + "ChallengeDeposit": { + "xdai": { + "token": "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", + "amount": 0.3 + }, + "goerli": { + "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", + "amount": 0.01 + }, + "localhost": { + "token": "0x0000000000000000000000000000000000000000", + "amount": 0 + } + }, + "ChallengeFee": { + "goerli": { + "token": "0x2d467a24095B262787f58ce97d9B130ce7232B57", + "amount": 0.05 + }, + "localhost": { + "token": "0x0000000000000000000000000000000000000000", + "amount": 0 + } + }, + "RootOwner": { + "xdai": "0x7375Ed576952BD6CeD060EeE2Db763130eA13bA0", + "goerli": "0x7375Ed576952BD6CeD060EeE2Db763130eA13bA0" + }, + "ClaimDelay": { + "xdai": 604800, + "goerli": 300 + }, + "CelesteResolver": { + "xdai": "0x44E4fCFed14E1285c9e0F6eae77D5fDd0F196f85", + "goerli": "0xCDD144eac3dD79667a1cAADFDc4Edaa75D0Eb81f" } - }, - "RootOwner": { - "xdai": "0x7375Ed576952BD6CeD060EeE2Db763130eA13bA0", - "goerli": "0x7375Ed576952BD6CeD060EeE2Db763130eA13bA0" - }, - "ClaimDelay": { - "xdai": 604800, - "goerli": 300 - }, - "CelesteResolver": { - "xdai": "0x44E4fCFed14E1285c9e0F6eae77D5fDd0F196f85", - "goerli": "0xCDD144eac3dD79667a1cAADFDc4Edaa75D0Eb81f" - } -} +} \ No newline at end of file diff --git a/packages/hardhat/deploy/deploy-quest.ts b/packages/hardhat/deploy/deploy-quest.ts index 36c5df85..7a10a1bc 100644 --- a/packages/hardhat/deploy/deploy-quest.ts +++ b/packages/hardhat/deploy/deploy-quest.ts @@ -7,16 +7,13 @@ export default async ({ deployments, network, run, + ethers, }: HardhatRuntimeEnvironment) => { const { deploy } = deployments; const { deployer } = await getNamedAccounts(); const constructorArguments = [ "ASDF", "0x00", - "0xdf456B614fE9FF1C7c0B380330Da29C96d40FB02", - 1700122574, - "0x6e7c3BC98bee14302AA2A98B4c5C86b13eB4b6Cd", - "0xdf456B614fE9FF1C7c0B380330Da29C96d40FB02", { token: "0x6e7c3BC98bee14302AA2A98B4c5C86b13eB4b6Cd", amount: "100000000000000000", @@ -25,14 +22,22 @@ export default async ({ token: "0x6e7c3BC98bee14302AA2A98B4c5C86b13eB4b6Cd", amount: "100000000000000000", }, - "0xdf456B614fE9FF1C7c0B380330Da29C96d40FB02", - 0, + { + questCreator: "0xdf456B614fE9FF1C7c0B380330Da29C96d40FB02", + maxPlayers: 0, + rewardToken: "0xdf456B614fE9FF1C7c0B380330Da29C96d40FB02", + expireTime: 1700122574, + aragonGovernAddress: "0x6e7c3BC98bee14302AA2A98B4c5C86b13eB4b6Cd", + fundsRecoveryAddress: "0xdf456B614fE9FF1C7c0B380330Da29C96d40FB02", + isWhiteList: false, + }, ]; + const balance = await ethers.provider.getBalance(deployer); const deployResult = await deploy("Quest", { from: deployer, args: constructorArguments, log: true, - // gasLimit: 4000000, + // gasLimit: 30000000, }); console.log({ constructorArguments }); diff --git a/packages/hardhat/deploy/deploy-quest_factory.ts b/packages/hardhat/deploy/deploy-quest_factory.ts index aba632a1..c399b45a 100644 --- a/packages/hardhat/deploy/deploy-quest_factory.ts +++ b/packages/hardhat/deploy/deploy-quest_factory.ts @@ -3,27 +3,17 @@ import "@nomiclabs/hardhat-etherscan"; import defaultConfig from "../default-config.json"; import exportContractResult from "../scripts/export-contract-result"; -export default async ( - { - getNamedAccounts, - deployments, - ethers, - network, - run, - }: HardhatRuntimeEnvironment, - args?: { - governAddress: string; - createDepositToken: string; - createDepositAmount: number; - playDepositToken: string; - playDepositAmount: number; - } -) => { - const { deploy } = deployments; - const { deployer, govern, owner } = await getNamedAccounts(); +export const buildQuestFactoryConstructorArguments = async ({ + getNamedAccounts, + args, + network, + ethers, +}) => { + const { govern, owner } = await getNamedAccounts(); const createDeposit = args ? { token: args.createDepositToken, amount: args.createDepositAmount } : defaultConfig.CreateQuestDeposit[network.name]; + console.log(network.name); const playDeposit = args ? { token: args.playDepositToken, amount: args.playDepositAmount } : defaultConfig.PlayQuestDeposit[network.name]; @@ -36,13 +26,37 @@ export default async ( owner, ]; console.log({ constructorArguments }); - const deployResult = await deploy("QuestFactory", { - from: deployer, - args: constructorArguments, - log: true, - // gasLimit: 4000000, + return constructorArguments; +}; + +export default async ( + { + getNamedAccounts, + ethers, + network, + run, + upgrades, + }: HardhatRuntimeEnvironment, + args?: { + governAddress: string; + } +) => { + const constructorArguments = await buildQuestFactoryConstructorArguments({ + getNamedAccounts, + args, + network, + ethers, }); - await ethers.getContract("QuestFactory", deployResult.address); + const abi = + require(`../artifacts/contracts/QuestFactory.sol/QuestFactory.json`).abi; + var contractFactory = await ethers.getContractFactory("QuestFactory"); + var deployResult = await upgrades.deployProxy( + contractFactory, + constructorArguments, + { initializer: "initialize" } + ); + deployResult.deployed(); + await ethers.getContractAt("QuestFactory", deployResult.address); try { console.log("Verifying QuestFactory..."); @@ -51,7 +65,7 @@ export default async ( () => run("verify:verify", { address: deployResult.address, - constructorArguments, + constructorArguments: [], }) .then(res) .catch(rej), @@ -62,9 +76,9 @@ export default async ( console.error("Failed when verifying the QuestFactory contract", error); } - exportContractResult(network, "Quest", { + exportContractResult(network, "QuestFactory", { address: deployResult.address, - abi: deployResult.abi, + abi: abi, }); return deployResult; diff --git a/packages/hardhat/deployments/goerli/Quest.json b/packages/hardhat/deployments/goerli/Quest.json index 30de06f0..cc0377b0 100644 --- a/packages/hardhat/deployments/goerli/Quest.json +++ b/packages/hardhat/deployments/goerli/Quest.json @@ -1,289 +1 @@ -{ - "address": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", - "abi": [ - { - "inputs": [ - { "internalType": "string", "name": "_questTitle", "type": "string" }, - { - "internalType": "bytes", - "name": "_questDetailsRef", - "type": "bytes" - }, - { - "internalType": "contract IERC20", - "name": "_rewardToken", - "type": "address" - }, - { "internalType": "uint256", "name": "_expireTime", "type": "uint256" }, - { - "internalType": "address", - "name": "_aragonGovernAddress", - "type": "address" - }, - { - "internalType": "address payable", - "name": "_fundsRecoveryAddress", - "type": "address" - }, - { - "components": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "internalType": "struct Models.Deposit", - "name": "_createDeposit", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "internalType": "struct Models.Deposit", - "name": "_playDeposit", - "type": "tuple" - }, - { - "internalType": "address", - "name": "_questCreator", - "type": "address" - }, - { "internalType": "uint32", "name": "_maxPlayers", "type": "uint32" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes", - "name": "evidence", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "address", - "name": "player", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "QuestClaimed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "player", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "QuestPlayed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "player", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "QuestUnplayed", - "type": "event" - }, - { - "inputs": [], - "name": "aragonGovernAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "executer", "type": "address" } - ], - "name": "canExecute", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes", "name": "_evidence", "type": "bytes" }, - { "internalType": "address", "name": "_player", "type": "address" }, - { "internalType": "uint256", "name": "_amount", "type": "uint256" }, - { "internalType": "bool", "name": "_claimAll", "type": "bool" } - ], - "name": "claim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "claims", - "outputs": [ - { "internalType": "bytes", "name": "evidence", "type": "bytes" }, - { "internalType": "address", "name": "player", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "createDeposit", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "expireTime", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fundsRecoveryAddress", - "outputs": [ - { "internalType": "address payable", "name": "", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPlayers", - "outputs": [ - { "internalType": "address[]", "name": "", "type": "address[]" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isCreateDepositReleased", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxPlayers", - "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_player", "type": "address" } - ], - "name": "play", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "playDeposit", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "questCreator", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "questDetailsRef", - "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "questTitle", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "recoverFundsAndDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "rewardToken", - "outputs": [ - { "internalType": "contract IERC20", "name": "", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_player", "type": "address" } - ], - "name": "unplay", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} +{"address":"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 df6e9158..88fc4001 100644 --- a/packages/hardhat/deployments/goerli/QuestFactory.json +++ b/packages/hardhat/deployments/goerli/QuestFactory.json @@ -1,547 +1 @@ -{ - "address": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_aragonGovernAddress", - "type": "address" - }, - { - "internalType": "contract IERC20", - "name": "_createDepositToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_createDepositAmount", - "type": "uint256" - }, - { - "internalType": "contract IERC20", - "name": "_playDepositToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_playDepositAmount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_initialOwner", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "CreateDepositChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "PlayDepositChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "questAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "questTitle", - "type": "string" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "questDetailsRef", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "address", - "name": "rewardTokenAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "expireTime", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "fundsRecoveryAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "createDepositToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "createDepositAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "playDepositToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "playDepositAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "creator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "maxPlayers", - "type": "uint32" - } - ], - "name": "QuestCreated", - "type": "event" - }, - { - "inputs": [], - "name": "aragonGovernAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "createDeposit", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_questTitle", - "type": "string" - }, - { - "internalType": "bytes", - "name": "_questDetailsRef", - "type": "bytes" - }, - { - "internalType": "contract IERC20", - "name": "_rewardToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_expireTime", - "type": "uint256" - }, - { - "internalType": "address payable", - "name": "_fundsRecoveryAddress", - "type": "address" - }, - { - "internalType": "uint32", - "name": "_maxPlayers", - "type": "uint32" - } - ], - "name": "createQuest", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "playDeposit", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_aragonGovernAddress", - "type": "address" - } - ], - "name": "setAragonGovernAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "setCreateDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "setPlayDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x3e4eda7a1773acb31bbe7957514b24c11d8998b8b5f3c99d81450b4377b48578", - "receipt": { - "to": null, - "from": "0x91B0d67D3F47A30FBEeB159E67209Ad6cb2cE22E", - "contractAddress": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", - "transactionIndex": 43, - "gasUsed": "3156538", - "logsBloom": "0x00000000000000000000000000000100000040000000000000800000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000040000080000000001000000000000000000000020000000000000020000000000000000000804000400000004000400080000000200400000000000000000000000000000000000000000008000000000000000000002000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x0155891ee13717b5afcb2d3719d28b5af24f24ef675d454d18f451ca7c8ca397", - "transactionHash": "0x3e4eda7a1773acb31bbe7957514b24c11d8998b8b5f3c99d81450b4377b48578", - "logs": [ - { - "transactionIndex": 43, - "blockNumber": 8240344, - "transactionHash": "0x3e4eda7a1773acb31bbe7957514b24c11d8998b8b5f3c99d81450b4377b48578", - "address": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", - "topics": [ - "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x00000000000000000000000091b0d67d3f47a30fbeeb159e67209ad6cb2ce22e" - ], - "data": "0x", - "logIndex": 98, - "blockHash": "0x0155891ee13717b5afcb2d3719d28b5af24f24ef675d454d18f451ca7c8ca397" - }, - { - "transactionIndex": 43, - "blockNumber": 8240344, - "transactionHash": "0x3e4eda7a1773acb31bbe7957514b24c11d8998b8b5f3c99d81450b4377b48578", - "address": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", - "topics": [ - "0x35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f250920079" - ], - "data": "0x0000000000000000000000000000000000000000000000000000000063b1ec880000000000000000000000002d467a24095b262787f58ce97d9b130ce7232b57000000000000000000000000000000000000000000000000002386f26fc10000", - "logIndex": 99, - "blockHash": "0x0155891ee13717b5afcb2d3719d28b5af24f24ef675d454d18f451ca7c8ca397" - }, - { - "transactionIndex": 43, - "blockNumber": 8240344, - "transactionHash": "0x3e4eda7a1773acb31bbe7957514b24c11d8998b8b5f3c99d81450b4377b48578", - "address": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", - "topics": [ - "0x013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb89" - ], - "data": "0x0000000000000000000000000000000000000000000000000000000063b1ec880000000000000000000000002d467a24095b262787f58ce97d9b130ce7232b57000000000000000000000000000000000000000000000000002386f26fc10000", - "logIndex": 100, - "blockHash": "0x0155891ee13717b5afcb2d3719d28b5af24f24ef675d454d18f451ca7c8ca397" - }, - { - "transactionIndex": 43, - "blockNumber": 8240344, - "transactionHash": "0x3e4eda7a1773acb31bbe7957514b24c11d8998b8b5f3c99d81450b4377b48578", - "address": "0xa6FEAF5CA07b6F367CF39a840F5A7E41d0AE613D", - "topics": [ - "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "0x00000000000000000000000091b0d67d3f47a30fbeeb159e67209ad6cb2ce22e", - "0x0000000000000000000000007375ed576952bd6ced060eee2db763130ea13ba0" - ], - "data": "0x", - "logIndex": 101, - "blockHash": "0x0155891ee13717b5afcb2d3719d28b5af24f24ef675d454d18f451ca7c8ca397" - } - ], - "blockNumber": 8240344, - "cumulativeGasUsed": "8100835", - "status": 1, - "byzantium": true - }, - "args": [ - "0x7281807631714071425C2efE38917C9e1A7D1aA4", - "0x2d467a24095B262787f58ce97d9B130ce7232B57", - "10000000000000000", - "0x2d467a24095B262787f58ce97d9B130ce7232B57", - "10000000000000000", - "0x7375Ed576952BD6CeD060EeE2Db763130eA13bA0" - ], - "solcInputHash": "95827ae7dd12c21f6fa5e995742d6074", - "metadata": "{\"compiler\":{\"version\":\"0.8.1+commit.df193b15\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_aragonGovernAddress\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_createDepositToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_createDepositAmount\",\"type\":\"uint256\"},{\"internalType\":\"contract IERC20\",\"name\":\"_playDepositToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_playDepositAmount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_initialOwner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"CreateDepositChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"PlayDepositChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"questAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"questTitle\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"questDetailsRef\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"rewardTokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expireTime\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"fundsRecoveryAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"createDepositToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"createDepositAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"playDepositToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"playDepositAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"maxPlayers\",\"type\":\"uint32\"}],\"name\":\"QuestCreated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"aragonGovernAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"createDeposit\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_questTitle\",\"type\":\"string\"},{\"internalType\":\"bytes\",\"name\":\"_questDetailsRef\",\"type\":\"bytes\"},{\"internalType\":\"contract IERC20\",\"name\":\"_rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_expireTime\",\"type\":\"uint256\"},{\"internalType\":\"address payable\",\"name\":\"_fundsRecoveryAddress\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"_maxPlayers\",\"type\":\"uint32\"}],\"name\":\"createQuest\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"playDeposit\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_aragonGovernAddress\",\"type\":\"address\"}],\"name\":\"setAragonGovernAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"setCreateDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"setPlayDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setAragonGovernAddress(address)\":{\"details\":\"Be able to change it after deploy so we can deploy a new GovernQueue but keep the same QuestFactory\",\"params\":{\"_aragonGovernAddress\":\"The aragonGovernAddress.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/QuestFactory.sol\":\"QuestFactory\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":20000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n// CAUTION\\n// This version of SafeMath should only be used with Solidity 0.8 or later,\\n// because it relies on the compiler's built in overflow checks.\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations.\\n *\\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\\n * now has built in overflow checking.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a + b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a * b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator.\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0f633a0223d9a1dcccfcf38a64c9de0874dfcbfac0c6941ccf074d63a2ce0e1e\",\"license\":\"MIT\"},\"contracts/Quest.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/utils/math/SafeMath.sol\\\";\\r\\nimport \\\"./libraries/Deposit.sol\\\";\\r\\nimport \\\"./libraries/Models.sol\\\";\\r\\nimport \\\"./libraries/IExecutable.sol\\\";\\r\\n\\r\\ncontract Quest is IExecutable {\\r\\n using SafeMath for uint256;\\r\\n using SafeERC20 for IERC20;\\r\\n using DepositLib for Models.Deposit;\\r\\n\\r\\n // Quest payload\\r\\n address public questCreator;\\r\\n string public questTitle;\\r\\n bytes public questDetailsRef;\\r\\n IERC20 public rewardToken;\\r\\n uint256 public expireTime;\\r\\n address public aragonGovernAddress;\\r\\n address payable public fundsRecoveryAddress;\\r\\n uint32 public maxPlayers; // 0 for unlimited players\\r\\n\\r\\n Models.Claim[] public claims;\\r\\n Models.Deposit public createDeposit;\\r\\n Models.Deposit public playDeposit;\\r\\n bool public isCreateDepositReleased;\\r\\n\\r\\n address[] private playerList;\\r\\n\\r\\n event QuestClaimed(bytes evidence, address player, uint256 amount);\\r\\n event QuestPlayed(address player, uint256 timestamp);\\r\\n event QuestUnplayed(address player, uint256 timestamp);\\r\\n\\r\\n constructor(\\r\\n string memory _questTitle,\\r\\n bytes memory _questDetailsRef,\\r\\n IERC20 _rewardToken,\\r\\n uint256 _expireTime,\\r\\n address _aragonGovernAddress,\\r\\n address payable _fundsRecoveryAddress,\\r\\n Models.Deposit memory _createDeposit,\\r\\n Models.Deposit memory _playDeposit,\\r\\n address _questCreator,\\r\\n uint32 _maxPlayers\\r\\n ) {\\r\\n questTitle = _questTitle;\\r\\n questDetailsRef = _questDetailsRef;\\r\\n rewardToken = _rewardToken;\\r\\n expireTime = _expireTime;\\r\\n aragonGovernAddress = _aragonGovernAddress;\\r\\n fundsRecoveryAddress = _fundsRecoveryAddress;\\r\\n questCreator = _questCreator;\\r\\n createDeposit = _createDeposit;\\r\\n playDeposit = _playDeposit;\\r\\n\\r\\n isCreateDepositReleased = false;\\r\\n maxPlayers = _maxPlayers;\\r\\n }\\r\\n\\r\\n /*\\r\\n * Claim a quest reward.\\r\\n *\\r\\n * @param _evidence Evidence of the claim.\\r\\n * @param _player Player address.\\r\\n * @param _amount Amount of the reward.\\r\\n *\\r\\n * requires sender to be aragonGovernAddress\\r\\n * requires evidence to not be empty\\r\\n * requires claim amount to not exceed available deposit when same token\\r\\n *\\r\\n * emit QuestClaimed\\r\\n */\\r\\n function claim(\\r\\n bytes memory _evidence,\\r\\n address _player,\\r\\n uint256 _amount,\\r\\n bool _claimAll\\r\\n ) external {\\r\\n require(msg.sender == aragonGovernAddress, \\\"ERROR: Sender not govern\\\");\\r\\n require(_evidence.length != 0, \\\"ERROR: No evidence\\\");\\r\\n\\r\\n uint256 balance = rewardToken.balanceOf(address(this));\\r\\n\\r\\n if (_claimAll) {\\r\\n // Claim all but let the create deposit if they are same token\\r\\n if (address(rewardToken) == address(createDeposit.token)) {\\r\\n (, uint256 result) = balance.trySub(createDeposit.amount);\\r\\n _amount = result;\\r\\n } else {\\r\\n _amount = balance;\\r\\n }\\r\\n // Claim all but let play deposits of each player if they are same token\\r\\n if (address(rewardToken) == address(playDeposit.token)) {\\r\\n (, uint256 result) = _amount.trySub(\\r\\n playDeposit.amount * playerList.length\\r\\n );\\r\\n _amount = result;\\r\\n }\\r\\n }\\r\\n\\r\\n if (address(rewardToken) == address(createDeposit.token)) {\\r\\n (, uint256 result) = balance.trySub(_amount);\\r\\n require(\\r\\n result >= createDeposit.amount,\\r\\n \\\"ERROR: Should not exceed allowed bounty\\\"\\r\\n );\\r\\n }\\r\\n\\r\\n if (_amount > 0) {\\r\\n rewardToken.safeTransfer(_player, _amount);\\r\\n }\\r\\n\\r\\n claims.push(Models.Claim(_evidence, _player, _amount));\\r\\n\\r\\n emit QuestClaimed(_evidence, _player, _amount);\\r\\n }\\r\\n\\r\\n /*\\r\\n * Release create deposit to creator and send unused funds to fundsRecoveryAddress.\\r\\n * requires quests to have expired\\r\\n *\\r\\n * requires quest to be expired\\r\\n */\\r\\n function recoverFundsAndDeposit() external {\\r\\n require(block.timestamp >= expireTime, \\\"ERROR: Not expired\\\");\\r\\n\\r\\n // Restore deposit if not already released\\r\\n if (!isCreateDepositReleased) {\\r\\n createDeposit.releaseTo(questCreator);\\r\\n isCreateDepositReleased = true;\\r\\n }\\r\\n\\r\\n uint256 balance = rewardToken.balanceOf(address(this));\\r\\n\\r\\n // Claim all but let the create deposit if they are same token\\r\\n if (address(rewardToken) == address(playDeposit.token)) {\\r\\n (, balance) = balance.trySub(\\r\\n playDeposit.amount * playerList.length\\r\\n );\\r\\n }\\r\\n\\r\\n rewardToken.safeTransfer(fundsRecoveryAddress, balance);\\r\\n }\\r\\n\\r\\n /**\\r\\n * Verify given executer can execute this quest.\\r\\n * @param executer The player to verify\\r\\n */\\r\\n function canExecute(\\r\\n address executer\\r\\n ) external view override returns (bool) {\\r\\n return findIndexOfPlayer(executer) != -1;\\r\\n }\\r\\n\\r\\n /**\\r\\n * Register a player to the quest. (sender could be the player or quest creator)\\r\\n *\\r\\n * @param _player Player address.\\r\\n *\\r\\n * requires sender to be the quest creator or the player\\r\\n * requires sender to put a deposit (if its creator, deposit will be released to player)\\r\\n * requires player list is not full\\r\\n * requires quest is not expired\\r\\n * requires player is not already registered\\r\\n *\\r\\n * emit QuestPlayed with player and timestamp\\r\\n */\\r\\n function play(address _player) external {\\r\\n require(\\r\\n msg.sender == _player || msg.sender == questCreator,\\r\\n \\\"ERROR: Sender not player nor creator\\\"\\r\\n );\\r\\n require(\\r\\n maxPlayers == 0 || playerList.length < maxPlayers,\\r\\n \\\"ERROR: Max players reached\\\"\\r\\n );\\r\\n require(block.timestamp < expireTime, \\\"ERROR: Quest expired\\\");\\r\\n int256 playerIndex = findIndexOfPlayer(_player);\\r\\n require(playerIndex == -1, \\\"ERROR: Player already exists\\\");\\r\\n\\r\\n playDeposit.collectFrom(msg.sender, address(this));\\r\\n\\r\\n playerList.push(_player);\\r\\n emit QuestPlayed(_player, block.timestamp);\\r\\n }\\r\\n\\r\\n /**\\r\\n * Unregister a player from the quest. (sender could be the player or quest creator)\\r\\n * @param _player Player address.\\r\\n *\\r\\n * requires sender to be the quest creator or the player\\r\\n * requires player is registered\\r\\n *\\r\\n * emit QuestUnplayed with player and timestamp\\r\\n */\\r\\n function unplay(address _player) external {\\r\\n require(\\r\\n msg.sender == _player || msg.sender == questCreator,\\r\\n \\\"ERROR: Sender not player nor creator\\\"\\r\\n );\\r\\n int256 playerIndex = findIndexOfPlayer(_player);\\r\\n require(playerIndex != -1, \\\"ERROR: player not in list\\\");\\r\\n\\r\\n // We put the last player in the place of the player to remove\\r\\n playerList[uint256(playerIndex)] = playerList[playerList.length - 1];\\r\\n // And then we can remove the last element to have the actual lenght updated\\r\\n playerList.pop();\\r\\n\\r\\n playDeposit.releaseTo(_player);\\r\\n emit QuestUnplayed(_player, block.timestamp);\\r\\n }\\r\\n\\r\\n /**\\r\\n Simply return the player list as the entire array\\r\\n */\\r\\n function getPlayers() external view returns (address[] memory) {\\r\\n return playerList;\\r\\n }\\r\\n\\r\\n // Private functions\\r\\n\\r\\n function findIndexOfPlayer(address _player) private view returns (int256) {\\r\\n for (uint256 i = 0; i < playerList.length; i++) {\\r\\n if (playerList[i] == _player) {\\r\\n return int256(i);\\r\\n }\\r\\n }\\r\\n return -1;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x456dfbc5d6bc59f674c30fcb9d71184d28cbd70da826d60934d5d20dba5a4500\",\"license\":\"GPL-3.0\"},\"contracts/QuestFactory.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\r\\nimport \\\"./libraries/Deposit.sol\\\";\\r\\nimport \\\"./libraries/Models.sol\\\";\\r\\nimport \\\"./Quest.sol\\\";\\r\\n\\r\\ncontract QuestFactory is Ownable {\\r\\n using DepositLib for Models.Deposit;\\r\\n\\r\\n address public aragonGovernAddress;\\r\\n Models.Deposit public createDeposit;\\r\\n Models.Deposit public playDeposit;\\r\\n\\r\\n event QuestCreated(\\r\\n address questAddress,\\r\\n string questTitle,\\r\\n bytes questDetailsRef,\\r\\n address rewardTokenAddress,\\r\\n uint256 expireTime,\\r\\n address fundsRecoveryAddress,\\r\\n address createDepositToken,\\r\\n uint256 createDepositAmount,\\r\\n address playDepositToken,\\r\\n uint256 playDepositAmount,\\r\\n address creator,\\r\\n uint32 maxPlayers\\r\\n );\\r\\n\\r\\n event CreateDepositChanged(\\r\\n uint256 timestamp,\\r\\n address token,\\r\\n uint256 amount\\r\\n );\\r\\n\\r\\n event PlayDepositChanged(uint256 timestamp, address token, uint256 amount);\\r\\n\\r\\n constructor(\\r\\n address _aragonGovernAddress,\\r\\n IERC20 _createDepositToken,\\r\\n uint256 _createDepositAmount,\\r\\n IERC20 _playDepositToken,\\r\\n uint256 _playDepositAmount,\\r\\n address _initialOwner\\r\\n ) {\\r\\n aragonGovernAddress = _aragonGovernAddress;\\r\\n setCreateDeposit(_createDepositToken, _createDepositAmount);\\r\\n setPlayDeposit(_playDepositToken, _playDepositAmount);\\r\\n if (_initialOwner != msg.sender) {\\r\\n transferOwnership(_initialOwner);\\r\\n }\\r\\n }\\r\\n\\r\\n /*\\r\\n * @dev Set the deposit token and amount.\\r\\n * @param _depositToken The deposit token.\\r\\n * @param _depositAmount The deposit amount.\\r\\n * emit CreateDepositChanged\\r\\n */\\r\\n function setCreateDeposit(IERC20 token, uint256 amount) public onlyOwner {\\r\\n createDeposit = Models.Deposit(token, amount);\\r\\n emit CreateDepositChanged(block.timestamp, address(token), amount);\\r\\n }\\r\\n\\r\\n /*\\r\\n * @dev Set the play deposit token and amount.\\r\\n * @param _depositToken The deposit token.\\r\\n * @param _depositAmount The deposit amount.\\r\\n * emit PlayDepositChanged\\r\\n */\\r\\n function setPlayDeposit(IERC20 token, uint256 amount) public onlyOwner {\\r\\n playDeposit = Models.Deposit(token, amount);\\r\\n emit PlayDepositChanged(block.timestamp, address(token), amount);\\r\\n }\\r\\n\\r\\n /*\\r\\n * Collect deposit, deploy a new Quest with given info contract\\r\\n * and transfer deposit to new Quest.\\r\\n * @param _title Quest title.\\r\\n * @param _details Quest details.\\r\\n * @param _rewardTokenAddress Reward token address.\\r\\n * @param _expireTime Expire time.\\r\\n * @param _fundsRecoveryAddress Funds recovery address.\\r\\n * requires deposit allowance\\r\\n * returns Quest address.\\r\\n * emits QuestCreated\\r\\n */\\r\\n function createQuest(\\r\\n string memory _questTitle,\\r\\n bytes memory _questDetailsRef,\\r\\n IERC20 _rewardToken,\\r\\n uint256 _expireTime,\\r\\n address payable _fundsRecoveryAddress,\\r\\n uint32 _maxPlayers\\r\\n ) external returns (address) {\\r\\n Quest quest = new Quest(\\r\\n _questTitle,\\r\\n _questDetailsRef,\\r\\n _rewardToken,\\r\\n _expireTime,\\r\\n aragonGovernAddress,\\r\\n _fundsRecoveryAddress,\\r\\n Models.Deposit(createDeposit.token, createDeposit.amount),\\r\\n Models.Deposit(playDeposit.token, playDeposit.amount),\\r\\n msg.sender,\\r\\n _maxPlayers\\r\\n );\\r\\n\\r\\n // Collect deposit from quest creator and send it to quest\\r\\n createDeposit.collectFrom(msg.sender, address(quest));\\r\\n\\r\\n emit QuestCreated(\\r\\n address(quest),\\r\\n _questTitle,\\r\\n _questDetailsRef,\\r\\n address(_rewardToken),\\r\\n _expireTime,\\r\\n _fundsRecoveryAddress,\\r\\n address(createDeposit.token),\\r\\n createDeposit.amount,\\r\\n address(playDeposit.token),\\r\\n playDeposit.amount,\\r\\n msg.sender,\\r\\n _maxPlayers\\r\\n );\\r\\n\\r\\n return address(quest);\\r\\n }\\r\\n\\r\\n /**\\r\\n * @dev Be able to change it after deploy so we can deploy\\r\\n * a new GovernQueue but keep the same QuestFactory\\r\\n * @param _aragonGovernAddress The aragonGovernAddress.\\r\\n */\\r\\n function setAragonGovernAddress(\\r\\n address _aragonGovernAddress\\r\\n ) external onlyOwner {\\r\\n aragonGovernAddress = _aragonGovernAddress;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x8a5c374e65ebdff41dabbe7deee05ad4b7df3db6a6ab7720c60c25e253ee0d71\",\"license\":\"GPL-3.0\"},\"contracts/libraries/Deposit.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\r\\n\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport \\\"./Models.sol\\\";\\r\\n\\r\\nlibrary DepositLib {\\r\\n using SafeERC20 for IERC20;\\r\\n\\r\\n /*\\r\\n * Collect deposit from signer and send it to _to address.\\r\\n * @param _token The deposit token.\\r\\n * @param _amount The deposit amount.\\r\\n * @param _to The address where the deposit should be transfered.\\r\\n */\\r\\n function collectFrom(\\r\\n Models.Deposit memory _collateral,\\r\\n address _from,\\r\\n address _to\\r\\n ) internal {\\r\\n collectFrom(_collateral, _from);\\r\\n releaseTo(_collateral, _to);\\r\\n }\\r\\n\\r\\n /*\\r\\n * Collect deposit from signer\\r\\n * @param _token The deposit token.\\r\\n * @param _amount The deposit amount.\\r\\n */\\r\\n function collectFrom(Models.Deposit memory _collateral, address _from)\\r\\n internal\\r\\n {\\r\\n if (_collateral.amount > 0) {\\r\\n // Verify allowance\\r\\n uint256 allowance = _collateral.token.allowance(\\r\\n _from,\\r\\n address(this)\\r\\n );\\r\\n require(\\r\\n allowance >= _collateral.amount,\\r\\n \\\"ERROR : Deposit bad allowance\\\"\\r\\n );\\r\\n\\r\\n _collateral.token.safeTransferFrom(\\r\\n _from,\\r\\n address(this),\\r\\n _collateral.amount\\r\\n );\\r\\n }\\r\\n }\\r\\n\\r\\n function releaseTo(Models.Deposit memory _collateral, address _to)\\r\\n internal\\r\\n {\\r\\n if (_collateral.amount > 0) {\\r\\n _collateral.token.safeTransfer(_to, _collateral.amount);\\r\\n }\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0x00419d7de8fe1cf0e8c06555f8c2929dede75db585aa6c9e8c7a2ff8c91f5051\",\"license\":\"GPL-3.0\"},\"contracts/libraries/IExecutable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\r\\npragma solidity ^0.8.1;\\r\\n\\r\\ninterface IExecutable {\\r\\n function canExecute(address executer) external returns (bool);\\r\\n}\\r\\n\",\"keccak256\":\"0x1d0c1ecd494b35f6e3c1d7e092ac6b78425f02ad95ee0dbb4ba7215120072cea\",\"license\":\"GPL-3.0\"},\"contracts/libraries/Models.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\r\\npragma solidity ^0.8.1;\\r\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\n\\r\\nlibrary Models {\\r\\n struct Deposit {\\r\\n IERC20 token;\\r\\n uint256 amount;\\r\\n }\\r\\n struct Claim {\\r\\n bytes evidence;\\r\\n address player;\\r\\n uint256 amount;\\r\\n }\\r\\n}\\r\\n\",\"keccak256\":\"0xe986229d7b557584748437b549743509e0fe5e41fc02b2d468dbae860612be26\",\"license\":\"GPL-3.0\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200396b3803806200396b83398101604081905262000034916200028c565b6200004862000042620000a3565b620000a7565b600180546001600160a01b0319166001600160a01b0388161790556200006f8585620000f7565b6200007b838362000177565b6001600160a01b038116331462000097576200009781620001eb565b505050505050620003b7565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6200010162000235565b6040805180820182526001600160a01b0384168082526020909101839052600280546001600160a01b03191690911790556003829055517f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f250920079906200016b9042908590859062000382565b60405180910390a15050565b6200018162000235565b6040805180820182526001600160a01b0384168082526020909101839052600480546001600160a01b03191690911790556005829055517f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb89906200016b9042908590859062000382565b620001f562000235565b6001600160a01b038116620002275760405162461bcd60e51b81526004016200021e9062000307565b60405180910390fd5b6200023281620000a7565b50565b6200023f620000a3565b6001600160a01b0316620002526200027d565b6001600160a01b0316146200027b5760405162461bcd60e51b81526004016200021e906200034d565b565b6000546001600160a01b031690565b60008060008060008060c08789031215620002a5578182fd5b8651620002b281620003a1565b6020880151909650620002c581620003a1565b604088015160608901519196509450620002df81620003a1565b608088015160a08901519194509250620002f981620003a1565b809150509295509295509295565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b9283526001600160a01b03919091166020830152604082015260600190565b6001600160a01b03811681146200023257600080fd5b6135a480620003c76000396000f3fe60806040523480156200001157600080fd5b5060043610620000cf5760003560e01c8063b0a87ac11162000081578063e87fae211162000063578063e87fae21146200015e578063edeecdd31462000175578063f2fde38b146200018c57620000cf565b8063b0a87ac1146200014a578063d03ffefb146200015457620000cf565b80638c43b41111620000b75780638c43b41114620000f75780638c53c9bd146200010e5780638da5cb5b146200013157620000cf565b8062732e3014620000d4578063715018a614620000ed575b600080fd5b620000eb620000e536600462000c39565b620001a3565b005b620000eb620001f4565b620000eb6200010836600462000c7a565b6200020c565b62000118620002b1565b6040516200012892919062000f50565b60405180910390f35b6200013b620002d3565b60405162000128919062000e2d565b6200013b620002ef565b620001186200030b565b6200013b6200016f36600462000ca8565b6200032d565b620000eb6200018636600462000c7a565b620004be565b620000eb6200019d36600462000c39565b62000557565b620001ad620005c8565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b620001fe620005c8565b6200020a600062000642565b565b62000216620005c8565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020909101839052600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001690911790556005829055517f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb8990620002a590429085908590620011ec565b60405180910390a15050565b60045460055473ffffffffffffffffffffffffffffffffffffffff9091169082565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60025460035473ffffffffffffffffffffffffffffffffffffffff9091169082565b60015460408051808201825260025473ffffffffffffffffffffffffffffffffffffffff9081168252600354602080840191909152835180850185526004548316815260055491810191909152925160009485948c948c948c948c9491909116928b929133908c90620003a09062000b6e565b620003b59a9998979695949392919062000f8b565b604051809103906000f080158015620003d2573d6000803e3d6000fd5b506040805180820190915260025473ffffffffffffffffffffffffffffffffffffffff168152600354602082015290915062000410903383620006b7565b7f6b2fd076e791d7e0318fa62bf6e275ebe9ff601badea3d9bfdc43c02317d1119818989898989600260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260010154600460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460010154338e604051620004ab9c9b9a9998979695949392919062000ea6565b60405180910390a1979650505050505050565b620004c8620005c8565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020909101839052600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001690911790556003829055517f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f25092007990620002a590429085908590620011ec565b62000561620005c8565b73ffffffffffffffffffffffffffffffffffffffff8116620005ba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001032565b60405180910390fd5b620005c58162000642565b50565b620005d2620006d4565b73ffffffffffffffffffffffffffffffffffffffff16620005f2620002d3565b73ffffffffffffffffffffffffffffffffffffffff16146200020a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b190620010ec565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620006c38383620006d8565b620006cf838262000807565b505050565b3390565b602082015115620008035781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e906200073d908590309060040162000e4e565b60206040518083038186803b1580156200075657600080fd5b505afa1580156200076b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000791919062000d7b565b90508260200151811015620007d4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001121565b60208301518351620006cf9173ffffffffffffffffffffffffffffffffffffffff90911690849030906200083f565b5050565b602082015115620008035760208201518251620008039173ffffffffffffffffffffffffffffffffffffffff909116908390620008ec565b620008e6846323b872dd60e01b858585604051602401620008639392919062000e75565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526200090e565b50505050565b620006cf8363a9059cbb60e01b84846040516024016200086392919062000f50565b600062000972826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620009cc9092919063ffffffff16565b805190915015620006cf578080602001905181019062000993919062000c58565b620006cf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1906200118f565b6060620009dd8484600085620009e7565b90505b9392505050565b60608247101562000a26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1906200108f565b62000a318562000af6565b62000a6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001158565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405162000a95919062000e0f565b60006040518083038185875af1925050503d806000811462000ad4576040519150601f19603f3d011682016040523d82523d6000602084013e62000ad9565b606091505b509150915062000aeb82828662000b16565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff81163b15155b919050565b6060831562000b27575081620009e0565b82511562000b385782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1919062000f76565b6122d5806200129a83390190565b600067ffffffffffffffff8084111562000b9a5762000b9a62001247565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171562000be35762000be362001247565b8160405280935085815286868601111562000bfd57600080fd5b858560208301376000602087830101525050509392505050565b803562000b118162001276565b803563ffffffff8116811462000b1157600080fd5b60006020828403121562000c4b578081fd5b8135620009e08162001276565b60006020828403121562000c6a578081fd5b81518015158114620009e0578182fd5b6000806040838503121562000c8d578081fd5b823562000c9a8162001276565b946020939093013593505050565b60008060008060008060c0878903121562000cc1578182fd5b863567ffffffffffffffff8082111562000cd9578384fd5b818901915089601f83011262000ced578384fd5b62000cfe8a83356020850162000b7c565b9750602089013591508082111562000d14578384fd5b508701601f8101891362000d26578283fd5b62000d378982356020840162000b7c565b95505062000d486040880162000c17565b93506060870135925062000d5f6080880162000c17565b915062000d6f60a0880162000c24565b90509295509295509295565b60006020828403121562000d8d578081fd5b5051919050565b6000815180845262000dae81602086016020860162001218565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b805173ffffffffffffffffffffffffffffffffffffffff168252602090810151910152565b63ffffffff169052565b6000825162000e2381846020870162001218565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b600073ffffffffffffffffffffffffffffffffffffffff808f168352610180602084015262000eda61018084018f62000d94565b838103604085015262000eee818f62000d94565b925050808c1660608401528a6080840152808a1660a084015280891660c08401528760e0840152808716610100840152856101208401528085166101408401525062000f3f61016083018462000e05565b9d9c50505050505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b600060208252620009e0602083018462000d94565b600061018080835262000fa18184018e62000d94565b9050828103602084015262000fb7818d62000d94565b91505073ffffffffffffffffffffffffffffffffffffffff808b166040840152896060840152808916608084015280881660a084015262000ffc60c084018862000de0565b6200100c61010084018762000de0565b8085166101408401525063ffffffff83166101608301529b9a5050505050505050505050565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601d908201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b92835273ffffffffffffffffffffffffffffffffffffffff919091166020830152604082015260600190565b60005b83811015620012355781810151838201526020016200121b565b83811115620008e65750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620005c557600080fdfe60806040523480156200001157600080fd5b50604051620022d5380380620022d58339810160408190526200003491620002b7565b8951620000499060019060208d019062000118565b5088516200005f9060029060208c019062000118565b50600380546001600160a01b03199081166001600160a01b039a8b16179091556004979097556005805488169689169690961790955560068054600080548916938a16939093179092558351600880548916918a169190911790556020938401516009558251600a80548916918a169190911790559190920151600b55600c805460ff19169055931693169290921763ffffffff60a01b1916600160a01b63ffffffff90931692909202919091179055506200044e9050565b8280546200012690620003e2565b90600052602060002090601f0160209004810192826200014a576000855562000195565b82601f106200016557805160ff191683800117855562000195565b8280016001018555821562000195579182015b828111156200019557825182559160200191906001019062000178565b50620001a3929150620001a7565b5090565b5b80821115620001a35760008155600101620001a8565b8051620001cb8162000435565b919050565b600082601f830112620001e1578081fd5b81516001600160401b03811115620001fd57620001fd6200041f565b602062000213601f8301601f19168201620003af565b828152858284870101111562000227578384fd5b835b838110156200024657858101830151828201840152820162000229565b838111156200025757848385840101525b5095945050505050565b60006040828403121562000273578081fd5b6200027f6040620003af565b905081516200028e8162000435565b808252506020820151602082015292915050565b805163ffffffff81168114620001cb57600080fd5b6000806000806000806000806000806101808b8d031215620002d7578586fd5b8a516001600160401b0380821115620002ee578788fd5b620002fc8e838f01620001d0565b9b5060208d015191508082111562000312578788fd5b50620003218d828e01620001d0565b9950506200033260408c01620001be565b975060608b015196506200034960808c01620001be565b95506200035960a08c01620001be565b94506200036a8c60c08d0162000261565b93506200037c8c6101008d0162000261565b92506200038d6101408c01620001be565b91506200039e6101608c01620002a2565b90509295989b9194979a5092959850565b604051601f8201601f191681016001600160401b0381118282101715620003da57620003da6200041f565b604052919050565b600281046001821680620003f757607f821691505b602082108114156200041957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200044b57600080fd5b50565b611e77806200045e6000396000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80638c53c9bd116100b2578063d03ffefb11610081578063e492814f11610066578063e492814f14610255578063f294cf3814610268578063f7c618c11461027057610136565b8063d03ffefb14610238578063e0c234231461024057610136565b80638c53c9bd146101e5578063a888c2cd146101fb578063b0a87ac11461021d578063b434151c1461022557610136565b8063579ca2c9116101095780637ceae310116100ee5780637ceae310146101b557806385c99e2b146101bd5780638b5b9ccc146101d057610136565b8063579ca2c9146101985780636c3a4cce146101a057610136565b8063151dfb061461013b578063310a1ee31461015057806348d6cb531461016e5780634c2412a214610183575b600080fd5b61014e610149366004611638565b610278565b005b610158610553565b6040516101659190611cae565b60405180910390f35b610176610559565b60405161016591906118f2565b61018b610562565b6040516101659190611cb7565b61014e610586565b6101a861074f565b60405161016591906117f9565b6101a861076b565b6101766101cb366004611638565b610787565b6101d86107bd565b6040516101659190611898565b6101ed61082c565b604051610165929190611872565b61020e610209366004611763565b61084e565b60405161016593929190611910565b6101a8610927565b61014e61023336600461166e565b610943565b6101ed610cc0565b610248610ce2565b60405161016591906118fd565b61014e610263366004611638565b610d70565b610248610fe1565b6101a8610fee565b3373ffffffffffffffffffffffffffffffffffffffff821614806102b3575060005473ffffffffffffffffffffffffffffffffffffffff1633145b6102f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60405180910390fd5b60006102fd8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1415610359576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e9906119df565b600d805461036990600190611d05565b815481106103a0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610400577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d805480610480577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b549181019190915261051690836110d2565b7fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb6071555541758242604051610547929190611872565b60405180910390a15050565b60045481565b600c5460ff1681565b60065474010000000000000000000000000000000000000000900463ffffffff1681565b6004544210156105c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a73565b600c5460ff16610634576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff9081168252600954602083015261060892166110d2565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319061068b9030906004016117f9565b60206040518083038186803b1580156106a357600080fd5b505afa1580156106b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106db919061177b565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff9182169116141561072257600d54600b5461071e9161071791611cc8565b829061110b565b9150505b60065460035461074c9173ffffffffffffffffffffffffffffffffffffffff918216911683611131565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60006107928261100a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d80548060200260200160405190810160405280929190818152602001828054801561082257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116107f7575b5050505050905090565b600a54600b5473ffffffffffffffffffffffffffffffffffffffff9091169082565b6007818154811061085e57600080fd5b906000526020600020906003020160009150905080600001805461088190611d48565b80601f01602080910402602001604051908101604052809291908181526020018280546108ad90611d48565b80156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60055473ffffffffffffffffffffffffffffffffffffffff163314610994576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611ae1565b83516109cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b86565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a0823190610a239030906004016117f9565b60206040518083038186803b158015610a3b57600080fd5b505afa158015610a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a73919061177b565b90508115610b095760085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610abc57600954600090610ab290839061110b565b9450610ac0915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b0957600d54600b54600091610b0491610afd9190611cc8565b859061110b565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b7f576000610b3b828561110b565b915050600860010154811015610b7d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611982565b505b8215610ba957600354610ba99073ffffffffffffffffffffffffffffffffffffffff168585611131565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880192610c279284920190611570565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b90610cb190879087908790611910565b60405180910390a15050505050565b60085460095473ffffffffffffffffffffffffffffffffffffffff9091169082565b60028054610cef90611d48565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1b90611d48565b8015610d685780601f10610d3d57610100808354040283529160200191610d68565b820191906000526020600020905b815481529060010190602001808311610d4b57829003601f168201915b505050505081565b3373ffffffffffffffffffffffffffffffffffffffff82161480610dab575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610de1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60065474010000000000000000000000000000000000000000900463ffffffff161580610e305750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b610e66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611aaa565b6004544210610ea1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e99061194b565b6000610eac8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610f07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bbd565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b546020820152610f3f9033306111d7565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790556040517f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a1906105479084904290611872565b60018054610cef90611d48565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b6000805b600d548110156110aa578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611069577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156110985790506107b8565b806110a281611d9c565b91505061100e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b60208201511561110757602082015182516111079173ffffffffffffffffffffffffffffffffffffffff909116908390611131565b5050565b600080838311156111215750600090508061112a565b50600190508183035b9250929050565b6111d28363a9059cbb60e01b8484604051602401611150929190611872565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526111eb565b505050565b6111e183836112a1565b6111d283826110d2565b600061124d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166113c09092919063ffffffff16565b8051909150156111d2578080602001905181019061126b9190611652565b6111d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bf4565b6020820151156111075781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e90611303908590309060040161181a565b60206040518083038186803b15801561131b57600080fd5b505afa15801561132f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611353919061177b565b90508260200151811015611393576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b18565b602083015183516111d29173ffffffffffffffffffffffffffffffffffffffff90911690849030906113d9565b60606113cf8484600085611400565b90505b9392505050565b6113fa846323b872dd60e01b85858560405160240161115093929190611841565b50505050565b60608247101561143c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a16565b61144585611501565b61147b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b4f565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114a491906117dd565b60006040518083038185875af1925050503d80600081146114e1576040519150601f19603f3d011682016040523d82523d6000602084013e6114e6565b606091505b50915091506114f682828661151d565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6060831561152c5750816113d2565b82511561153c5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e991906118fd565b82805461157c90611d48565b90600052602060002090601f01602090048101928261159e57600085556115e4565b82601f106115b757805160ff19168380011785556115e4565b828001600101855582156115e4579182015b828111156115e45782518255916020019190600101906115c9565b506115f09291506115f4565b5090565b5b808211156115f057600081556001016115f5565b803573ffffffffffffffffffffffffffffffffffffffff811681146107b857600080fd5b80356107b881611e33565b600060208284031215611649578081fd5b6113d282611609565b600060208284031215611663578081fd5b81516113d281611e33565b60008060008060808587031215611683578283fd5b843567ffffffffffffffff8082111561169a578485fd5b818701915087601f8301126116ad578485fd5b8135818111156116bf576116bf611e04565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561170557611705611e04565b816040528281528a602084870101111561171d578788fd5b826020860160208301378760208483010152809850505050505061174360208601611609565b9250604085013591506117586060860161162d565b905092959194509250565b600060208284031215611774578081fd5b5035919050565b60006020828403121561178c578081fd5b5051919050565b600081518084526117ab816020860160208601611d1c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516117ef818460208701611d1c565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156118e657835173ffffffffffffffffffffffffffffffffffffffff16835292840192918401916001016118b4565b50909695505050505050565b901515815260200190565b6000602082526113d26020830184611793565b6000606082526119236060830186611793565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b60208082526014908201527f4552524f523a2051756573742065787069726564000000000000000000000000604082015260600190565b60208082526027908201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460408201527f20626f756e747900000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f4552524f523a20706c61796572206e6f7420696e206c69737400000000000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526012908201527f4552524f523a204e6f7420657870697265640000000000000000000000000000604082015260600190565b6020808252601a908201527f4552524f523a204d617820706c61796572732072656163686564000000000000604082015260600190565b60208082526018908201527f4552524f523a2053656e646572206e6f7420676f7665726e0000000000000000604082015260600190565b6020808252601d908201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526012908201527f4552524f523a204e6f2065766964656e63650000000000000000000000000000604082015260600190565b6020808252601c908201527f4552524f523a20506c6179657220616c72656164792065786973747300000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560408201527f61746f7200000000000000000000000000000000000000000000000000000000606082015260800190565b90815260200190565b63ffffffff91909116815260200190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611d0057611d00611dd5565b500290565b600082821015611d1757611d17611dd5565b500390565b60005b83811015611d37578181015183820152602001611d1f565b838111156113fa5750506000910152565b600281046001821680611d5c57607f821691505b60208210811415611d96577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611dce57611dce611dd5565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b801515811461074c57600080fdfea2646970667358221220001ecc7e3a56a6e8ceba0a2f6f0020ef13bacde460faf1b1cca5699bfd12ab1764736f6c63430008010033a264697066735822122006ddcb5ccdb8532fd391ece411b1311d2d44d237eb8d1044c11f2c762c9eb08564736f6c63430008010033", - "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620000cf5760003560e01c8063b0a87ac11162000081578063e87fae211162000063578063e87fae21146200015e578063edeecdd31462000175578063f2fde38b146200018c57620000cf565b8063b0a87ac1146200014a578063d03ffefb146200015457620000cf565b80638c43b41111620000b75780638c43b41114620000f75780638c53c9bd146200010e5780638da5cb5b146200013157620000cf565b8062732e3014620000d4578063715018a614620000ed575b600080fd5b620000eb620000e536600462000c39565b620001a3565b005b620000eb620001f4565b620000eb6200010836600462000c7a565b6200020c565b62000118620002b1565b6040516200012892919062000f50565b60405180910390f35b6200013b620002d3565b60405162000128919062000e2d565b6200013b620002ef565b620001186200030b565b6200013b6200016f36600462000ca8565b6200032d565b620000eb6200018636600462000c7a565b620004be565b620000eb6200019d36600462000c39565b62000557565b620001ad620005c8565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b620001fe620005c8565b6200020a600062000642565b565b62000216620005c8565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020909101839052600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001690911790556005829055517f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb8990620002a590429085908590620011ec565b60405180910390a15050565b60045460055473ffffffffffffffffffffffffffffffffffffffff9091169082565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60025460035473ffffffffffffffffffffffffffffffffffffffff9091169082565b60015460408051808201825260025473ffffffffffffffffffffffffffffffffffffffff9081168252600354602080840191909152835180850185526004548316815260055491810191909152925160009485948c948c948c948c9491909116928b929133908c90620003a09062000b6e565b620003b59a9998979695949392919062000f8b565b604051809103906000f080158015620003d2573d6000803e3d6000fd5b506040805180820190915260025473ffffffffffffffffffffffffffffffffffffffff168152600354602082015290915062000410903383620006b7565b7f6b2fd076e791d7e0318fa62bf6e275ebe9ff601badea3d9bfdc43c02317d1119818989898989600260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260010154600460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460010154338e604051620004ab9c9b9a9998979695949392919062000ea6565b60405180910390a1979650505050505050565b620004c8620005c8565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020909101839052600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001690911790556003829055517f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f25092007990620002a590429085908590620011ec565b62000561620005c8565b73ffffffffffffffffffffffffffffffffffffffff8116620005ba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001032565b60405180910390fd5b620005c58162000642565b50565b620005d2620006d4565b73ffffffffffffffffffffffffffffffffffffffff16620005f2620002d3565b73ffffffffffffffffffffffffffffffffffffffff16146200020a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b190620010ec565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620006c38383620006d8565b620006cf838262000807565b505050565b3390565b602082015115620008035781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e906200073d908590309060040162000e4e565b60206040518083038186803b1580156200075657600080fd5b505afa1580156200076b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000791919062000d7b565b90508260200151811015620007d4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001121565b60208301518351620006cf9173ffffffffffffffffffffffffffffffffffffffff90911690849030906200083f565b5050565b602082015115620008035760208201518251620008039173ffffffffffffffffffffffffffffffffffffffff909116908390620008ec565b620008e6846323b872dd60e01b858585604051602401620008639392919062000e75565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526200090e565b50505050565b620006cf8363a9059cbb60e01b84846040516024016200086392919062000f50565b600062000972826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620009cc9092919063ffffffff16565b805190915015620006cf578080602001905181019062000993919062000c58565b620006cf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1906200118f565b6060620009dd8484600085620009e7565b90505b9392505050565b60608247101562000a26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1906200108f565b62000a318562000af6565b62000a6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001158565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405162000a95919062000e0f565b60006040518083038185875af1925050503d806000811462000ad4576040519150601f19603f3d011682016040523d82523d6000602084013e62000ad9565b606091505b509150915062000aeb82828662000b16565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff81163b15155b919050565b6060831562000b27575081620009e0565b82511562000b385782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1919062000f76565b6122d5806200129a83390190565b600067ffffffffffffffff8084111562000b9a5762000b9a62001247565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171562000be35762000be362001247565b8160405280935085815286868601111562000bfd57600080fd5b858560208301376000602087830101525050509392505050565b803562000b118162001276565b803563ffffffff8116811462000b1157600080fd5b60006020828403121562000c4b578081fd5b8135620009e08162001276565b60006020828403121562000c6a578081fd5b81518015158114620009e0578182fd5b6000806040838503121562000c8d578081fd5b823562000c9a8162001276565b946020939093013593505050565b60008060008060008060c0878903121562000cc1578182fd5b863567ffffffffffffffff8082111562000cd9578384fd5b818901915089601f83011262000ced578384fd5b62000cfe8a83356020850162000b7c565b9750602089013591508082111562000d14578384fd5b508701601f8101891362000d26578283fd5b62000d378982356020840162000b7c565b95505062000d486040880162000c17565b93506060870135925062000d5f6080880162000c17565b915062000d6f60a0880162000c24565b90509295509295509295565b60006020828403121562000d8d578081fd5b5051919050565b6000815180845262000dae81602086016020860162001218565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b805173ffffffffffffffffffffffffffffffffffffffff168252602090810151910152565b63ffffffff169052565b6000825162000e2381846020870162001218565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b600073ffffffffffffffffffffffffffffffffffffffff808f168352610180602084015262000eda61018084018f62000d94565b838103604085015262000eee818f62000d94565b925050808c1660608401528a6080840152808a1660a084015280891660c08401528760e0840152808716610100840152856101208401528085166101408401525062000f3f61016083018462000e05565b9d9c50505050505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b600060208252620009e0602083018462000d94565b600061018080835262000fa18184018e62000d94565b9050828103602084015262000fb7818d62000d94565b91505073ffffffffffffffffffffffffffffffffffffffff808b166040840152896060840152808916608084015280881660a084015262000ffc60c084018862000de0565b6200100c61010084018762000de0565b8085166101408401525063ffffffff83166101608301529b9a5050505050505050505050565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601d908201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b92835273ffffffffffffffffffffffffffffffffffffffff919091166020830152604082015260600190565b60005b83811015620012355781810151838201526020016200121b565b83811115620008e65750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620005c557600080fdfe60806040523480156200001157600080fd5b50604051620022d5380380620022d58339810160408190526200003491620002b7565b8951620000499060019060208d019062000118565b5088516200005f9060029060208c019062000118565b50600380546001600160a01b03199081166001600160a01b039a8b16179091556004979097556005805488169689169690961790955560068054600080548916938a16939093179092558351600880548916918a169190911790556020938401516009558251600a80548916918a169190911790559190920151600b55600c805460ff19169055931693169290921763ffffffff60a01b1916600160a01b63ffffffff90931692909202919091179055506200044e9050565b8280546200012690620003e2565b90600052602060002090601f0160209004810192826200014a576000855562000195565b82601f106200016557805160ff191683800117855562000195565b8280016001018555821562000195579182015b828111156200019557825182559160200191906001019062000178565b50620001a3929150620001a7565b5090565b5b80821115620001a35760008155600101620001a8565b8051620001cb8162000435565b919050565b600082601f830112620001e1578081fd5b81516001600160401b03811115620001fd57620001fd6200041f565b602062000213601f8301601f19168201620003af565b828152858284870101111562000227578384fd5b835b838110156200024657858101830151828201840152820162000229565b838111156200025757848385840101525b5095945050505050565b60006040828403121562000273578081fd5b6200027f6040620003af565b905081516200028e8162000435565b808252506020820151602082015292915050565b805163ffffffff81168114620001cb57600080fd5b6000806000806000806000806000806101808b8d031215620002d7578586fd5b8a516001600160401b0380821115620002ee578788fd5b620002fc8e838f01620001d0565b9b5060208d015191508082111562000312578788fd5b50620003218d828e01620001d0565b9950506200033260408c01620001be565b975060608b015196506200034960808c01620001be565b95506200035960a08c01620001be565b94506200036a8c60c08d0162000261565b93506200037c8c6101008d0162000261565b92506200038d6101408c01620001be565b91506200039e6101608c01620002a2565b90509295989b9194979a5092959850565b604051601f8201601f191681016001600160401b0381118282101715620003da57620003da6200041f565b604052919050565b600281046001821680620003f757607f821691505b602082108114156200041957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200044b57600080fd5b50565b611e77806200045e6000396000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80638c53c9bd116100b2578063d03ffefb11610081578063e492814f11610066578063e492814f14610255578063f294cf3814610268578063f7c618c11461027057610136565b8063d03ffefb14610238578063e0c234231461024057610136565b80638c53c9bd146101e5578063a888c2cd146101fb578063b0a87ac11461021d578063b434151c1461022557610136565b8063579ca2c9116101095780637ceae310116100ee5780637ceae310146101b557806385c99e2b146101bd5780638b5b9ccc146101d057610136565b8063579ca2c9146101985780636c3a4cce146101a057610136565b8063151dfb061461013b578063310a1ee31461015057806348d6cb531461016e5780634c2412a214610183575b600080fd5b61014e610149366004611638565b610278565b005b610158610553565b6040516101659190611cae565b60405180910390f35b610176610559565b60405161016591906118f2565b61018b610562565b6040516101659190611cb7565b61014e610586565b6101a861074f565b60405161016591906117f9565b6101a861076b565b6101766101cb366004611638565b610787565b6101d86107bd565b6040516101659190611898565b6101ed61082c565b604051610165929190611872565b61020e610209366004611763565b61084e565b60405161016593929190611910565b6101a8610927565b61014e61023336600461166e565b610943565b6101ed610cc0565b610248610ce2565b60405161016591906118fd565b61014e610263366004611638565b610d70565b610248610fe1565b6101a8610fee565b3373ffffffffffffffffffffffffffffffffffffffff821614806102b3575060005473ffffffffffffffffffffffffffffffffffffffff1633145b6102f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60405180910390fd5b60006102fd8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1415610359576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e9906119df565b600d805461036990600190611d05565b815481106103a0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610400577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d805480610480577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b549181019190915261051690836110d2565b7fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb6071555541758242604051610547929190611872565b60405180910390a15050565b60045481565b600c5460ff1681565b60065474010000000000000000000000000000000000000000900463ffffffff1681565b6004544210156105c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a73565b600c5460ff16610634576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff9081168252600954602083015261060892166110d2565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319061068b9030906004016117f9565b60206040518083038186803b1580156106a357600080fd5b505afa1580156106b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106db919061177b565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff9182169116141561072257600d54600b5461071e9161071791611cc8565b829061110b565b9150505b60065460035461074c9173ffffffffffffffffffffffffffffffffffffffff918216911683611131565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60006107928261100a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d80548060200260200160405190810160405280929190818152602001828054801561082257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116107f7575b5050505050905090565b600a54600b5473ffffffffffffffffffffffffffffffffffffffff9091169082565b6007818154811061085e57600080fd5b906000526020600020906003020160009150905080600001805461088190611d48565b80601f01602080910402602001604051908101604052809291908181526020018280546108ad90611d48565b80156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60055473ffffffffffffffffffffffffffffffffffffffff163314610994576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611ae1565b83516109cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b86565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a0823190610a239030906004016117f9565b60206040518083038186803b158015610a3b57600080fd5b505afa158015610a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a73919061177b565b90508115610b095760085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610abc57600954600090610ab290839061110b565b9450610ac0915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b0957600d54600b54600091610b0491610afd9190611cc8565b859061110b565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b7f576000610b3b828561110b565b915050600860010154811015610b7d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611982565b505b8215610ba957600354610ba99073ffffffffffffffffffffffffffffffffffffffff168585611131565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880192610c279284920190611570565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b90610cb190879087908790611910565b60405180910390a15050505050565b60085460095473ffffffffffffffffffffffffffffffffffffffff9091169082565b60028054610cef90611d48565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1b90611d48565b8015610d685780601f10610d3d57610100808354040283529160200191610d68565b820191906000526020600020905b815481529060010190602001808311610d4b57829003601f168201915b505050505081565b3373ffffffffffffffffffffffffffffffffffffffff82161480610dab575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610de1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60065474010000000000000000000000000000000000000000900463ffffffff161580610e305750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b610e66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611aaa565b6004544210610ea1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e99061194b565b6000610eac8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610f07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bbd565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b546020820152610f3f9033306111d7565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790556040517f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a1906105479084904290611872565b60018054610cef90611d48565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b6000805b600d548110156110aa578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611069577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156110985790506107b8565b806110a281611d9c565b91505061100e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b60208201511561110757602082015182516111079173ffffffffffffffffffffffffffffffffffffffff909116908390611131565b5050565b600080838311156111215750600090508061112a565b50600190508183035b9250929050565b6111d28363a9059cbb60e01b8484604051602401611150929190611872565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526111eb565b505050565b6111e183836112a1565b6111d283826110d2565b600061124d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166113c09092919063ffffffff16565b8051909150156111d2578080602001905181019061126b9190611652565b6111d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bf4565b6020820151156111075781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e90611303908590309060040161181a565b60206040518083038186803b15801561131b57600080fd5b505afa15801561132f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611353919061177b565b90508260200151811015611393576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b18565b602083015183516111d29173ffffffffffffffffffffffffffffffffffffffff90911690849030906113d9565b60606113cf8484600085611400565b90505b9392505050565b6113fa846323b872dd60e01b85858560405160240161115093929190611841565b50505050565b60608247101561143c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a16565b61144585611501565b61147b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b4f565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114a491906117dd565b60006040518083038185875af1925050503d80600081146114e1576040519150601f19603f3d011682016040523d82523d6000602084013e6114e6565b606091505b50915091506114f682828661151d565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6060831561152c5750816113d2565b82511561153c5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e991906118fd565b82805461157c90611d48565b90600052602060002090601f01602090048101928261159e57600085556115e4565b82601f106115b757805160ff19168380011785556115e4565b828001600101855582156115e4579182015b828111156115e45782518255916020019190600101906115c9565b506115f09291506115f4565b5090565b5b808211156115f057600081556001016115f5565b803573ffffffffffffffffffffffffffffffffffffffff811681146107b857600080fd5b80356107b881611e33565b600060208284031215611649578081fd5b6113d282611609565b600060208284031215611663578081fd5b81516113d281611e33565b60008060008060808587031215611683578283fd5b843567ffffffffffffffff8082111561169a578485fd5b818701915087601f8301126116ad578485fd5b8135818111156116bf576116bf611e04565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561170557611705611e04565b816040528281528a602084870101111561171d578788fd5b826020860160208301378760208483010152809850505050505061174360208601611609565b9250604085013591506117586060860161162d565b905092959194509250565b600060208284031215611774578081fd5b5035919050565b60006020828403121561178c578081fd5b5051919050565b600081518084526117ab816020860160208601611d1c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516117ef818460208701611d1c565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156118e657835173ffffffffffffffffffffffffffffffffffffffff16835292840192918401916001016118b4565b50909695505050505050565b901515815260200190565b6000602082526113d26020830184611793565b6000606082526119236060830186611793565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b60208082526014908201527f4552524f523a2051756573742065787069726564000000000000000000000000604082015260600190565b60208082526027908201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460408201527f20626f756e747900000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f4552524f523a20706c61796572206e6f7420696e206c69737400000000000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526012908201527f4552524f523a204e6f7420657870697265640000000000000000000000000000604082015260600190565b6020808252601a908201527f4552524f523a204d617820706c61796572732072656163686564000000000000604082015260600190565b60208082526018908201527f4552524f523a2053656e646572206e6f7420676f7665726e0000000000000000604082015260600190565b6020808252601d908201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526012908201527f4552524f523a204e6f2065766964656e63650000000000000000000000000000604082015260600190565b6020808252601c908201527f4552524f523a20506c6179657220616c72656164792065786973747300000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560408201527f61746f7200000000000000000000000000000000000000000000000000000000606082015260800190565b90815260200190565b63ffffffff91909116815260200190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611d0057611d00611dd5565b500290565b600082821015611d1757611d17611dd5565b500390565b60005b83811015611d37578181015183820152602001611d1f565b838111156113fa5750506000910152565b600281046001821680611d5c57607f821691505b60208210811415611d96577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611dce57611dce611dd5565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b801515811461074c57600080fdfea2646970667358221220001ecc7e3a56a6e8ceba0a2f6f0020ef13bacde460faf1b1cca5699bfd12ab1764736f6c63430008010033a264697066735822122006ddcb5ccdb8532fd391ece411b1311d2d44d237eb8d1044c11f2c762c9eb08564736f6c63430008010033", - "devdoc": { - "kind": "dev", - "methods": { - "owner()": { - "details": "Returns the address of the current owner." - }, - "renounceOwnership()": { - "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." - }, - "setAragonGovernAddress(address)": { - "details": "Be able to change it after deploy so we can deploy a new GovernQueue but keep the same QuestFactory", - "params": { - "_aragonGovernAddress": "The aragonGovernAddress." - } - }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 7, - "contract": "contracts/QuestFactory.sol:QuestFactory", - "label": "_owner", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 2333, - "contract": "contracts/QuestFactory.sol:QuestFactory", - "label": "aragonGovernAddress", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 2336, - "contract": "contracts/QuestFactory.sol:QuestFactory", - "label": "createDeposit", - "offset": 0, - "slot": "2", - "type": "t_struct(Deposit)2717_storage" - }, - { - "astId": 2339, - "contract": "contracts/QuestFactory.sol:QuestFactory", - "label": "playDeposit", - "offset": 0, - "slot": "4", - "type": "t_struct(Deposit)2717_storage" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_contract(IERC20)776": { - "encoding": "inplace", - "label": "contract IERC20", - "numberOfBytes": "20" - }, - "t_struct(Deposit)2717_storage": { - "encoding": "inplace", - "label": "struct Models.Deposit", - "members": [ - { - "astId": 2714, - "contract": "contracts/QuestFactory.sol:QuestFactory", - "label": "token", - "offset": 0, - "slot": "0", - "type": "t_contract(IERC20)776" - }, - { - "astId": 2716, - "contract": "contracts/QuestFactory.sol:QuestFactory", - "label": "amount", - "offset": 0, - "slot": "1", - "type": "t_uint256" - } - ], - "numberOfBytes": "64" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} \ No newline at end of file +{"address":"0x05301D6787430d26bb0D6430Bd98a59B955a27D0","abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CreateDepositChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PlayDepositChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"questAddress","type":"address"},{"indexed":false,"internalType":"string","name":"questTitle","type":"string"},{"indexed":false,"internalType":"bytes","name":"questDetailsRef","type":"bytes"},{"indexed":false,"internalType":"address","name":"rewardTokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"expireTime","type":"uint256"},{"indexed":false,"internalType":"address","name":"fundsRecoveryAddress","type":"address"},{"components":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct Models.Deposit","name":"createDeposit","type":"tuple"},{"components":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct Models.Deposit","name":"playDeposit","type":"tuple"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"uint32","name":"maxPlayers","type":"uint32"},{"indexed":false,"internalType":"bool","name":"isWhiteList","type":"bool"},{"indexed":false,"internalType":"uint256","name":"version","type":"uint256"}],"name":"QuestCreated","type":"event"},{"inputs":[],"name":"aragonGovernAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"createDeposit","outputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_questTitle","type":"string"},{"internalType":"bytes","name":"_questDetailsRef","type":"bytes"},{"internalType":"contract IERC20Upgradeable","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_expireTime","type":"uint256"},{"internalType":"address payable","name":"_fundsRecoveryAddress","type":"address"},{"internalType":"uint32","name":"_maxPlayers","type":"uint32"},{"internalType":"bool","name":"_isWhiteList","type":"bool"}],"name":"createQuest","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_aragonGovernAddress","type":"address"},{"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/0dc94a0b7ca05e4bd82bd71a09c8bbf3.json b/packages/hardhat/deployments/goerli/solcInputs/0dc94a0b7ca05e4bd82bd71a09c8bbf3.json new file mode 100644 index 00000000..044e2ecf --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/0dc94a0b7ca05e4bd82bd71a09c8bbf3.json @@ -0,0 +1,86 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "contracts/libraries/Deposit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\n// Solidity: Package Default Dependencies Directory = \"node_modules\"\r\n\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"./Models.sol\";\r\n\r\nlibrary DepositLib {\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n /*\r\n * Collect deposit from signer and send it to _to address.\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n * @param _to The address where the deposit should be transfered.\r\n */\r\n function collectFrom(\r\n Models.Deposit memory _collateral,\r\n address _from,\r\n address _to\r\n ) internal {\r\n collectFrom(_collateral, _from);\r\n releaseTo(_collateral, _to);\r\n }\r\n\r\n /*\r\n * Collect deposit from signer\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n */\r\n function collectFrom(Models.Deposit memory _collateral, address _from)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n // Verify allowance\r\n uint256 allowance = _collateral.token.allowance(\r\n _from,\r\n address(this)\r\n );\r\n require(\r\n allowance >= _collateral.amount,\r\n \"ERROR : Deposit bad allowance\"\r\n );\r\n\r\n _collateral.token.safeTransferFrom(\r\n _from,\r\n address(this),\r\n _collateral.amount\r\n );\r\n }\r\n }\r\n\r\n function releaseTo(Models.Deposit memory _collateral, address _to)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n _collateral.token.safeTransfer(_to, _collateral.amount);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/libraries/IExecutable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\ninterface IExecutable {\r\n function canExecute(address executer) external returns (bool);\r\n}\r\n" + }, + "contracts/libraries/Models.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nlibrary Models {\r\n struct Deposit {\r\n IERC20Upgradeable token;\r\n uint256 amount;\r\n }\r\n struct Claim {\r\n bytes evidence;\r\n address player;\r\n uint256 amount;\r\n }\r\n struct QuestParam {\r\n address questCreator;\r\n uint32 maxPlayers;\r\n IERC20Upgradeable rewardToken;\r\n uint256 expireTime;\r\n address aragonGovernAddress;\r\n address payable fundsRecoveryAddress;\r\n bool isWhiteList;\r\n }\r\n}\r\n" + }, + "contracts/mocks/TokenMock.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\r\n\r\n// Example class - a mock class using delivering from ERC20\r\ncontract TokenMock is ERC20 {\r\n constructor(string memory name, string memory symbol)\r\n payable\r\n ERC20(name, symbol)\r\n {}\r\n\r\n function mint(address owner, uint256 initialBalance) external {\r\n _mint(owner, initialBalance);\r\n }\r\n}\r\n" + }, + "contracts/Quest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./libraries/IExecutable.sol\";\r\n\r\ncontract Quest is IExecutable {\r\n using SafeMath for uint256;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n using DepositLib for Models.Deposit;\r\n\r\n // Quest payload\r\n address public questCreator;\r\n string public questTitle;\r\n bytes public questDetailsRef;\r\n IERC20Upgradeable public rewardToken;\r\n uint256 public expireTime;\r\n address public aragonGovernAddress;\r\n address payable public fundsRecoveryAddress;\r\n uint32 public maxPlayers; // 0 for unlimited players\r\n bool public isWhiteList;\r\n Models.Claim[] public claims;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n bool public isCreateDepositReleased;\r\n\r\n address[] private playerList;\r\n\r\n event QuestClaimed(bytes evidence, address player, uint256 amount);\r\n event QuestPlayed(address player, uint256 timestamp);\r\n event QuestUnplayed(address player, uint256 timestamp);\r\n event QuestWhiteListChanged(address[] whiteListPlayers, uint256 timestamp);\r\n modifier OnlyCreator() {\r\n require(\r\n msg.sender == questCreator,\r\n \"Only creator can call this function\"\r\n );\r\n _;\r\n }\r\n\r\n constructor(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n Models.Deposit memory _createDeposit,\r\n Models.Deposit memory _playDeposit,\r\n Models.QuestParam memory _questParam\r\n ) {\r\n require(\r\n !(_questParam.isWhiteList && _questParam.maxPlayers > 0),\r\n \"ERROR: Can't create a whiteListed quest with max players greater than 0 (infinity)\"\r\n );\r\n questTitle = _questTitle;\r\n questDetailsRef = _questDetailsRef;\r\n rewardToken = _questParam.rewardToken;\r\n expireTime = _questParam.expireTime;\r\n aragonGovernAddress = _questParam.aragonGovernAddress;\r\n fundsRecoveryAddress = _questParam.fundsRecoveryAddress;\r\n questCreator = _questParam.questCreator;\r\n createDeposit = _createDeposit;\r\n playDeposit = _playDeposit;\r\n\r\n isCreateDepositReleased = false;\r\n maxPlayers = _questParam.maxPlayers;\r\n isWhiteList = _questParam.isWhiteList;\r\n }\r\n\r\n /*\r\n * Claim a quest reward.\r\n *\r\n * @param _evidence Evidence of the claim.\r\n * @param _player Player address.\r\n * @param _amount Amount of the reward.\r\n *\r\n * requires sender to be aragonGovernAddress\r\n * requires evidence to not be empty\r\n * requires claim amount to not exceed available deposit when same token\r\n *\r\n * emit QuestClaimed\r\n */\r\n function claim(\r\n bytes memory _evidence,\r\n address _player,\r\n uint256 _amount,\r\n bool _claimAll\r\n ) external {\r\n require(msg.sender == aragonGovernAddress, \"ERROR: Sender not govern\");\r\n require(_evidence.length != 0, \"ERROR: No evidence\");\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n if (_claimAll) {\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(createDeposit.amount);\r\n _amount = result;\r\n } else {\r\n _amount = balance;\r\n }\r\n // Claim all but let play deposits of each player if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\r\n (, uint256 result) = _amount.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n _amount = result;\r\n }\r\n }\r\n\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(_amount);\r\n require(\r\n result >= createDeposit.amount,\r\n \"ERROR: Should not exceed allowed bounty\"\r\n );\r\n }\r\n\r\n if (_amount > 0) {\r\n rewardToken.safeTransfer(_player, _amount);\r\n }\r\n\r\n claims.push(Models.Claim(_evidence, _player, _amount));\r\n\r\n emit QuestClaimed(_evidence, _player, _amount);\r\n }\r\n\r\n /*\r\n * Release create deposit to creator and send unused funds to fundsRecoveryAddress.\r\n * requires quests to have expired\r\n *\r\n * requires quest to be expired\r\n */\r\n function recoverFundsAndDeposit() external {\r\n require(block.timestamp >= expireTime, \"ERROR: Not expired\");\r\n\r\n // Restore deposit if not already released\r\n if (!isCreateDepositReleased) {\r\n createDeposit.releaseTo(questCreator);\r\n isCreateDepositReleased = true;\r\n }\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\r\n (, balance) = balance.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n }\r\n\r\n rewardToken.safeTransfer(fundsRecoveryAddress, balance);\r\n }\r\n\r\n /**\r\n * Verify given executer can execute this quest.\r\n * @param executer The player to verify\r\n */\r\n function canExecute(\r\n address executer\r\n ) external view override returns (bool) {\r\n return findIndexOfPlayer(executer) != -1;\r\n }\r\n\r\n /**\r\n * Register a player to the quest. (sender could be the player or quest creator)\r\n *\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires sender to put a deposit (if its creator, deposit will be released to player)\r\n * requires player list is not full\r\n * requires quest is not expired\r\n * requires player is not already registered\r\n *\r\n * emit QuestPlayed with player and timestamp\r\n */\r\n function play(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: Can't self register and play a whitelisted Quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n require(\r\n maxPlayers == 0 || playerList.length < maxPlayers,\r\n \"ERROR: Max players reached\"\r\n );\r\n require(block.timestamp < expireTime, \"ERROR: Quest expired\");\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex == -1, \"ERROR: Player already exists\");\r\n\r\n playDeposit.collectFrom(msg.sender, address(this));\r\n\r\n playerList.push(_player);\r\n emit QuestPlayed(_player, block.timestamp);\r\n }\r\n\r\n function setWhiteList(address[] memory _players) external OnlyCreator {\r\n require(\r\n isWhiteList == true,\r\n \"ERROR: Can't set the white list to a non-whitelisted contract\"\r\n );\r\n playerList = _players;\r\n emit QuestWhiteListChanged(_players, block.timestamp);\r\n }\r\n\r\n /**\r\n * Unregister a player from the quest. (sender could be the player or quest creator)\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires player is registered\r\n *\r\n * emit QuestUnplayed with player and timestamp\r\n */\r\n function unplay(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: can't unplay a whitelisted quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex != -1, \"ERROR: player not in list\");\r\n\r\n // We put the last player in the place of the player to remove\r\n playerList[uint256(playerIndex)] = playerList[playerList.length - 1];\r\n // And then we can remove the last element to have the actual lenght updated\r\n playerList.pop();\r\n\r\n playDeposit.releaseTo(_player);\r\n emit QuestUnplayed(_player, block.timestamp);\r\n }\r\n\r\n /**\r\n Simply return the player list as the entire array\r\n */\r\n function getPlayers() external view returns (address[] memory) {\r\n return playerList;\r\n }\r\n\r\n // Private functions\r\n\r\n function findIndexOfPlayer(address _player) private view returns (int256) {\r\n for (uint256 i = 0; i < playerList.length; i++) {\r\n if (playerList[i] == _player) {\r\n return int256(i);\r\n }\r\n }\r\n return -1;\r\n }\r\n}\r\n" + }, + "contracts/QuestFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./Quest.sol\";\r\n\r\ncontract QuestFactory is OwnableUpgradeable {\r\n using DepositLib for Models.Deposit;\r\n\r\n address public aragonGovernAddress;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n uint256 public constant version = 3;\r\n\r\n event QuestCreated(\r\n address questAddress,\r\n string questTitle,\r\n bytes questDetailsRef,\r\n address rewardTokenAddress,\r\n uint256 expireTime,\r\n address fundsRecoveryAddress,\r\n Models.Deposit createDeposit,\r\n Models.Deposit playDeposit,\r\n address creator,\r\n uint32 maxPlayers,\r\n bool isWhiteList,\r\n uint256 version\r\n );\r\n\r\n event CreateDepositChanged(\r\n uint256 timestamp,\r\n address token,\r\n uint256 amount\r\n );\r\n\r\n event PlayDepositChanged(uint256 timestamp, address token, uint256 amount);\r\n\r\n /// @custom:oz-upgrades-unsafe-allow constructor\r\n constructor() {\r\n _disableInitializers();\r\n }\r\n\r\n function initialize(\r\n address _aragonGovernAddress,\r\n IERC20Upgradeable _createDepositToken,\r\n uint256 _createDepositAmount,\r\n IERC20Upgradeable _playDepositToken,\r\n uint256 _playDepositAmount,\r\n address _initialOwner\r\n ) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n setCreateDeposit(_createDepositToken, _createDepositAmount);\r\n setPlayDeposit(_playDepositToken, _playDepositAmount);\r\n if (_initialOwner != msg.sender) {\r\n transferOwnership(_initialOwner);\r\n }\r\n }\r\n\r\n /*\r\n * @dev Set the deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit CreateDepositChanged\r\n */\r\n function setCreateDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n createDeposit = Models.Deposit(token, amount);\r\n emit CreateDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * @dev Set the play deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit PlayDepositChanged\r\n */\r\n function setPlayDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n playDeposit = Models.Deposit(token, amount);\r\n emit PlayDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * Collect deposit, deploy a new Quest with given info contract\r\n * and transfer deposit to new Quest.\r\n * @param _title Quest title.\r\n * @param _details Quest details.\r\n * @param _rewardTokenAddress Reward token address.\r\n * @param _expireTime Expire time.\r\n * @param _fundsRecoveryAddress Funds recovery address.\r\n * requires deposit allowance\r\n * returns Quest address.\r\n * emits QuestCreated\r\n */\r\n function createQuest(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n IERC20Upgradeable _rewardToken,\r\n uint256 _expireTime,\r\n address payable _fundsRecoveryAddress,\r\n uint32 _maxPlayers,\r\n bool _isWhiteList\r\n ) external returns (address) {\r\n Quest quest = new Quest(\r\n _questTitle,\r\n _questDetailsRef,\r\n Models.Deposit(createDeposit.token, createDeposit.amount),\r\n Models.Deposit(playDeposit.token, playDeposit.amount),\r\n Models.QuestParam(\r\n msg.sender,\r\n _maxPlayers,\r\n _rewardToken,\r\n _expireTime,\r\n aragonGovernAddress,\r\n _fundsRecoveryAddress,\r\n _isWhiteList\r\n )\r\n );\r\n\r\n // Collect deposit from quest creator and send it to quest\r\n createDeposit.collectFrom(msg.sender, address(quest));\r\n\r\n emit QuestCreated(\r\n address(quest),\r\n _questTitle,\r\n _questDetailsRef,\r\n address(_rewardToken),\r\n _expireTime,\r\n _fundsRecoveryAddress,\r\n createDeposit,\r\n playDeposit,\r\n msg.sender,\r\n _maxPlayers,\r\n _isWhiteList,\r\n version\r\n );\r\n\r\n return address(quest);\r\n }\r\n\r\n /**\r\n * @dev Be able to change it after deploy so we can deploy\r\n * a new GovernQueue but keep the same QuestFactory\r\n * @param _aragonGovernAddress The aragonGovernAddress.\r\n */\r\n function setAragonGovernAddress(\r\n address _aragonGovernAddress\r\n ) external onlyOwner {\r\n aragonGovernAddress = _aragonGovernAddress;\r\n }\r\n}\r\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 20000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/hardhat/deployments/goerli/solcInputs/1dc3699f6562c8886e6e512d73662af0.json b/packages/hardhat/deployments/goerli/solcInputs/1dc3699f6562c8886e6e512d73662af0.json new file mode 100644 index 00000000..d6e0d6cc --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/1dc3699f6562c8886e6e512d73662af0.json @@ -0,0 +1,87 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "contracts/libraries/Deposit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\n// Solidity: Package Default Dependencies Directory = \"node_modules\"\r\n\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"./Models.sol\";\r\n\r\nlibrary DepositLib {\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n /*\r\n * Collect deposit from signer and send it to _to address.\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n * @param _to The address where the deposit should be transfered.\r\n */\r\n function collectFrom(\r\n Models.Deposit memory _collateral,\r\n address _from,\r\n address _to\r\n ) internal {\r\n collectFrom(_collateral, _from);\r\n releaseTo(_collateral, _to);\r\n }\r\n\r\n /*\r\n * Collect deposit from signer\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n */\r\n function collectFrom(Models.Deposit memory _collateral, address _from)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n // Verify allowance\r\n uint256 allowance = _collateral.token.allowance(\r\n _from,\r\n address(this)\r\n );\r\n require(\r\n allowance >= _collateral.amount,\r\n \"ERROR : Deposit bad allowance\"\r\n );\r\n\r\n _collateral.token.safeTransferFrom(\r\n _from,\r\n address(this),\r\n _collateral.amount\r\n );\r\n }\r\n }\r\n\r\n function releaseTo(Models.Deposit memory _collateral, address _to)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n _collateral.token.safeTransfer(_to, _collateral.amount);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/libraries/IExecutable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\ninterface IExecutable {\r\n function canExecute(address executer) external returns (bool);\r\n}\r\n" + }, + "contracts/libraries/Models.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nlibrary Models {\r\n struct Deposit {\r\n IERC20Upgradeable token;\r\n uint256 amount;\r\n }\r\n struct Claim {\r\n bytes evidence;\r\n address player;\r\n uint256 amount;\r\n }\r\n struct QuestParam {\r\n address questCreator;\r\n uint32 maxPlayers;\r\n IERC20Upgradeable rewardToken;\r\n uint256 expireTime;\r\n address aragonGovernAddress;\r\n address payable fundsRecoveryAddress;\r\n bool isWhiteList;\r\n }\r\n}\r\n" + }, + "contracts/mocks/TokenMock.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\r\n\r\n// Example class - a mock class using delivering from ERC20\r\ncontract TokenMock is ERC20 {\r\n constructor(string memory name, string memory symbol)\r\n payable\r\n ERC20(name, symbol)\r\n {}\r\n\r\n function mint(address owner, uint256 initialBalance) external {\r\n _mint(owner, initialBalance);\r\n }\r\n}\r\n" + }, + "contracts/Quest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./libraries/IExecutable.sol\";\r\n\r\ncontract Quest is IExecutable {\r\n using SafeMath for uint256;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n using DepositLib for Models.Deposit;\r\n\r\n // Quest payload\r\n address public questCreator;\r\n string public questTitle;\r\n bytes public questDetailsRef;\r\n IERC20Upgradeable public rewardToken;\r\n uint256 public expireTime;\r\n address public aragonGovernAddress;\r\n address payable public fundsRecoveryAddress;\r\n uint32 public maxPlayers; // 0 for unlimited players\r\n bool public isWhiteList;\r\n Models.Claim[] public claims;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n bool public isCreateDepositReleased;\r\n\r\n address[] private playerList;\r\n\r\n event QuestClaimed(bytes evidence, address player, uint256 amount);\r\n event QuestPlayed(address player, uint256 timestamp);\r\n event QuestUnplayed(address player, uint256 timestamp);\r\n event WhiteListChanged(address[] whiteListPlayers, uint256 timestamp);\r\n modifier OnlyCreator() {\r\n require(\r\n msg.sender == questCreator,\r\n \"Only creator can call this function\"\r\n );\r\n _;\r\n }\r\n\r\n constructor(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n Models.Deposit memory _createDeposit,\r\n Models.Deposit memory _playDeposit,\r\n Models.QuestParam memory _questParam\r\n ) {\r\n require(\r\n !(_questParam.isWhiteList && _questParam.maxPlayers > 0),\r\n \"ERROR: Can't create a whiteListed quest with max players greater than 0 (infinity)\"\r\n );\r\n questTitle = _questTitle;\r\n questDetailsRef = _questDetailsRef;\r\n rewardToken = _questParam.rewardToken;\r\n expireTime = _questParam.expireTime;\r\n aragonGovernAddress = _questParam.aragonGovernAddress;\r\n fundsRecoveryAddress = _questParam.fundsRecoveryAddress;\r\n questCreator = _questParam.questCreator;\r\n createDeposit = _createDeposit;\r\n playDeposit = _playDeposit;\r\n\r\n isCreateDepositReleased = false;\r\n maxPlayers = _questParam.maxPlayers;\r\n isWhiteList = _questParam.isWhiteList;\r\n }\r\n\r\n /*\r\n * Claim a quest reward.\r\n *\r\n * @param _evidence Evidence of the claim.\r\n * @param _player Player address.\r\n * @param _amount Amount of the reward.\r\n *\r\n * requires sender to be aragonGovernAddress\r\n * requires evidence to not be empty\r\n * requires claim amount to not exceed available deposit when same token\r\n *\r\n * emit QuestClaimed\r\n */\r\n function claim(\r\n bytes memory _evidence,\r\n address _player,\r\n uint256 _amount,\r\n bool _claimAll\r\n ) external {\r\n require(msg.sender == aragonGovernAddress, \"ERROR: Sender not govern\");\r\n require(_evidence.length != 0, \"ERROR: No evidence\");\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n if (_claimAll) {\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(createDeposit.amount);\r\n _amount = result;\r\n } else {\r\n _amount = balance;\r\n }\r\n // Claim all but let play deposits of each player if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\r\n (, uint256 result) = _amount.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n _amount = result;\r\n }\r\n }\r\n\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(_amount);\r\n require(\r\n result >= createDeposit.amount,\r\n \"ERROR: Should not exceed allowed bounty\"\r\n );\r\n }\r\n\r\n if (_amount > 0) {\r\n rewardToken.safeTransfer(_player, _amount);\r\n }\r\n\r\n claims.push(Models.Claim(_evidence, _player, _amount));\r\n\r\n emit QuestClaimed(_evidence, _player, _amount);\r\n }\r\n\r\n /*\r\n * Release create deposit to creator and send unused funds to fundsRecoveryAddress.\r\n * requires quests to have expired\r\n *\r\n * requires quest to be expired\r\n */\r\n function recoverFundsAndDeposit() external {\r\n require(block.timestamp >= expireTime, \"ERROR: Not expired\");\r\n\r\n // Restore deposit if not already released\r\n if (!isCreateDepositReleased) {\r\n createDeposit.releaseTo(questCreator);\r\n isCreateDepositReleased = true;\r\n }\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\r\n (, balance) = balance.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n }\r\n\r\n rewardToken.safeTransfer(fundsRecoveryAddress, balance);\r\n }\r\n\r\n /**\r\n * Verify given executer can execute this quest.\r\n * @param executer The player to verify\r\n */\r\n function canExecute(\r\n address executer\r\n ) external view override returns (bool) {\r\n return findIndexOfPlayer(executer) != -1;\r\n }\r\n\r\n /**\r\n * Register a player to the quest. (sender could be the player or quest creator)\r\n *\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires sender to put a deposit (if its creator, deposit will be released to player)\r\n * requires player list is not full\r\n * requires quest is not expired\r\n * requires player is not already registered\r\n *\r\n * emit QuestPlayed with player and timestamp\r\n */\r\n function play(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: Can't self register and play a whitelisted Quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n require(\r\n maxPlayers == 0 || playerList.length < maxPlayers,\r\n \"ERROR: Max players reached\"\r\n );\r\n require(block.timestamp < expireTime, \"ERROR: Quest expired\");\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex == -1, \"ERROR: Player already exists\");\r\n\r\n playDeposit.collectFrom(msg.sender, address(this));\r\n\r\n playerList.push(_player);\r\n emit QuestPlayed(_player, block.timestamp);\r\n }\r\n\r\n function setWhiteList(address[] memory _players) external OnlyCreator {\r\n require(\r\n isWhiteList == true,\r\n \"ERROR: Can't set the white list to a non-whitelisted contract\"\r\n );\r\n playerList = _players;\r\n emit WhiteListChanged(_players, block.timestamp);\r\n }\r\n\r\n /**\r\n * Unregister a player from the quest. (sender could be the player or quest creator)\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires player is registered\r\n *\r\n * emit QuestUnplayed with player and timestamp\r\n */\r\n function unplay(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: can't unplay a whitelisted quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex != -1, \"ERROR: player not in list\");\r\n\r\n // We put the last player in the place of the player to remove\r\n playerList[uint256(playerIndex)] = playerList[playerList.length - 1];\r\n // And then we can remove the last element to have the actual lenght updated\r\n playerList.pop();\r\n\r\n playDeposit.releaseTo(_player);\r\n emit QuestUnplayed(_player, block.timestamp);\r\n }\r\n\r\n /**\r\n Simply return the player list as the entire array\r\n */\r\n function getPlayers() external view returns (address[] memory) {\r\n return playerList;\r\n }\r\n\r\n // Private functions\r\n\r\n function findIndexOfPlayer(address _player) private view returns (int256) {\r\n for (uint256 i = 0; i < playerList.length; i++) {\r\n if (playerList[i] == _player) {\r\n return int256(i);\r\n }\r\n }\r\n return -1;\r\n }\r\n}\r\n" + }, + "contracts/QuestFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./Quest.sol\";\r\n\r\ncontract QuestFactory is OwnableUpgradeable {\r\n using DepositLib for Models.Deposit;\r\n\r\n address public aragonGovernAddress;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n uint256 public constant version = 3;\r\n\r\n event QuestCreated(\r\n address questAddress,\r\n string questTitle,\r\n bytes questDetailsRef,\r\n address rewardTokenAddress,\r\n uint256 expireTime,\r\n address fundsRecoveryAddress,\r\n address createDepositToken,\r\n uint256 createDepositAmount,\r\n address playDepositToken,\r\n uint256 playDepositAmount,\r\n address creator,\r\n uint32 maxPlayers,\r\n bool isWhiteList\r\n );\r\n\r\n event CreateDepositChanged(\r\n uint256 timestamp,\r\n address token,\r\n uint256 amount\r\n );\r\n\r\n event PlayDepositChanged(uint256 timestamp, address token, uint256 amount);\r\n\r\n /// @custom:oz-upgrades-unsafe-allow constructor\r\n constructor() {\r\n _disableInitializers();\r\n }\r\n\r\n function initialize(\r\n address _aragonGovernAddress,\r\n IERC20Upgradeable _createDepositToken,\r\n uint256 _createDepositAmount,\r\n IERC20Upgradeable _playDepositToken,\r\n uint256 _playDepositAmount,\r\n address _initialOwner\r\n ) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n setCreateDeposit(_createDepositToken, _createDepositAmount);\r\n setPlayDeposit(_playDepositToken, _playDepositAmount);\r\n if (_initialOwner != msg.sender) {\r\n transferOwnership(_initialOwner);\r\n }\r\n }\r\n\r\n /*\r\n * @dev Set the deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit CreateDepositChanged\r\n */\r\n function setCreateDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n createDeposit = Models.Deposit(token, amount);\r\n emit CreateDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * @dev Set the play deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit PlayDepositChanged\r\n */\r\n function setPlayDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n playDeposit = Models.Deposit(token, amount);\r\n emit PlayDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * Collect deposit, deploy a new Quest with given info contract\r\n * and transfer deposit to new Quest.\r\n * @param _title Quest title.\r\n * @param _details Quest details.\r\n * @param _rewardTokenAddress Reward token address.\r\n * @param _expireTime Expire time.\r\n * @param _fundsRecoveryAddress Funds recovery address.\r\n * requires deposit allowance\r\n * returns Quest address.\r\n * emits QuestCreated\r\n */\r\n function createQuest(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n IERC20Upgradeable _rewardToken,\r\n uint256 _expireTime,\r\n address payable _fundsRecoveryAddress,\r\n uint32 _maxPlayers,\r\n bool _isWhiteList\r\n ) external returns (address) {\r\n Quest quest = new Quest(\r\n _questTitle,\r\n _questDetailsRef,\r\n Models.Deposit(createDeposit.token, createDeposit.amount),\r\n Models.Deposit(playDeposit.token, playDeposit.amount),\r\n Models.QuestParam(\r\n msg.sender,\r\n _maxPlayers,\r\n _rewardToken,\r\n _expireTime,\r\n aragonGovernAddress,\r\n _fundsRecoveryAddress,\r\n _isWhiteList\r\n )\r\n );\r\n\r\n // Collect deposit from quest creator and send it to quest\r\n createDeposit.collectFrom(msg.sender, address(quest));\r\n\r\n emit QuestCreated(\r\n address(quest),\r\n _questTitle,\r\n _questDetailsRef,\r\n address(_rewardToken),\r\n _expireTime,\r\n _fundsRecoveryAddress,\r\n address(createDeposit.token),\r\n createDeposit.amount,\r\n address(playDeposit.token),\r\n playDeposit.amount,\r\n msg.sender,\r\n _maxPlayers,\r\n _isWhiteList\r\n );\r\n\r\n return address(quest);\r\n }\r\n\r\n /**\r\n * @dev Be able to change it after deploy so we can deploy\r\n * a new GovernQueue but keep the same QuestFactory\r\n * @param _aragonGovernAddress The aragonGovernAddress.\r\n */\r\n function setAragonGovernAddress(\r\n address _aragonGovernAddress\r\n ) external onlyOwner {\r\n aragonGovernAddress = _aragonGovernAddress;\r\n }\r\n}\r\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 20000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + }, + "libraries": {} + } +} \ No newline at end of file diff --git a/packages/hardhat/deployments/goerli/solcInputs/47f6185dc196e2ecbc4b6b98f3c85d8d.json b/packages/hardhat/deployments/goerli/solcInputs/47f6185dc196e2ecbc4b6b98f3c85d8d.json new file mode 100644 index 00000000..687e3e08 --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/47f6185dc196e2ecbc4b6b98f3c85d8d.json @@ -0,0 +1,87 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "contracts/libraries/Deposit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\n// Solidity: Package Default Dependencies Directory = \"node_modules\"\r\n\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"./Models.sol\";\r\n\r\nlibrary DepositLib {\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n /*\r\n * Collect deposit from signer and send it to _to address.\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n * @param _to The address where the deposit should be transfered.\r\n */\r\n function collectFrom(\r\n Models.Deposit memory _collateral,\r\n address _from,\r\n address _to\r\n ) internal {\r\n collectFrom(_collateral, _from);\r\n releaseTo(_collateral, _to);\r\n }\r\n\r\n /*\r\n * Collect deposit from signer\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n */\r\n function collectFrom(Models.Deposit memory _collateral, address _from)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n // Verify allowance\r\n uint256 allowance = _collateral.token.allowance(\r\n _from,\r\n address(this)\r\n );\r\n require(\r\n allowance >= _collateral.amount,\r\n \"ERROR : Deposit bad allowance\"\r\n );\r\n\r\n _collateral.token.safeTransferFrom(\r\n _from,\r\n address(this),\r\n _collateral.amount\r\n );\r\n }\r\n }\r\n\r\n function releaseTo(Models.Deposit memory _collateral, address _to)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n _collateral.token.safeTransfer(_to, _collateral.amount);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/libraries/IExecutable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\ninterface IExecutable {\r\n function canExecute(address executer) external returns (bool);\r\n}\r\n" + }, + "contracts/libraries/Models.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nlibrary Models {\r\n struct Deposit {\r\n IERC20Upgradeable token;\r\n uint256 amount;\r\n }\r\n struct Claim {\r\n bytes evidence;\r\n address player;\r\n uint256 amount;\r\n }\r\n struct QuestParam {\r\n address questCreator;\r\n uint32 maxPlayers;\r\n IERC20Upgradeable rewardToken;\r\n uint256 expireTime;\r\n address aragonGovernAddress;\r\n address payable fundsRecoveryAddress;\r\n bool isWhiteList;\r\n }\r\n}\r\n" + }, + "contracts/mocks/TokenMock.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\r\n\r\n// Example class - a mock class using delivering from ERC20\r\ncontract TokenMock is ERC20 {\r\n constructor(string memory name, string memory symbol)\r\n payable\r\n ERC20(name, symbol)\r\n {}\r\n\r\n function mint(address owner, uint256 initialBalance) external {\r\n _mint(owner, initialBalance);\r\n }\r\n}\r\n" + }, + "contracts/Quest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./libraries/IExecutable.sol\";\r\n\r\ncontract Quest is IExecutable {\r\n using SafeMath for uint256;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n using DepositLib for Models.Deposit;\r\n\r\n // Quest payload\r\n address public questCreator;\r\n string public questTitle;\r\n bytes public questDetailsRef;\r\n IERC20Upgradeable public rewardToken;\r\n uint256 public expireTime;\r\n address public aragonGovernAddress;\r\n address payable public fundsRecoveryAddress;\r\n uint32 public maxPlayers; // 0 for unlimited players\r\n bool public isWhiteList;\r\n Models.Claim[] public claims;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n bool public isCreateDepositReleased;\r\n\r\n address[] private playerList;\r\n\r\n event QuestClaimed(bytes evidence, address player, uint256 amount);\r\n event QuestPlayed(address player, uint256 timestamp);\r\n event QuestUnplayed(address player, uint256 timestamp);\r\n event QuestWhiteListChanged(address[] whiteListPlayers, uint256 timestamp);\r\n modifier OnlyCreator() {\r\n require(\r\n msg.sender == questCreator,\r\n \"Only creator can call this function\"\r\n );\r\n _;\r\n }\r\n\r\n constructor(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n Models.Deposit memory _createDeposit,\r\n Models.Deposit memory _playDeposit,\r\n Models.QuestParam memory _questParam\r\n ) {\r\n require(\r\n !(_questParam.isWhiteList && _questParam.maxPlayers > 0),\r\n \"ERROR: Can't create a whiteListed quest with max players greater than 0 (infinity)\"\r\n );\r\n questTitle = _questTitle;\r\n questDetailsRef = _questDetailsRef;\r\n rewardToken = _questParam.rewardToken;\r\n expireTime = _questParam.expireTime;\r\n aragonGovernAddress = _questParam.aragonGovernAddress;\r\n fundsRecoveryAddress = _questParam.fundsRecoveryAddress;\r\n questCreator = _questParam.questCreator;\r\n createDeposit = _createDeposit;\r\n playDeposit = _playDeposit;\r\n\r\n isCreateDepositReleased = false;\r\n maxPlayers = _questParam.maxPlayers;\r\n isWhiteList = _questParam.isWhiteList;\r\n }\r\n\r\n /*\r\n * Claim a quest reward.\r\n *\r\n * @param _evidence Evidence of the claim.\r\n * @param _player Player address.\r\n * @param _amount Amount of the reward.\r\n *\r\n * requires sender to be aragonGovernAddress\r\n * requires evidence to not be empty\r\n * requires claim amount to not exceed available deposit when same token\r\n *\r\n * emit QuestClaimed\r\n */\r\n function claim(\r\n bytes memory _evidence,\r\n address _player,\r\n uint256 _amount,\r\n bool _claimAll\r\n ) external {\r\n require(msg.sender == aragonGovernAddress, \"ERROR: Sender not govern\");\r\n require(_evidence.length != 0, \"ERROR: No evidence\");\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n if (_claimAll) {\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(createDeposit.amount);\r\n _amount = result;\r\n } else {\r\n _amount = balance;\r\n }\r\n // Claim all but let play deposits of each player if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\r\n (, uint256 result) = _amount.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n _amount = result;\r\n }\r\n }\r\n\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(_amount);\r\n require(\r\n result >= createDeposit.amount,\r\n \"ERROR: Should not exceed allowed bounty\"\r\n );\r\n }\r\n\r\n if (_amount > 0) {\r\n rewardToken.safeTransfer(_player, _amount);\r\n }\r\n\r\n claims.push(Models.Claim(_evidence, _player, _amount));\r\n\r\n emit QuestClaimed(_evidence, _player, _amount);\r\n }\r\n\r\n /*\r\n * Release create deposit to creator and send unused funds to fundsRecoveryAddress.\r\n * requires quests to have expired\r\n *\r\n * requires quest to be expired\r\n */\r\n function recoverFundsAndDeposit() external {\r\n require(block.timestamp >= expireTime, \"ERROR: Not expired\");\r\n\r\n // Restore deposit if not already released\r\n if (!isCreateDepositReleased) {\r\n createDeposit.releaseTo(questCreator);\r\n isCreateDepositReleased = true;\r\n }\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\r\n (, balance) = balance.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n }\r\n\r\n rewardToken.safeTransfer(fundsRecoveryAddress, balance);\r\n }\r\n\r\n /**\r\n * Verify given executer can execute this quest.\r\n * @param executer The player to verify\r\n */\r\n function canExecute(\r\n address executer\r\n ) external view override returns (bool) {\r\n return findIndexOfPlayer(executer) != -1;\r\n }\r\n\r\n /**\r\n * Register a player to the quest. (sender could be the player or quest creator)\r\n *\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires sender to put a deposit (if its creator, deposit will be released to player)\r\n * requires player list is not full\r\n * requires quest is not expired\r\n * requires player is not already registered\r\n *\r\n * emit QuestPlayed with player and timestamp\r\n */\r\n function play(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: Can't self register and play a whitelisted Quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n require(\r\n maxPlayers == 0 || playerList.length < maxPlayers,\r\n \"ERROR: Max players reached\"\r\n );\r\n require(block.timestamp < expireTime, \"ERROR: Quest expired\");\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex == -1, \"ERROR: Player already exists\");\r\n\r\n playDeposit.collectFrom(msg.sender, address(this));\r\n\r\n playerList.push(_player);\r\n emit QuestPlayed(_player, block.timestamp);\r\n }\r\n\r\n function setWhiteList(address[] memory _players) external OnlyCreator {\r\n require(\r\n isWhiteList == true,\r\n \"ERROR: Can't set the white list to a non-whitelisted contract\"\r\n );\r\n playerList = _players;\r\n emit QuestWhiteListChanged(_players, block.timestamp);\r\n }\r\n\r\n /**\r\n * Unregister a player from the quest. (sender could be the player or quest creator)\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires player is registered\r\n *\r\n * emit QuestUnplayed with player and timestamp\r\n */\r\n function unplay(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: can't unplay a whitelisted quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex != -1, \"ERROR: player not in list\");\r\n\r\n // We put the last player in the place of the player to remove\r\n playerList[uint256(playerIndex)] = playerList[playerList.length - 1];\r\n // And then we can remove the last element to have the actual lenght updated\r\n playerList.pop();\r\n\r\n playDeposit.releaseTo(_player);\r\n emit QuestUnplayed(_player, block.timestamp);\r\n }\r\n\r\n /**\r\n Simply return the player list as the entire array\r\n */\r\n function getPlayers() external view returns (address[] memory) {\r\n return playerList;\r\n }\r\n\r\n // Private functions\r\n\r\n function findIndexOfPlayer(address _player) private view returns (int256) {\r\n for (uint256 i = 0; i < playerList.length; i++) {\r\n if (playerList[i] == _player) {\r\n return int256(i);\r\n }\r\n }\r\n return -1;\r\n }\r\n}\r\n" + }, + "contracts/QuestFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./Quest.sol\";\r\n\r\ncontract QuestFactory is OwnableUpgradeable {\r\n using DepositLib for Models.Deposit;\r\n\r\n address public aragonGovernAddress;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n uint256 public constant version = 3;\r\n\r\n event QuestCreated(\r\n address questAddress,\r\n string questTitle,\r\n bytes questDetailsRef,\r\n address rewardTokenAddress,\r\n uint256 expireTime,\r\n address fundsRecoveryAddress,\r\n Models.Deposit createDeposit,\r\n Models.Deposit playDeposit,\r\n address creator,\r\n uint32 maxPlayers,\r\n bool isWhiteList,\r\n uint256 version\r\n );\r\n\r\n event CreateDepositChanged(\r\n uint256 timestamp,\r\n address token,\r\n uint256 amount\r\n );\r\n\r\n event PlayDepositChanged(uint256 timestamp, address token, uint256 amount);\r\n\r\n /// @custom:oz-upgrades-unsafe-allow constructor\r\n constructor() {\r\n _disableInitializers();\r\n }\r\n\r\n function initialize(\r\n address _aragonGovernAddress,\r\n IERC20Upgradeable _createDepositToken,\r\n uint256 _createDepositAmount,\r\n IERC20Upgradeable _playDepositToken,\r\n uint256 _playDepositAmount,\r\n address _initialOwner\r\n ) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n setCreateDeposit(_createDepositToken, _createDepositAmount);\r\n setPlayDeposit(_playDepositToken, _playDepositAmount);\r\n if (_initialOwner != msg.sender) {\r\n transferOwnership(_initialOwner);\r\n }\r\n }\r\n\r\n /*\r\n * @dev Set the deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit CreateDepositChanged\r\n */\r\n function setCreateDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n createDeposit = Models.Deposit(token, amount);\r\n emit CreateDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * @dev Set the play deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit PlayDepositChanged\r\n */\r\n function setPlayDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n playDeposit = Models.Deposit(token, amount);\r\n emit PlayDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * Collect deposit, deploy a new Quest with given info contract\r\n * and transfer deposit to new Quest.\r\n * @param _title Quest title.\r\n * @param _details Quest details.\r\n * @param _rewardTokenAddress Reward token address.\r\n * @param _expireTime Expire time.\r\n * @param _fundsRecoveryAddress Funds recovery address.\r\n * requires deposit allowance\r\n * returns Quest address.\r\n * emits QuestCreated\r\n */\r\n function createQuest(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n IERC20Upgradeable _rewardToken,\r\n uint256 _expireTime,\r\n address payable _fundsRecoveryAddress,\r\n uint32 _maxPlayers,\r\n bool _isWhiteList\r\n ) external returns (address) {\r\n Quest quest = new Quest(\r\n _questTitle,\r\n _questDetailsRef,\r\n Models.Deposit(createDeposit.token, createDeposit.amount),\r\n Models.Deposit(playDeposit.token, playDeposit.amount),\r\n Models.QuestParam(\r\n msg.sender,\r\n _maxPlayers,\r\n _rewardToken,\r\n _expireTime,\r\n aragonGovernAddress,\r\n _fundsRecoveryAddress,\r\n _isWhiteList\r\n )\r\n );\r\n\r\n // Collect deposit from quest creator and send it to quest\r\n createDeposit.collectFrom(msg.sender, address(quest));\r\n\r\n emit QuestCreated(\r\n address(quest),\r\n _questTitle,\r\n _questDetailsRef,\r\n address(_rewardToken),\r\n _expireTime,\r\n _fundsRecoveryAddress,\r\n createDeposit,\r\n playDeposit,\r\n msg.sender,\r\n _maxPlayers,\r\n _isWhiteList,\r\n version\r\n );\r\n\r\n return address(quest);\r\n }\r\n\r\n /**\r\n * @dev Be able to change it after deploy so we can deploy\r\n * a new GovernQueue but keep the same QuestFactory\r\n * @param _aragonGovernAddress The aragonGovernAddress.\r\n */\r\n function setAragonGovernAddress(\r\n address _aragonGovernAddress\r\n ) external onlyOwner {\r\n aragonGovernAddress = _aragonGovernAddress;\r\n }\r\n}\r\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 20000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + }, + "libraries": {} + } +} \ No newline at end of file diff --git a/packages/hardhat/deployments/goerli/solcInputs/553ddf21e8dca1c13693c37d1e3133ad.json b/packages/hardhat/deployments/goerli/solcInputs/553ddf21e8dca1c13693c37d1e3133ad.json new file mode 100644 index 00000000..96a40701 --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/553ddf21e8dca1c13693c37d1e3133ad.json @@ -0,0 +1,71 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "contracts/libraries/Deposit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\n// Solidity: Package Default Dependencies Directory = \"node_modules\"\r\n\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"./Models.sol\";\r\n\r\nlibrary DepositLib {\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n /*\r\n * Collect deposit from signer and send it to _to address.\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n * @param _to The address where the deposit should be transfered.\r\n */\r\n function collectFrom(\r\n Models.Deposit memory _collateral,\r\n address _from,\r\n address _to\r\n ) internal {\r\n collectFrom(_collateral, _from);\r\n releaseTo(_collateral, _to);\r\n }\r\n\r\n /*\r\n * Collect deposit from signer\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n */\r\n function collectFrom(Models.Deposit memory _collateral, address _from)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n // Verify allowance\r\n uint256 allowance = _collateral.token.allowance(\r\n _from,\r\n address(this)\r\n );\r\n require(\r\n allowance >= _collateral.amount,\r\n \"ERROR : Deposit bad allowance\"\r\n );\r\n\r\n _collateral.token.safeTransferFrom(\r\n _from,\r\n address(this),\r\n _collateral.amount\r\n );\r\n }\r\n }\r\n\r\n function releaseTo(Models.Deposit memory _collateral, address _to)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n _collateral.token.safeTransfer(_to, _collateral.amount);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/libraries/IExecutable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\ninterface IExecutable {\r\n function canExecute(address executer) external returns (bool);\r\n}\r\n" + }, + "contracts/libraries/Models.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nlibrary Models {\r\n struct Deposit {\r\n IERC20Upgradeable token;\r\n uint256 amount;\r\n }\r\n struct Claim {\r\n bytes evidence;\r\n address player;\r\n uint256 amount;\r\n }\r\n struct QuestParam {\r\n address questCreator;\r\n uint32 maxPlayers;\r\n IERC20Upgradeable rewardToken;\r\n uint256 expireTime;\r\n address aragonGovernAddress;\r\n address payable fundsRecoveryAddress;\r\n bool isWhiteList;\r\n }\r\n}\r\n" + }, + "contracts/Quest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./libraries/IExecutable.sol\";\r\n\r\ncontract Quest is IExecutable {\r\n using SafeMath for uint256;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n using DepositLib for Models.Deposit;\r\n\r\n // Quest payload\r\n address public questCreator;\r\n string public questTitle;\r\n bytes public questDetailsRef;\r\n IERC20Upgradeable public rewardToken;\r\n uint256 public expireTime;\r\n address public aragonGovernAddress;\r\n address payable public fundsRecoveryAddress;\r\n uint32 public maxPlayers; // 0 for unlimited players\r\n bool public isWhiteList;\r\n Models.Claim[] public claims;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n bool public isCreateDepositReleased;\r\n\r\n address[] private playerList;\r\n\r\n event QuestClaimed(bytes evidence, address player, uint256 amount);\r\n event QuestPlayed(address player, uint256 timestamp);\r\n event QuestUnplayed(address player, uint256 timestamp);\r\n event WhiteListChanged(address[] whiteListPlayers, uint256 timestamp);\r\n modifier OnlyCreator() {\r\n require(\r\n msg.sender == questCreator,\r\n \"Only creator can call this function\"\r\n );\r\n _;\r\n }\r\n\r\n constructor(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n Models.Deposit memory _createDeposit,\r\n Models.Deposit memory _playDeposit,\r\n Models.QuestParam memory _questParam\r\n ) {\r\n require(\r\n !(_questParam.isWhiteList && _questParam.maxPlayers > 0),\r\n \"ERROR: Can't create a whiteListed quest with max players greater than 0 (infinity)\"\r\n );\r\n questTitle = _questTitle;\r\n questDetailsRef = _questDetailsRef;\r\n rewardToken = _questParam.rewardToken;\r\n expireTime = _questParam.expireTime;\r\n aragonGovernAddress = _questParam.aragonGovernAddress;\r\n fundsRecoveryAddress = _questParam.fundsRecoveryAddress;\r\n questCreator = _questParam.questCreator;\r\n createDeposit = _createDeposit;\r\n playDeposit = _playDeposit;\r\n\r\n isCreateDepositReleased = false;\r\n maxPlayers = _questParam.maxPlayers;\r\n isWhiteList = _questParam.isWhiteList;\r\n }\r\n\r\n /*\r\n * Claim a quest reward.\r\n *\r\n * @param _evidence Evidence of the claim.\r\n * @param _player Player address.\r\n * @param _amount Amount of the reward.\r\n *\r\n * requires sender to be aragonGovernAddress\r\n * requires evidence to not be empty\r\n * requires claim amount to not exceed available deposit when same token\r\n *\r\n * emit QuestClaimed\r\n */\r\n function claim(\r\n bytes memory _evidence,\r\n address _player,\r\n uint256 _amount,\r\n bool _claimAll\r\n ) external {\r\n require(msg.sender == aragonGovernAddress, \"ERROR: Sender not govern\");\r\n require(_evidence.length != 0, \"ERROR: No evidence\");\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n if (_claimAll) {\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(createDeposit.amount);\r\n _amount = result;\r\n } else {\r\n _amount = balance;\r\n }\r\n // Claim all but let play deposits of each player if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\r\n (, uint256 result) = _amount.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n _amount = result;\r\n }\r\n }\r\n\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(_amount);\r\n require(\r\n result >= createDeposit.amount,\r\n \"ERROR: Should not exceed allowed bounty\"\r\n );\r\n }\r\n\r\n if (_amount > 0) {\r\n rewardToken.safeTransfer(_player, _amount);\r\n }\r\n\r\n claims.push(Models.Claim(_evidence, _player, _amount));\r\n\r\n emit QuestClaimed(_evidence, _player, _amount);\r\n }\r\n\r\n /*\r\n * Release create deposit to creator and send unused funds to fundsRecoveryAddress.\r\n * requires quests to have expired\r\n *\r\n * requires quest to be expired\r\n */\r\n function recoverFundsAndDeposit() external {\r\n require(block.timestamp >= expireTime, \"ERROR: Not expired\");\r\n\r\n // Restore deposit if not already released\r\n if (!isCreateDepositReleased) {\r\n createDeposit.releaseTo(questCreator);\r\n isCreateDepositReleased = true;\r\n }\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\r\n (, balance) = balance.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n }\r\n\r\n rewardToken.safeTransfer(fundsRecoveryAddress, balance);\r\n }\r\n\r\n /**\r\n * Verify given executer can execute this quest.\r\n * @param executer The player to verify\r\n */\r\n function canExecute(\r\n address executer\r\n ) external view override returns (bool) {\r\n return findIndexOfPlayer(executer) != -1;\r\n }\r\n\r\n /**\r\n * Register a player to the quest. (sender could be the player or quest creator)\r\n *\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires sender to put a deposit (if its creator, deposit will be released to player)\r\n * requires player list is not full\r\n * requires quest is not expired\r\n * requires player is not already registered\r\n *\r\n * emit QuestPlayed with player and timestamp\r\n */\r\n function play(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: Can't self register and play a whitelisted Quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n require(\r\n maxPlayers == 0 || playerList.length < maxPlayers,\r\n \"ERROR: Max players reached\"\r\n );\r\n require(block.timestamp < expireTime, \"ERROR: Quest expired\");\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex == -1, \"ERROR: Player already exists\");\r\n\r\n playDeposit.collectFrom(msg.sender, address(this));\r\n\r\n playerList.push(_player);\r\n emit QuestPlayed(_player, block.timestamp);\r\n }\r\n\r\n function setWhiteList(address[] memory _players) external OnlyCreator {\r\n require(\r\n isWhiteList == true,\r\n \"ERROR: Can't set the white list to a non-whitelisted contract\"\r\n );\r\n playerList = _players;\r\n emit WhiteListChanged(_players, block.timestamp);\r\n }\r\n\r\n /**\r\n * Unregister a player from the quest. (sender could be the player or quest creator)\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires player is registered\r\n *\r\n * emit QuestUnplayed with player and timestamp\r\n */\r\n function unplay(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: can't unplay a whitelisted quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex != -1, \"ERROR: player not in list\");\r\n\r\n // We put the last player in the place of the player to remove\r\n playerList[uint256(playerIndex)] = playerList[playerList.length - 1];\r\n // And then we can remove the last element to have the actual lenght updated\r\n playerList.pop();\r\n\r\n playDeposit.releaseTo(_player);\r\n emit QuestUnplayed(_player, block.timestamp);\r\n }\r\n\r\n /**\r\n Simply return the player list as the entire array\r\n */\r\n function getPlayers() external view returns (address[] memory) {\r\n return playerList;\r\n }\r\n\r\n // Private functions\r\n\r\n function findIndexOfPlayer(address _player) private view returns (int256) {\r\n for (uint256 i = 0; i < playerList.length; i++) {\r\n if (playerList[i] == _player) {\r\n return int256(i);\r\n }\r\n }\r\n return -1;\r\n }\r\n}\r\n" + }, + "contracts/QuestFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./Quest.sol\";\r\n\r\ncontract QuestFactory is OwnableUpgradeable {\r\n using DepositLib for Models.Deposit;\r\n\r\n address public aragonGovernAddress;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n uint256 public constant version = 3;\r\n\r\n event QuestCreated(\r\n address questAddress,\r\n string questTitle,\r\n bytes questDetailsRef,\r\n address rewardTokenAddress,\r\n uint256 expireTime,\r\n address fundsRecoveryAddress,\r\n address createDepositToken,\r\n uint256 createDepositAmount,\r\n address playDepositToken,\r\n uint256 playDepositAmount,\r\n address creator,\r\n uint32 maxPlayers,\r\n bool isWhiteList\r\n );\r\n\r\n event CreateDepositChanged(\r\n uint256 timestamp,\r\n address token,\r\n uint256 amount\r\n );\r\n\r\n event PlayDepositChanged(uint256 timestamp, address token, uint256 amount);\r\n\r\n /// @custom:oz-upgrades-unsafe-allow constructor\r\n constructor() {\r\n _disableInitializers();\r\n }\r\n\r\n function initialize(\r\n address _aragonGovernAddress,\r\n IERC20Upgradeable _createDepositToken,\r\n uint256 _createDepositAmount,\r\n IERC20Upgradeable _playDepositToken,\r\n uint256 _playDepositAmount,\r\n address _initialOwner\r\n ) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n setCreateDeposit(_createDepositToken, _createDepositAmount);\r\n setPlayDeposit(_playDepositToken, _playDepositAmount);\r\n if (_initialOwner != msg.sender) {\r\n transferOwnership(_initialOwner);\r\n }\r\n }\r\n\r\n /*\r\n * @dev Set the deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit CreateDepositChanged\r\n */\r\n function setCreateDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n createDeposit = Models.Deposit(token, amount);\r\n emit CreateDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * @dev Set the play deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit PlayDepositChanged\r\n */\r\n function setPlayDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n playDeposit = Models.Deposit(token, amount);\r\n emit PlayDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * Collect deposit, deploy a new Quest with given info contract\r\n * and transfer deposit to new Quest.\r\n * @param _title Quest title.\r\n * @param _details Quest details.\r\n * @param _rewardTokenAddress Reward token address.\r\n * @param _expireTime Expire time.\r\n * @param _fundsRecoveryAddress Funds recovery address.\r\n * requires deposit allowance\r\n * returns Quest address.\r\n * emits QuestCreated\r\n */\r\n function createQuest(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n IERC20Upgradeable _rewardToken,\r\n uint256 _expireTime,\r\n address payable _fundsRecoveryAddress,\r\n uint32 _maxPlayers,\r\n bool _isWhiteList\r\n ) external returns (address) {\r\n Quest quest = new Quest(\r\n _questTitle,\r\n _questDetailsRef,\r\n Models.Deposit(createDeposit.token, createDeposit.amount),\r\n Models.Deposit(playDeposit.token, playDeposit.amount),\r\n Models.QuestParam(\r\n msg.sender,\r\n _maxPlayers,\r\n _rewardToken,\r\n _expireTime,\r\n aragonGovernAddress,\r\n _fundsRecoveryAddress,\r\n _isWhiteList\r\n )\r\n );\r\n\r\n // Collect deposit from quest creator and send it to quest\r\n createDeposit.collectFrom(msg.sender, address(quest));\r\n\r\n emit QuestCreated(\r\n address(quest),\r\n _questTitle,\r\n _questDetailsRef,\r\n address(_rewardToken),\r\n _expireTime,\r\n _fundsRecoveryAddress,\r\n address(createDeposit.token),\r\n createDeposit.amount,\r\n address(playDeposit.token),\r\n playDeposit.amount,\r\n msg.sender,\r\n _maxPlayers,\r\n _isWhiteList\r\n );\r\n\r\n return address(quest);\r\n }\r\n\r\n /**\r\n * @dev Be able to change it after deploy so we can deploy\r\n * a new GovernQueue but keep the same QuestFactory\r\n * @param _aragonGovernAddress The aragonGovernAddress.\r\n */\r\n function setAragonGovernAddress(\r\n address _aragonGovernAddress\r\n ) external onlyOwner {\r\n aragonGovernAddress = _aragonGovernAddress;\r\n }\r\n}\r\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 20000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/hardhat/deployments/goerli/solcInputs/614435b62300c978a18042f5a9842c49.json b/packages/hardhat/deployments/goerli/solcInputs/614435b62300c978a18042f5a9842c49.json new file mode 100644 index 00000000..ae8f443f --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/614435b62300c978a18042f5a9842c49.json @@ -0,0 +1,86 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "contracts/libraries/Deposit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\n// Solidity: Package Default Dependencies Directory = \"node_modules\"\r\n\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"./Models.sol\";\r\n\r\nlibrary DepositLib {\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n /*\r\n * Collect deposit from signer and send it to _to address.\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n * @param _to The address where the deposit should be transfered.\r\n */\r\n function collectFrom(\r\n Models.Deposit memory _collateral,\r\n address _from,\r\n address _to\r\n ) internal {\r\n collectFrom(_collateral, _from);\r\n releaseTo(_collateral, _to);\r\n }\r\n\r\n /*\r\n * Collect deposit from signer\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n */\r\n function collectFrom(Models.Deposit memory _collateral, address _from)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n // Verify allowance\r\n uint256 allowance = _collateral.token.allowance(\r\n _from,\r\n address(this)\r\n );\r\n require(\r\n allowance >= _collateral.amount,\r\n \"ERROR : Deposit bad allowance\"\r\n );\r\n\r\n _collateral.token.safeTransferFrom(\r\n _from,\r\n address(this),\r\n _collateral.amount\r\n );\r\n }\r\n }\r\n\r\n function releaseTo(Models.Deposit memory _collateral, address _to)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n _collateral.token.safeTransfer(_to, _collateral.amount);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/libraries/IExecutable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\ninterface IExecutable {\r\n function canExecute(address executer) external returns (bool);\r\n}\r\n" + }, + "contracts/libraries/Models.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nlibrary Models {\r\n struct Deposit {\r\n IERC20Upgradeable token;\r\n uint256 amount;\r\n }\r\n struct Claim {\r\n bytes evidence;\r\n address player;\r\n uint256 amount;\r\n }\r\n struct QuestParam {\r\n address questCreator;\r\n uint32 maxPlayers;\r\n IERC20Upgradeable rewardToken;\r\n uint256 expireTime;\r\n address aragonGovernAddress;\r\n address payable fundsRecoveryAddress;\r\n bool isWhiteList;\r\n }\r\n}\r\n" + }, + "contracts/mocks/TokenMock.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\r\n\r\n// Example class - a mock class using delivering from ERC20\r\ncontract TokenMock is ERC20 {\r\n constructor(string memory name, string memory symbol)\r\n payable\r\n ERC20(name, symbol)\r\n {}\r\n\r\n function mint(address owner, uint256 initialBalance) external {\r\n _mint(owner, initialBalance);\r\n }\r\n}\r\n" + }, + "contracts/Quest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./libraries/IExecutable.sol\";\r\n\r\ncontract Quest is IExecutable {\r\n using SafeMath for uint256;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n using DepositLib for Models.Deposit;\r\n\r\n // Quest payload\r\n address public questCreator;\r\n string public questTitle;\r\n bytes public questDetailsRef;\r\n IERC20Upgradeable public rewardToken;\r\n uint256 public expireTime;\r\n address public aragonGovernAddress;\r\n address payable public fundsRecoveryAddress;\r\n uint32 public maxPlayers; // 0 for unlimited players\r\n bool public isWhiteList;\r\n Models.Claim[] public claims;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n bool public isCreateDepositReleased;\r\n\r\n address[] private playerList;\r\n\r\n event QuestClaimed(bytes evidence, address player, uint256 amount);\r\n event QuestPlayed(address player, uint256 timestamp);\r\n event QuestUnplayed(address player, uint256 timestamp);\r\n event WhiteListChanged(address[] whiteListPlayers, uint256 timestamp);\r\n modifier OnlyCreator() {\r\n require(\r\n msg.sender == questCreator,\r\n \"Only creator can call this function\"\r\n );\r\n _;\r\n }\r\n\r\n constructor(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n Models.Deposit memory _createDeposit,\r\n Models.Deposit memory _playDeposit,\r\n Models.QuestParam memory _questParam\r\n ) {\r\n require(\r\n !(_questParam.isWhiteList && _questParam.maxPlayers > 0),\r\n \"ERROR: Can't create a whiteListed quest with max players greater than 0 (infinity)\"\r\n );\r\n questTitle = _questTitle;\r\n questDetailsRef = _questDetailsRef;\r\n rewardToken = _questParam.rewardToken;\r\n expireTime = _questParam.expireTime;\r\n aragonGovernAddress = _questParam.aragonGovernAddress;\r\n fundsRecoveryAddress = _questParam.fundsRecoveryAddress;\r\n questCreator = _questParam.questCreator;\r\n createDeposit = _createDeposit;\r\n playDeposit = _playDeposit;\r\n\r\n isCreateDepositReleased = false;\r\n maxPlayers = _questParam.maxPlayers;\r\n isWhiteList = _questParam.isWhiteList;\r\n }\r\n\r\n /*\r\n * Claim a quest reward.\r\n *\r\n * @param _evidence Evidence of the claim.\r\n * @param _player Player address.\r\n * @param _amount Amount of the reward.\r\n *\r\n * requires sender to be aragonGovernAddress\r\n * requires evidence to not be empty\r\n * requires claim amount to not exceed available deposit when same token\r\n *\r\n * emit QuestClaimed\r\n */\r\n function claim(\r\n bytes memory _evidence,\r\n address _player,\r\n uint256 _amount,\r\n bool _claimAll\r\n ) external {\r\n require(msg.sender == aragonGovernAddress, \"ERROR: Sender not govern\");\r\n require(_evidence.length != 0, \"ERROR: No evidence\");\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n if (_claimAll) {\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(createDeposit.amount);\r\n _amount = result;\r\n } else {\r\n _amount = balance;\r\n }\r\n // Claim all but let play deposits of each player if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\r\n (, uint256 result) = _amount.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n _amount = result;\r\n }\r\n }\r\n\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(_amount);\r\n require(\r\n result >= createDeposit.amount,\r\n \"ERROR: Should not exceed allowed bounty\"\r\n );\r\n }\r\n\r\n if (_amount > 0) {\r\n rewardToken.safeTransfer(_player, _amount);\r\n }\r\n\r\n claims.push(Models.Claim(_evidence, _player, _amount));\r\n\r\n emit QuestClaimed(_evidence, _player, _amount);\r\n }\r\n\r\n /*\r\n * Release create deposit to creator and send unused funds to fundsRecoveryAddress.\r\n * requires quests to have expired\r\n *\r\n * requires quest to be expired\r\n */\r\n function recoverFundsAndDeposit() external {\r\n require(block.timestamp >= expireTime, \"ERROR: Not expired\");\r\n\r\n // Restore deposit if not already released\r\n if (!isCreateDepositReleased) {\r\n createDeposit.releaseTo(questCreator);\r\n isCreateDepositReleased = true;\r\n }\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\r\n (, balance) = balance.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n }\r\n\r\n rewardToken.safeTransfer(fundsRecoveryAddress, balance);\r\n }\r\n\r\n /**\r\n * Verify given executer can execute this quest.\r\n * @param executer The player to verify\r\n */\r\n function canExecute(\r\n address executer\r\n ) external view override returns (bool) {\r\n return findIndexOfPlayer(executer) != -1;\r\n }\r\n\r\n /**\r\n * Register a player to the quest. (sender could be the player or quest creator)\r\n *\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires sender to put a deposit (if its creator, deposit will be released to player)\r\n * requires player list is not full\r\n * requires quest is not expired\r\n * requires player is not already registered\r\n *\r\n * emit QuestPlayed with player and timestamp\r\n */\r\n function play(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: Can't self register and play a whitelisted Quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n require(\r\n maxPlayers == 0 || playerList.length < maxPlayers,\r\n \"ERROR: Max players reached\"\r\n );\r\n require(block.timestamp < expireTime, \"ERROR: Quest expired\");\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex == -1, \"ERROR: Player already exists\");\r\n\r\n playDeposit.collectFrom(msg.sender, address(this));\r\n\r\n playerList.push(_player);\r\n emit QuestPlayed(_player, block.timestamp);\r\n }\r\n\r\n function setWhiteList(address[] memory _players) external OnlyCreator {\r\n require(\r\n isWhiteList == true,\r\n \"ERROR: Can't set the white list to a non-whitelisted contract\"\r\n );\r\n playerList = _players;\r\n emit WhiteListChanged(_players, block.timestamp);\r\n }\r\n\r\n /**\r\n * Unregister a player from the quest. (sender could be the player or quest creator)\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires player is registered\r\n *\r\n * emit QuestUnplayed with player and timestamp\r\n */\r\n function unplay(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: can't unplay a whitelisted quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex != -1, \"ERROR: player not in list\");\r\n\r\n // We put the last player in the place of the player to remove\r\n playerList[uint256(playerIndex)] = playerList[playerList.length - 1];\r\n // And then we can remove the last element to have the actual lenght updated\r\n playerList.pop();\r\n\r\n playDeposit.releaseTo(_player);\r\n emit QuestUnplayed(_player, block.timestamp);\r\n }\r\n\r\n /**\r\n Simply return the player list as the entire array\r\n */\r\n function getPlayers() external view returns (address[] memory) {\r\n return playerList;\r\n }\r\n\r\n // Private functions\r\n\r\n function findIndexOfPlayer(address _player) private view returns (int256) {\r\n for (uint256 i = 0; i < playerList.length; i++) {\r\n if (playerList[i] == _player) {\r\n return int256(i);\r\n }\r\n }\r\n return -1;\r\n }\r\n}\r\n" + }, + "contracts/QuestFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./Quest.sol\";\r\n\r\ncontract QuestFactory is OwnableUpgradeable {\r\n using DepositLib for Models.Deposit;\r\n\r\n address public aragonGovernAddress;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n uint256 public constant version = 3;\r\n\r\n event QuestCreated(\r\n address questAddress,\r\n string questTitle,\r\n bytes questDetailsRef,\r\n address rewardTokenAddress,\r\n uint256 expireTime,\r\n address fundsRecoveryAddress,\r\n address createDepositToken,\r\n uint256 createDepositAmount,\r\n address playDepositToken,\r\n uint256 playDepositAmount,\r\n address creator,\r\n uint32 maxPlayers,\r\n bool isWhiteList\r\n );\r\n\r\n event CreateDepositChanged(\r\n uint256 timestamp,\r\n address token,\r\n uint256 amount\r\n );\r\n\r\n event PlayDepositChanged(uint256 timestamp, address token, uint256 amount);\r\n\r\n /// @custom:oz-upgrades-unsafe-allow constructor\r\n constructor() {\r\n _disableInitializers();\r\n }\r\n\r\n function initialize(\r\n address _aragonGovernAddress,\r\n IERC20Upgradeable _createDepositToken,\r\n uint256 _createDepositAmount,\r\n IERC20Upgradeable _playDepositToken,\r\n uint256 _playDepositAmount,\r\n address _initialOwner\r\n ) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n setCreateDeposit(_createDepositToken, _createDepositAmount);\r\n setPlayDeposit(_playDepositToken, _playDepositAmount);\r\n if (_initialOwner != msg.sender) {\r\n transferOwnership(_initialOwner);\r\n }\r\n }\r\n\r\n /*\r\n * @dev Set the deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit CreateDepositChanged\r\n */\r\n function setCreateDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n createDeposit = Models.Deposit(token, amount);\r\n emit CreateDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * @dev Set the play deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit PlayDepositChanged\r\n */\r\n function setPlayDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n playDeposit = Models.Deposit(token, amount);\r\n emit PlayDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * Collect deposit, deploy a new Quest with given info contract\r\n * and transfer deposit to new Quest.\r\n * @param _title Quest title.\r\n * @param _details Quest details.\r\n * @param _rewardTokenAddress Reward token address.\r\n * @param _expireTime Expire time.\r\n * @param _fundsRecoveryAddress Funds recovery address.\r\n * requires deposit allowance\r\n * returns Quest address.\r\n * emits QuestCreated\r\n */\r\n function createQuest(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n IERC20Upgradeable _rewardToken,\r\n uint256 _expireTime,\r\n address payable _fundsRecoveryAddress,\r\n uint32 _maxPlayers,\r\n bool _isWhiteList\r\n ) external returns (address) {\r\n Quest quest = new Quest(\r\n _questTitle,\r\n _questDetailsRef,\r\n Models.Deposit(createDeposit.token, createDeposit.amount),\r\n Models.Deposit(playDeposit.token, playDeposit.amount),\r\n Models.QuestParam(\r\n msg.sender,\r\n _maxPlayers,\r\n _rewardToken,\r\n _expireTime,\r\n aragonGovernAddress,\r\n _fundsRecoveryAddress,\r\n _isWhiteList\r\n )\r\n );\r\n\r\n // Collect deposit from quest creator and send it to quest\r\n createDeposit.collectFrom(msg.sender, address(quest));\r\n\r\n emit QuestCreated(\r\n address(quest),\r\n _questTitle,\r\n _questDetailsRef,\r\n address(_rewardToken),\r\n _expireTime,\r\n _fundsRecoveryAddress,\r\n address(createDeposit.token),\r\n createDeposit.amount,\r\n address(playDeposit.token),\r\n playDeposit.amount,\r\n msg.sender,\r\n _maxPlayers,\r\n _isWhiteList\r\n );\r\n\r\n return address(quest);\r\n }\r\n\r\n /**\r\n * @dev Be able to change it after deploy so we can deploy\r\n * a new GovernQueue but keep the same QuestFactory\r\n * @param _aragonGovernAddress The aragonGovernAddress.\r\n */\r\n function setAragonGovernAddress(\r\n address _aragonGovernAddress\r\n ) external onlyOwner {\r\n aragonGovernAddress = _aragonGovernAddress;\r\n }\r\n}\r\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 20000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/hardhat/deployments/goerli/solcInputs/635017942873bb45f82d219ade56500d.json b/packages/hardhat/deployments/goerli/solcInputs/635017942873bb45f82d219ade56500d.json new file mode 100644 index 00000000..198bf31c --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/635017942873bb45f82d219ade56500d.json @@ -0,0 +1,87 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "contracts/libraries/Deposit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\n// Solidity: Package Default Dependencies Directory = \"node_modules\"\r\n\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"./Models.sol\";\r\n\r\nlibrary DepositLib {\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n /*\r\n * Collect deposit from signer and send it to _to address.\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n * @param _to The address where the deposit should be transfered.\r\n */\r\n function collectFrom(\r\n Models.Deposit memory _collateral,\r\n address _from,\r\n address _to\r\n ) internal {\r\n collectFrom(_collateral, _from);\r\n releaseTo(_collateral, _to);\r\n }\r\n\r\n /*\r\n * Collect deposit from signer\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n */\r\n function collectFrom(Models.Deposit memory _collateral, address _from)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n // Verify allowance\r\n uint256 allowance = _collateral.token.allowance(\r\n _from,\r\n address(this)\r\n );\r\n require(\r\n allowance >= _collateral.amount,\r\n \"ERROR : Deposit bad allowance\"\r\n );\r\n\r\n _collateral.token.safeTransferFrom(\r\n _from,\r\n address(this),\r\n _collateral.amount\r\n );\r\n }\r\n }\r\n\r\n function releaseTo(Models.Deposit memory _collateral, address _to)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n _collateral.token.safeTransfer(_to, _collateral.amount);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/libraries/IExecutable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\ninterface IExecutable {\r\n function canExecute(address executer) external returns (bool);\r\n}\r\n" + }, + "contracts/libraries/Models.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nlibrary Models {\r\n struct Deposit {\r\n IERC20Upgradeable token;\r\n uint256 amount;\r\n }\r\n struct Claim {\r\n bytes evidence;\r\n address player;\r\n uint256 amount;\r\n }\r\n struct QuestParam {\r\n address questCreator;\r\n uint32 maxPlayers;\r\n IERC20Upgradeable rewardToken;\r\n uint256 expireTime;\r\n address aragonGovernAddress;\r\n address payable fundsRecoveryAddress;\r\n bool isWhiteList;\r\n }\r\n}\r\n" + }, + "contracts/mocks/TokenMock.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\r\n\r\n// Example class - a mock class using delivering from ERC20\r\ncontract TokenMock is ERC20 {\r\n constructor(string memory name, string memory symbol)\r\n payable\r\n ERC20(name, symbol)\r\n {}\r\n\r\n function mint(address owner, uint256 initialBalance) external {\r\n _mint(owner, initialBalance);\r\n }\r\n}\r\n" + }, + "contracts/Quest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./libraries/IExecutable.sol\";\r\n\r\ncontract Quest is IExecutable {\r\n using SafeMath for uint256;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n using DepositLib for Models.Deposit;\r\n\r\n // Quest payload\r\n address public questCreator;\r\n string public questTitle;\r\n bytes public questDetailsRef;\r\n IERC20Upgradeable public rewardToken;\r\n uint256 public expireTime;\r\n address public aragonGovernAddress;\r\n address payable public fundsRecoveryAddress;\r\n uint32 public maxPlayers; // 0 for unlimited players\r\n bool public isWhiteList;\r\n Models.Claim[] public claims;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n bool public isCreateDepositReleased;\r\n\r\n address[] private playerList;\r\n\r\n event QuestClaimed(bytes evidence, address player, uint256 amount);\r\n event QuestPlayed(address player, uint256 timestamp);\r\n event QuestUnplayed(address player, uint256 timestamp);\r\n event WhiteListChanged(address[] whiteListPlayers, uint256 timestamp);\r\n modifier OnlyCreator() {\r\n require(\r\n msg.sender == questCreator,\r\n \"Only creator can call this function\"\r\n );\r\n _;\r\n }\r\n\r\n constructor(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n Models.Deposit memory _createDeposit,\r\n Models.Deposit memory _playDeposit,\r\n Models.QuestParam memory _questParam\r\n ) {\r\n require(\r\n !(_questParam.isWhiteList && _questParam.maxPlayers > 0),\r\n \"ERROR: Can't create a whiteListed quest with max players greater than 0 (infinity)\"\r\n );\r\n questTitle = _questTitle;\r\n questDetailsRef = _questDetailsRef;\r\n rewardToken = _questParam.rewardToken;\r\n expireTime = _questParam.expireTime;\r\n aragonGovernAddress = _questParam.aragonGovernAddress;\r\n fundsRecoveryAddress = _questParam.fundsRecoveryAddress;\r\n questCreator = _questParam.questCreator;\r\n createDeposit = _createDeposit;\r\n playDeposit = _playDeposit;\r\n\r\n isCreateDepositReleased = false;\r\n maxPlayers = _questParam.maxPlayers;\r\n isWhiteList = _questParam.isWhiteList;\r\n }\r\n\r\n /*\r\n * Claim a quest reward.\r\n *\r\n * @param _evidence Evidence of the claim.\r\n * @param _player Player address.\r\n * @param _amount Amount of the reward.\r\n *\r\n * requires sender to be aragonGovernAddress\r\n * requires evidence to not be empty\r\n * requires claim amount to not exceed available deposit when same token\r\n *\r\n * emit QuestClaimed\r\n */\r\n function claim(\r\n bytes memory _evidence,\r\n address _player,\r\n uint256 _amount,\r\n bool _claimAll\r\n ) external {\r\n require(msg.sender == aragonGovernAddress, \"ERROR: Sender not govern\");\r\n require(_evidence.length != 0, \"ERROR: No evidence\");\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n if (_claimAll) {\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(createDeposit.amount);\r\n _amount = result;\r\n } else {\r\n _amount = balance;\r\n }\r\n // Claim all but let play deposits of each player if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\r\n (, uint256 result) = _amount.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n _amount = result;\r\n }\r\n }\r\n\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(_amount);\r\n require(\r\n result >= createDeposit.amount,\r\n \"ERROR: Should not exceed allowed bounty\"\r\n );\r\n }\r\n\r\n if (_amount > 0) {\r\n rewardToken.safeTransfer(_player, _amount);\r\n }\r\n\r\n claims.push(Models.Claim(_evidence, _player, _amount));\r\n\r\n emit QuestClaimed(_evidence, _player, _amount);\r\n }\r\n\r\n /*\r\n * Release create deposit to creator and send unused funds to fundsRecoveryAddress.\r\n * requires quests to have expired\r\n *\r\n * requires quest to be expired\r\n */\r\n function recoverFundsAndDeposit() external {\r\n require(block.timestamp >= expireTime, \"ERROR: Not expired\");\r\n\r\n // Restore deposit if not already released\r\n if (!isCreateDepositReleased) {\r\n createDeposit.releaseTo(questCreator);\r\n isCreateDepositReleased = true;\r\n }\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\r\n (, balance) = balance.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n }\r\n\r\n rewardToken.safeTransfer(fundsRecoveryAddress, balance);\r\n }\r\n\r\n /**\r\n * Verify given executer can execute this quest.\r\n * @param executer The player to verify\r\n */\r\n function canExecute(\r\n address executer\r\n ) external view override returns (bool) {\r\n return findIndexOfPlayer(executer) != -1;\r\n }\r\n\r\n /**\r\n * Register a player to the quest. (sender could be the player or quest creator)\r\n *\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires sender to put a deposit (if its creator, deposit will be released to player)\r\n * requires player list is not full\r\n * requires quest is not expired\r\n * requires player is not already registered\r\n *\r\n * emit QuestPlayed with player and timestamp\r\n */\r\n function play(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: Can't self register and play a whitelisted Quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n require(\r\n maxPlayers == 0 || playerList.length < maxPlayers,\r\n \"ERROR: Max players reached\"\r\n );\r\n require(block.timestamp < expireTime, \"ERROR: Quest expired\");\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex == -1, \"ERROR: Player already exists\");\r\n\r\n playDeposit.collectFrom(msg.sender, address(this));\r\n\r\n playerList.push(_player);\r\n emit QuestPlayed(_player, block.timestamp);\r\n }\r\n\r\n function setWhiteList(address[] memory _players) external OnlyCreator {\r\n require(\r\n isWhiteList == true,\r\n \"ERROR: Can't set the white list to a non-whitelisted contract\"\r\n );\r\n playerList = _players;\r\n emit WhiteListChanged(_players, block.timestamp);\r\n }\r\n\r\n /**\r\n * Unregister a player from the quest. (sender could be the player or quest creator)\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires player is registered\r\n *\r\n * emit QuestUnplayed with player and timestamp\r\n */\r\n function unplay(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: can't unplay a whitelisted quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex != -1, \"ERROR: player not in list\");\r\n\r\n // We put the last player in the place of the player to remove\r\n playerList[uint256(playerIndex)] = playerList[playerList.length - 1];\r\n // And then we can remove the last element to have the actual lenght updated\r\n playerList.pop();\r\n\r\n playDeposit.releaseTo(_player);\r\n emit QuestUnplayed(_player, block.timestamp);\r\n }\r\n\r\n /**\r\n Simply return the player list as the entire array\r\n */\r\n function getPlayers() external view returns (address[] memory) {\r\n return playerList;\r\n }\r\n\r\n // Private functions\r\n\r\n function findIndexOfPlayer(address _player) private view returns (int256) {\r\n for (uint256 i = 0; i < playerList.length; i++) {\r\n if (playerList[i] == _player) {\r\n return int256(i);\r\n }\r\n }\r\n return -1;\r\n }\r\n}\r\n" + }, + "contracts/QuestFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./Quest.sol\";\r\n\r\ncontract QuestFactory is OwnableUpgradeable {\r\n using DepositLib for Models.Deposit;\r\n\r\n address public aragonGovernAddress;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n uint256 public constant version = 3;\r\n\r\n event QuestCreated(\r\n address questAddress,\r\n string questTitle,\r\n bytes questDetailsRef,\r\n address rewardTokenAddress,\r\n uint256 expireTime,\r\n address fundsRecoveryAddress,\r\n Models.Deposit createDeposit,\r\n Models.Deposit playDeposit,\r\n address creator,\r\n uint32 maxPlayers,\r\n bool isWhiteList,\r\n uint256 version\r\n );\r\n\r\n event CreateDepositChanged(\r\n uint256 timestamp,\r\n address token,\r\n uint256 amount\r\n );\r\n\r\n event PlayDepositChanged(uint256 timestamp, address token, uint256 amount);\r\n\r\n /// @custom:oz-upgrades-unsafe-allow constructor\r\n constructor() {\r\n _disableInitializers();\r\n }\r\n\r\n function initialize(\r\n address _aragonGovernAddress,\r\n IERC20Upgradeable _createDepositToken,\r\n uint256 _createDepositAmount,\r\n IERC20Upgradeable _playDepositToken,\r\n uint256 _playDepositAmount,\r\n address _initialOwner\r\n ) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n setCreateDeposit(_createDepositToken, _createDepositAmount);\r\n setPlayDeposit(_playDepositToken, _playDepositAmount);\r\n if (_initialOwner != msg.sender) {\r\n transferOwnership(_initialOwner);\r\n }\r\n }\r\n\r\n /*\r\n * @dev Set the deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit CreateDepositChanged\r\n */\r\n function setCreateDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n createDeposit = Models.Deposit(token, amount);\r\n emit CreateDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * @dev Set the play deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit PlayDepositChanged\r\n */\r\n function setPlayDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n playDeposit = Models.Deposit(token, amount);\r\n emit PlayDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * Collect deposit, deploy a new Quest with given info contract\r\n * and transfer deposit to new Quest.\r\n * @param _title Quest title.\r\n * @param _details Quest details.\r\n * @param _rewardTokenAddress Reward token address.\r\n * @param _expireTime Expire time.\r\n * @param _fundsRecoveryAddress Funds recovery address.\r\n * requires deposit allowance\r\n * returns Quest address.\r\n * emits QuestCreated\r\n */\r\n function createQuest(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n IERC20Upgradeable _rewardToken,\r\n uint256 _expireTime,\r\n address payable _fundsRecoveryAddress,\r\n uint32 _maxPlayers,\r\n bool _isWhiteList\r\n ) external returns (address) {\r\n Quest quest = new Quest(\r\n _questTitle,\r\n _questDetailsRef,\r\n Models.Deposit(createDeposit.token, createDeposit.amount),\r\n Models.Deposit(playDeposit.token, playDeposit.amount),\r\n Models.QuestParam(\r\n msg.sender,\r\n _maxPlayers,\r\n _rewardToken,\r\n _expireTime,\r\n aragonGovernAddress,\r\n _fundsRecoveryAddress,\r\n _isWhiteList\r\n )\r\n );\r\n\r\n // Collect deposit from quest creator and send it to quest\r\n createDeposit.collectFrom(msg.sender, address(quest));\r\n\r\n emit QuestCreated(\r\n address(quest),\r\n _questTitle,\r\n _questDetailsRef,\r\n address(_rewardToken),\r\n _expireTime,\r\n _fundsRecoveryAddress,\r\n createDeposit,\r\n playDeposit,\r\n msg.sender,\r\n _maxPlayers,\r\n _isWhiteList,\r\n version\r\n );\r\n\r\n return address(quest);\r\n }\r\n\r\n /**\r\n * @dev Be able to change it after deploy so we can deploy\r\n * a new GovernQueue but keep the same QuestFactory\r\n * @param _aragonGovernAddress The aragonGovernAddress.\r\n */\r\n function setAragonGovernAddress(\r\n address _aragonGovernAddress\r\n ) external onlyOwner {\r\n aragonGovernAddress = _aragonGovernAddress;\r\n }\r\n}\r\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 20000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + }, + "libraries": {} + } +} \ No newline at end of file diff --git a/packages/hardhat/deployments/goerli/solcInputs/a33307a6c4e89062a46e94b88af6078f.json b/packages/hardhat/deployments/goerli/solcInputs/a33307a6c4e89062a46e94b88af6078f.json new file mode 100644 index 00000000..eb438054 --- /dev/null +++ b/packages/hardhat/deployments/goerli/solcInputs/a33307a6c4e89062a46e94b88af6078f.json @@ -0,0 +1,87 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "contracts/libraries/Deposit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\n// Solidity: Package Default Dependencies Directory = \"node_modules\"\r\n\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"./Models.sol\";\r\n\r\nlibrary DepositLib {\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n\r\n /*\r\n * Collect deposit from signer and send it to _to address.\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n * @param _to The address where the deposit should be transfered.\r\n */\r\n function collectFrom(\r\n Models.Deposit memory _collateral,\r\n address _from,\r\n address _to\r\n ) internal {\r\n collectFrom(_collateral, _from);\r\n releaseTo(_collateral, _to);\r\n }\r\n\r\n /*\r\n * Collect deposit from signer\r\n * @param _token The deposit token.\r\n * @param _amount The deposit amount.\r\n */\r\n function collectFrom(Models.Deposit memory _collateral, address _from)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n // Verify allowance\r\n uint256 allowance = _collateral.token.allowance(\r\n _from,\r\n address(this)\r\n );\r\n require(\r\n allowance >= _collateral.amount,\r\n \"ERROR : Deposit bad allowance\"\r\n );\r\n\r\n _collateral.token.safeTransferFrom(\r\n _from,\r\n address(this),\r\n _collateral.amount\r\n );\r\n }\r\n }\r\n\r\n function releaseTo(Models.Deposit memory _collateral, address _to)\r\n internal\r\n {\r\n if (_collateral.amount > 0) {\r\n _collateral.token.safeTransfer(_to, _collateral.amount);\r\n }\r\n }\r\n}\r\n" + }, + "contracts/libraries/IExecutable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\ninterface IExecutable {\r\n function canExecute(address executer) external returns (bool);\r\n}\r\n" + }, + "contracts/libraries/Models.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\n\r\nlibrary Models {\r\n struct Deposit {\r\n IERC20Upgradeable token;\r\n uint256 amount;\r\n }\r\n struct Claim {\r\n bytes evidence;\r\n address player;\r\n uint256 amount;\r\n }\r\n struct QuestParam {\r\n address questCreator;\r\n uint32 maxPlayers;\r\n IERC20Upgradeable rewardToken;\r\n uint256 expireTime;\r\n address aragonGovernAddress;\r\n address payable fundsRecoveryAddress;\r\n bool isWhiteList;\r\n }\r\n}\r\n" + }, + "contracts/mocks/TokenMock.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\r\n\r\n// Example class - a mock class using delivering from ERC20\r\ncontract TokenMock is ERC20 {\r\n constructor(string memory name, string memory symbol)\r\n payable\r\n ERC20(name, symbol)\r\n {}\r\n\r\n function mint(address owner, uint256 initialBalance) external {\r\n _mint(owner, initialBalance);\r\n }\r\n}\r\n" + }, + "contracts/Quest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./libraries/IExecutable.sol\";\r\n\r\ncontract Quest is IExecutable {\r\n using SafeMath for uint256;\r\n using SafeERC20Upgradeable for IERC20Upgradeable;\r\n using DepositLib for Models.Deposit;\r\n\r\n // Quest payload\r\n address public questCreator;\r\n string public questTitle;\r\n bytes public questDetailsRef;\r\n IERC20Upgradeable public rewardToken;\r\n uint256 public expireTime;\r\n address public aragonGovernAddress;\r\n address payable public fundsRecoveryAddress;\r\n uint32 public maxPlayers; // 0 for unlimited players\r\n bool public isWhiteList;\r\n Models.Claim[] public claims;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n bool public isCreateDepositReleased;\r\n\r\n address[] private playerList;\r\n\r\n event QuestClaimed(bytes evidence, address player, uint256 amount);\r\n event QuestPlayed(address player, uint256 timestamp);\r\n event QuestUnplayed(address player, uint256 timestamp);\r\n event QuestWhiteListChanged(address[] whiteListPlayers, uint256 timestamp);\r\n modifier OnlyCreator() {\r\n require(\r\n msg.sender == questCreator,\r\n \"Only creator can call this function\"\r\n );\r\n _;\r\n }\r\n\r\n constructor(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n Models.Deposit memory _createDeposit,\r\n Models.Deposit memory _playDeposit,\r\n Models.QuestParam memory _questParam\r\n ) {\r\n require(\r\n !(_questParam.isWhiteList && _questParam.maxPlayers > 0),\r\n \"ERROR: Can't create a whiteListed quest with max players greater than 0 (infinity)\"\r\n );\r\n questTitle = _questTitle;\r\n questDetailsRef = _questDetailsRef;\r\n rewardToken = _questParam.rewardToken;\r\n expireTime = _questParam.expireTime;\r\n aragonGovernAddress = _questParam.aragonGovernAddress;\r\n fundsRecoveryAddress = _questParam.fundsRecoveryAddress;\r\n questCreator = _questParam.questCreator;\r\n createDeposit = _createDeposit;\r\n playDeposit = _playDeposit;\r\n\r\n isCreateDepositReleased = false;\r\n maxPlayers = _questParam.maxPlayers;\r\n isWhiteList = _questParam.isWhiteList;\r\n }\r\n\r\n /*\r\n * Claim a quest reward.\r\n *\r\n * @param _evidence Evidence of the claim.\r\n * @param _player Player address.\r\n * @param _amount Amount of the reward.\r\n *\r\n * requires sender to be aragonGovernAddress\r\n * requires evidence to not be empty\r\n * requires claim amount to not exceed available deposit when same token\r\n *\r\n * emit QuestClaimed\r\n */\r\n function claim(\r\n bytes memory _evidence,\r\n address _player,\r\n uint256 _amount,\r\n bool _claimAll\r\n ) external {\r\n require(msg.sender == aragonGovernAddress, \"ERROR: Sender not govern\");\r\n require(_evidence.length != 0, \"ERROR: No evidence\");\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n if (_claimAll) {\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(createDeposit.amount);\r\n _amount = result;\r\n } else {\r\n _amount = balance;\r\n }\r\n // Claim all but let play deposits of each player if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\r\n (, uint256 result) = _amount.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n _amount = result;\r\n }\r\n }\r\n\r\n if (address(rewardToken) == address(createDeposit.token)) {\r\n (, uint256 result) = balance.trySub(_amount);\r\n require(\r\n result >= createDeposit.amount,\r\n \"ERROR: Should not exceed allowed bounty\"\r\n );\r\n }\r\n\r\n if (_amount > 0) {\r\n rewardToken.safeTransfer(_player, _amount);\r\n }\r\n\r\n claims.push(Models.Claim(_evidence, _player, _amount));\r\n\r\n emit QuestClaimed(_evidence, _player, _amount);\r\n }\r\n\r\n /*\r\n * Release create deposit to creator and send unused funds to fundsRecoveryAddress.\r\n * requires quests to have expired\r\n *\r\n * requires quest to be expired\r\n */\r\n function recoverFundsAndDeposit() external {\r\n require(block.timestamp >= expireTime, \"ERROR: Not expired\");\r\n\r\n // Restore deposit if not already released\r\n if (!isCreateDepositReleased) {\r\n createDeposit.releaseTo(questCreator);\r\n isCreateDepositReleased = true;\r\n }\r\n\r\n uint256 balance = rewardToken.balanceOf(address(this));\r\n\r\n // Claim all but let the create deposit if they are same token\r\n if (address(rewardToken) == address(playDeposit.token)) {\r\n (, balance) = balance.trySub(\r\n playDeposit.amount * playerList.length\r\n );\r\n }\r\n\r\n rewardToken.safeTransfer(fundsRecoveryAddress, balance);\r\n }\r\n\r\n /**\r\n * Verify given executer can execute this quest.\r\n * @param executer The player to verify\r\n */\r\n function canExecute(\r\n address executer\r\n ) external view override returns (bool) {\r\n return findIndexOfPlayer(executer) != -1;\r\n }\r\n\r\n /**\r\n * Register a player to the quest. (sender could be the player or quest creator)\r\n *\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires sender to put a deposit (if its creator, deposit will be released to player)\r\n * requires player list is not full\r\n * requires quest is not expired\r\n * requires player is not already registered\r\n *\r\n * emit QuestPlayed with player and timestamp\r\n */\r\n function play(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: Can't self register and play a whitelisted Quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n require(\r\n maxPlayers == 0 || playerList.length < maxPlayers,\r\n \"ERROR: Max players reached\"\r\n );\r\n require(block.timestamp < expireTime, \"ERROR: Quest expired\");\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex == -1, \"ERROR: Player already exists\");\r\n\r\n playDeposit.collectFrom(msg.sender, address(this));\r\n\r\n playerList.push(_player);\r\n emit QuestPlayed(_player, block.timestamp);\r\n }\r\n\r\n /***\r\n * Set the white list of players allowed to play the quest.\r\n * \r\n * requires sender to be the quest creator\r\n * @param _players The list of players allowed to play the quest.\r\n * \r\n * emit QuestWhiteListChanged with players and timestamp\r\n */\r\n function setWhiteList(address[] memory _players) external OnlyCreator {\r\n require(\r\n isWhiteList == true,\r\n \"ERROR: Can't set the white list to a non-whitelisted contract\"\r\n );\r\n playerList = _players;\r\n emit QuestWhiteListChanged(_players, block.timestamp);\r\n }\r\n\r\n /**\r\n * Unregister a player from the quest. (sender could be the player or quest creator)\r\n * @param _player Player address.\r\n *\r\n * requires sender to be the quest creator or the player\r\n * requires player is registered\r\n *\r\n * emit QuestUnplayed with player and timestamp\r\n */\r\n function unplay(address _player) external {\r\n require(\r\n isWhiteList == false,\r\n \"ERROR: can't unplay a whitelisted quest\"\r\n );\r\n require(\r\n msg.sender == _player || msg.sender == questCreator,\r\n \"ERROR: Sender not player nor creator\"\r\n );\r\n int256 playerIndex = findIndexOfPlayer(_player);\r\n require(playerIndex != -1, \"ERROR: player not in list\");\r\n\r\n // We put the last player in the place of the player to remove\r\n playerList[uint256(playerIndex)] = playerList[playerList.length - 1];\r\n // And then we can remove the last element to have the actual lenght updated\r\n playerList.pop();\r\n\r\n playDeposit.releaseTo(_player);\r\n emit QuestUnplayed(_player, block.timestamp);\r\n }\r\n\r\n /**\r\n Simply return the player list as the entire array\r\n */\r\n function getPlayers() external view returns (address[] memory) {\r\n return playerList;\r\n }\r\n\r\n // Private functions\r\n\r\n function findIndexOfPlayer(address _player) private view returns (int256) {\r\n for (uint256 i = 0; i < playerList.length; i++) {\r\n if (playerList[i] == _player) {\r\n return int256(i);\r\n }\r\n }\r\n return -1;\r\n }\r\n}\r\n" + }, + "contracts/QuestFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\r\npragma solidity ^0.8.2;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\r\nimport \"./libraries/Deposit.sol\";\r\nimport \"./libraries/Models.sol\";\r\nimport \"./Quest.sol\";\r\n\r\ncontract QuestFactory is OwnableUpgradeable {\r\n using DepositLib for Models.Deposit;\r\n\r\n address public aragonGovernAddress;\r\n Models.Deposit public createDeposit;\r\n Models.Deposit public playDeposit;\r\n uint256 public constant version = 3;\r\n\r\n event QuestCreated(\r\n address questAddress,\r\n string questTitle,\r\n bytes questDetailsRef,\r\n address rewardTokenAddress,\r\n uint256 expireTime,\r\n address fundsRecoveryAddress,\r\n Models.Deposit createDeposit,\r\n Models.Deposit playDeposit,\r\n address creator,\r\n uint32 maxPlayers,\r\n bool isWhiteList,\r\n uint256 version\r\n );\r\n\r\n event CreateDepositChanged(\r\n uint256 timestamp,\r\n address token,\r\n uint256 amount\r\n );\r\n\r\n event PlayDepositChanged(uint256 timestamp, address token, uint256 amount);\r\n\r\n /// @custom:oz-upgrades-unsafe-allow constructor\r\n constructor() {\r\n _disableInitializers();\r\n }\r\n\r\n function initialize(\r\n address _aragonGovernAddress,\r\n IERC20Upgradeable _createDepositToken,\r\n uint256 _createDepositAmount,\r\n IERC20Upgradeable _playDepositToken,\r\n uint256 _playDepositAmount,\r\n address _initialOwner\r\n ) public initializer {\r\n __Ownable_init();\r\n aragonGovernAddress = _aragonGovernAddress;\r\n setCreateDeposit(_createDepositToken, _createDepositAmount);\r\n setPlayDeposit(_playDepositToken, _playDepositAmount);\r\n if (_initialOwner != msg.sender) {\r\n transferOwnership(_initialOwner);\r\n }\r\n }\r\n\r\n /*\r\n * @dev Set the deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit CreateDepositChanged\r\n */\r\n function setCreateDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n createDeposit = Models.Deposit(token, amount);\r\n emit CreateDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * @dev Set the play deposit token and amount.\r\n * @param _depositToken The deposit token.\r\n * @param _depositAmount The deposit amount.\r\n * emit PlayDepositChanged\r\n */\r\n function setPlayDeposit(\r\n IERC20Upgradeable token,\r\n uint256 amount\r\n ) public onlyOwner {\r\n playDeposit = Models.Deposit(token, amount);\r\n emit PlayDepositChanged(block.timestamp, address(token), amount);\r\n }\r\n\r\n /*\r\n * Collect deposit, deploy a new Quest with given info contract\r\n * and transfer deposit to new Quest.\r\n * @param _title Quest title.\r\n * @param _details Quest details.\r\n * @param _rewardTokenAddress Reward token address.\r\n * @param _expireTime Expire time.\r\n * @param _fundsRecoveryAddress Funds recovery address.\r\n * requires deposit allowance\r\n * returns Quest address.\r\n * emits QuestCreated\r\n */\r\n function createQuest(\r\n string memory _questTitle,\r\n bytes memory _questDetailsRef,\r\n IERC20Upgradeable _rewardToken,\r\n uint256 _expireTime,\r\n address payable _fundsRecoveryAddress,\r\n uint32 _maxPlayers,\r\n bool _isWhiteList\r\n ) external returns (address) {\r\n Quest quest = new Quest(\r\n _questTitle,\r\n _questDetailsRef,\r\n Models.Deposit(createDeposit.token, createDeposit.amount),\r\n Models.Deposit(playDeposit.token, playDeposit.amount),\r\n Models.QuestParam(\r\n msg.sender,\r\n _maxPlayers,\r\n _rewardToken,\r\n _expireTime,\r\n aragonGovernAddress,\r\n _fundsRecoveryAddress,\r\n _isWhiteList\r\n )\r\n );\r\n\r\n // Collect deposit from quest creator and send it to quest\r\n createDeposit.collectFrom(msg.sender, address(quest));\r\n\r\n emit QuestCreated(\r\n address(quest),\r\n _questTitle,\r\n _questDetailsRef,\r\n address(_rewardToken),\r\n _expireTime,\r\n _fundsRecoveryAddress,\r\n createDeposit,\r\n playDeposit,\r\n msg.sender,\r\n _maxPlayers,\r\n _isWhiteList,\r\n version\r\n );\r\n\r\n return address(quest);\r\n }\r\n\r\n /**\r\n * @dev Be able to change it after deploy so we can deploy\r\n * a new GovernQueue but keep the same QuestFactory\r\n * @param _aragonGovernAddress The aragonGovernAddress.\r\n */\r\n function setAragonGovernAddress(\r\n address _aragonGovernAddress\r\n ) external onlyOwner {\r\n aragonGovernAddress = _aragonGovernAddress;\r\n }\r\n}\r\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 20000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + }, + "libraries": {} + } +} \ No newline at end of file diff --git a/packages/hardhat/deployments/xdai/GovernQueue.json b/packages/hardhat/deployments/xdai/GovernQueue.json index bb58a03a..b4b367e6 100644 --- a/packages/hardhat/deployments/xdai/GovernQueue.json +++ b/packages/hardhat/deployments/xdai/GovernQueue.json @@ -1,688 +1,1700 @@ { - "address": "0x6D8189C979bBB6768395A78E2AB8A15133459600", - "abi": [ - { - "type": "constructor", - "inputs": [ - { "type": "address", "name": "_aclRoot", "internalType": "address" }, - { - "type": "tuple", - "name": "_initialConfig", - "internalType": "struct ERC3000Data.Config", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "bytes4", "name": "", "internalType": "bytes4" }], - "name": "ROOT_ROLE", - "inputs": [] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [], - "name": "bulk", - "inputs": [ - { - "type": "tuple[]", - "name": "items", - "internalType": "struct ACLData.BulkItem[]", - "components": [ - { "type": "uint8" }, - { "type": "bytes4" }, - { "type": "address" } - ] - } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [ - { "type": "uint256", "name": "disputeId", "internalType": "uint256" } - ], - "name": "challenge", - "inputs": [ - { - "type": "tuple", - "name": "_container", - "internalType": "struct ERC3000Data.Container", - "components": [ - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "address" }, - { "type": "address" }, - { - "type": "tuple[]", - "components": [ - { "type": "address" }, - { "type": "uint256" }, - { "type": "bytes" } - ] - }, - { "type": "bytes32" }, - { "type": "bytes" }, - { "type": "address" } - ] - }, - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - }, - { "type": "bytes", "name": "_reason", "internalType": "bytes" } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "address", "name": "", "internalType": "address" }], - "name": "challengerCache", - "inputs": [{ "type": "bytes32", "name": "", "internalType": "bytes32" }] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "bytes32", "name": "", "internalType": "bytes32" }], - "name": "configHash", - "inputs": [] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [{ "type": "bytes32", "name": "", "internalType": "bytes32" }], - "name": "configure", - "inputs": [ - { - "type": "tuple", - "name": "_config", - "internalType": "struct ERC3000Data.Config", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }], - "name": "disputeItemCache", - "inputs": [ - { "type": "bytes32", "name": "", "internalType": "bytes32" }, - { - "type": "address", - "name": "", - "internalType": "contract IArbitrator" - } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [ - { "type": "bytes32", "name": "failureMap", "internalType": "bytes32" }, - { "type": "bytes[]", "name": "", "internalType": "bytes[]" } - ], - "name": "execute", - "inputs": [ - { - "type": "tuple", - "name": "_container", - "internalType": "struct ERC3000Data.Container", - "components": [ - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "address" }, - { "type": "address" }, - { - "type": "tuple[]", - "components": [ - { "type": "address" }, - { "type": "uint256" }, - { "type": "bytes" } - ] - }, - { "type": "bytes32" }, - { "type": "bytes" }, - { "type": "address" } - ] - }, - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [], - "name": "freeze", - "inputs": [ - { "type": "bytes4", "name": "_role", "internalType": "bytes4" } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [], - "name": "grant", - "inputs": [ - { "type": "bytes4", "name": "_role", "internalType": "bytes4" }, - { "type": "address", "name": "_who", "internalType": "address" } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [], - "name": "grantWithOracle", - "inputs": [ - { "type": "bytes4", "name": "_role", "internalType": "bytes4" }, - { "type": "address", "name": "_who", "internalType": "address" }, - { - "type": "address", - "name": "_oracle", - "internalType": "contract IACLOracle" - } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }], - "name": "initBlocks", - "inputs": [{ "type": "string", "name": "", "internalType": "string" }] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [], - "name": "initialize", - "inputs": [ - { "type": "address", "name": "_aclRoot", "internalType": "address" }, - { - "type": "tuple", - "name": "_initialConfig", - "internalType": "struct ERC3000Data.Config", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "bool", "name": "", "internalType": "bool" }], - "name": "isFrozen", - "inputs": [ - { "type": "bytes4", "name": "_role", "internalType": "bytes4" } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }], - "name": "nonce", - "inputs": [] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint8", - "name": "state", - "internalType": "enum GovernQueueStateLib.State" - } - ], - "name": "queue", - "inputs": [{ "type": "bytes32", "name": "", "internalType": "bytes32" }] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [ - { "type": "bytes32", "name": "failureMap", "internalType": "bytes32" }, - { "type": "bytes[]", "name": "", "internalType": "bytes[]" } - ], - "name": "resolve", - "inputs": [ - { - "type": "tuple", - "name": "_container", - "internalType": "struct ERC3000Data.Container", - "components": [ - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "address" }, - { "type": "address" }, - { - "type": "tuple[]", - "components": [ - { "type": "address" }, - { "type": "uint256" }, - { "type": "bytes" } - ] - }, - { "type": "bytes32" }, - { "type": "bytes" }, - { "type": "address" } - ] - }, - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - }, - { "type": "uint256", "name": "_disputeId", "internalType": "uint256" } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [], - "name": "revoke", - "inputs": [ - { "type": "bytes4", "name": "_role", "internalType": "bytes4" }, - { "type": "address", "name": "_who", "internalType": "address" } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "address", "name": "", "internalType": "address" }], - "name": "roles", - "inputs": [ - { "type": "bytes4", "name": "", "internalType": "bytes4" }, - { "type": "address", "name": "", "internalType": "address" } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [ - { - "type": "bytes32", - "name": "containerHash", - "internalType": "bytes32" - } - ], - "name": "schedule", - "inputs": [ - { - "type": "tuple", - "name": "_container", - "internalType": "struct ERC3000Data.Container", - "components": [ - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "address" }, - { "type": "address" }, - { - "type": "tuple[]", - "components": [ - { "type": "address" }, - { "type": "uint256" }, - { "type": "bytes" } - ] - }, - { "type": "bytes32" }, - { "type": "bytes" }, - { "type": "address" } - ] - }, - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - } - ] - }, - { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "bool", "name": "", "internalType": "bool" }], - "name": "supportsInterface", - "inputs": [ - { "type": "bytes4", "name": "_interfaceId", "internalType": "bytes4" } - ] - }, - { - "type": "function", - "stateMutability": "nonpayable", - "outputs": [], - "name": "veto", - "inputs": [ - { - "type": "tuple", - "name": "_container", - "internalType": "struct ERC3000Data.Container", - "components": [ - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "address" }, - { "type": "address" }, - { - "type": "tuple[]", - "components": [ - { "type": "address" }, - { "type": "uint256" }, - { "type": "bytes" } - ] - }, - { "type": "bytes32" }, - { "type": "bytes" }, - { "type": "address" } - ] - }, - { - "type": "tuple", - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ] - }, - { "type": "bytes", "name": "_reason", "internalType": "bytes" } - ] - }, - { - "type": "event", - "name": "Challenged", - "inputs": [ - { "type": "bytes32", "name": "containerHash", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true }, - { "type": "bytes", "name": "reason", "indexed": false }, - { "type": "uint256", "name": "resolverId", "indexed": false }, - { - "type": "tuple", - "name": "collateral", - "indexed": false, - "components": [{ "type": "address" }, { "type": "uint256" }] - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Configured", - "inputs": [ - { "type": "bytes32", "name": "configHash", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true }, - { - "type": "tuple", - "name": "config", - "indexed": false, - "components": [ - { "type": "uint256" }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { - "type": "tuple", - "components": [{ "type": "address" }, { "type": "uint256" }] - }, - { "type": "address" }, - { "type": "bytes" }, - { "type": "uint256" } - ] - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Executed", - "inputs": [ - { "type": "bytes32", "name": "containerHash", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Frozen", - "inputs": [ - { "type": "bytes4", "name": "role", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Granted", - "inputs": [ - { "type": "bytes4", "name": "role", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true }, - { "type": "address", "name": "who", "indexed": true }, - { "type": "address", "name": "oracle", "indexed": false } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Initialized", - "inputs": [{ "type": "string", "name": "key", "indexed": true }], - "anonymous": false - }, - { - "type": "event", - "name": "ReceivedCallback", - "inputs": [ - { "type": "bytes4", "name": "sig", "indexed": true }, - { "type": "bytes", "name": "data", "indexed": false } - ], - "anonymous": false - }, - { - "type": "event", - "name": "RegisteredCallback", - "inputs": [ - { "type": "bytes4", "name": "sig", "indexed": false }, - { "type": "bytes4", "name": "magicNumber", "indexed": false } - ], - "anonymous": false - }, - { - "type": "event", - "name": "RegisteredStandard", - "inputs": [{ "type": "bytes4", "name": "interfaceId", "indexed": false }], - "anonymous": false - }, - { - "type": "event", - "name": "Resolved", - "inputs": [ - { "type": "bytes32", "name": "containerHash", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true }, - { "type": "bool", "name": "approved", "indexed": false } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Revoked", - "inputs": [ - { "type": "bytes4", "name": "role", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true }, - { "type": "address", "name": "who", "indexed": true } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Ruled", - "inputs": [ - { "type": "address", "name": "arbitrator", "indexed": true }, - { "type": "uint256", "name": "disputeId", "indexed": true }, - { "type": "uint256", "name": "ruling", "indexed": false } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Scheduled", - "inputs": [ - { "type": "bytes32", "name": "containerHash", "indexed": true }, - { - "type": "tuple", - "name": "payload", - "indexed": false, - "components": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "address" }, - { "type": "address" }, - { - "type": "tuple[]", - "components": [ - { "type": "address" }, - { "type": "uint256" }, - { "type": "bytes" } - ] - }, - { "type": "bytes32" }, - { "type": "bytes" }, - { "type": "address" } - ] + "address": "0x8A33E3015F1a9aBdFd6822E218Eb725021D73EaC", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_aclRoot", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "challengeDeposit", + "type": "tuple" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "_initialConfig", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "containerHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "reason", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "resolverId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct ERC3000Data.Collateral", + "name": "collateral", + "type": "tuple" + } + ], + "name": "Challenged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "configHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "challengeDeposit", + "type": "tuple" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct ERC3000Data.Config", + "name": "config", + "type": "tuple" + } + ], + "name": "Configured", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "containerHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + } + ], + "name": "Executed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes4", + "name": "role", + "type": "bytes4" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + } + ], + "name": "Frozen", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes4", + "name": "role", + "type": "bytes4" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "who", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract IACLOracle", + "name": "oracle", + "type": "address" + } + ], + "name": "Granted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes4", + "name": "sig", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "ReceivedCallback", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes4", + "name": "sig", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "bytes4", + "name": "magicNumber", + "type": "bytes4" + } + ], + "name": "RegisteredCallback", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "RegisteredStandard", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "containerHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "Resolved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes4", + "name": "role", + "type": "bytes4" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "who", + "type": "address" + } + ], + "name": "Revoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IArbitrator", + "name": "arbitrator", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "disputeId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "ruling", + "type": "uint256" + } + ], + "name": "Ruled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "containerHash", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "submitter", + "type": "address" + }, + { + "internalType": "contract IERC3000Executor", + "name": "executor", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct ERC3000Data.Action[]", + "name": "actions", + "type": "tuple[]" + }, + { + "internalType": "bytes32", + "name": "allowFailuresMap", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "address", + "name": "challenger", + "type": "address" + } + ], + "indexed": false, + "internalType": "struct ERC3000Data.Payload", + "name": "payload", + "type": "tuple" + } + ], + "name": "Scheduled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "containerHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "reason", + "type": "bytes" + } + ], + "name": "Vetoed", + "type": "event" + }, + { + "inputs": [], + "name": "ROOT_ROLE", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum ACLData.BulkOp", + "name": "op", + "type": "uint8" + }, + { + "internalType": "bytes4", + "name": "role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + } + ], + "internalType": "struct ACLData.BulkItem[]", + "name": "items", + "type": "tuple[]" + } + ], + "name": "bulk", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "submitter", + "type": "address" + }, + { + "internalType": "contract IERC3000Executor", + "name": "executor", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct ERC3000Data.Action[]", + "name": "actions", + "type": "tuple[]" + }, + { + "internalType": "bytes32", + "name": "allowFailuresMap", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "address", + "name": "challenger", + "type": "address" + } + ], + "internalType": "struct ERC3000Data.Payload", + "name": "payload", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "challengeDeposit", + "type": "tuple" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "config", + "type": "tuple" + } + ], + "internalType": "struct ERC3000Data.Container", + "name": "_container", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "_reason", + "type": "bytes" + } + ], + "name": "challenge", + "outputs": [ + { + "internalType": "uint256", + "name": "disputeId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "challengerCache", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "configHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "challengeDeposit", + "type": "tuple" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "_config", + "type": "tuple" + } + ], + "name": "configure", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "contract IArbitrator", + "name": "", + "type": "address" + } + ], + "name": "disputeItemCache", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "submitter", + "type": "address" + }, + { + "internalType": "contract IERC3000Executor", + "name": "executor", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct ERC3000Data.Action[]", + "name": "actions", + "type": "tuple[]" + }, + { + "internalType": "bytes32", + "name": "allowFailuresMap", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "address", + "name": "challenger", + "type": "address" + } + ], + "internalType": "struct ERC3000Data.Payload", + "name": "payload", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "challengeDeposit", + "type": "tuple" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "config", + "type": "tuple" + } + ], + "internalType": "struct ERC3000Data.Container", + "name": "_container", + "type": "tuple" + } + ], + "name": "execute", + "outputs": [ + { + "internalType": "bytes32", + "name": "failureMap", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + } + ], + "name": "freeze", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + } + ], + "name": "grant", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + }, + { + "internalType": "contract IACLOracle", + "name": "_oracle", + "type": "address" + } + ], + "name": "grantWithOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "name": "initBlocks", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_aclRoot", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "challengeDeposit", + "type": "tuple" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "_initialConfig", + "type": "tuple" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + } + ], + "name": "isFrozen", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "queue", + "outputs": [ + { + "internalType": "enum GovernQueueStateLib.State", + "name": "state", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "submitter", + "type": "address" + }, + { + "internalType": "contract IERC3000Executor", + "name": "executor", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct ERC3000Data.Action[]", + "name": "actions", + "type": "tuple[]" + }, + { + "internalType": "bytes32", + "name": "allowFailuresMap", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "address", + "name": "challenger", + "type": "address" + } + ], + "internalType": "struct ERC3000Data.Payload", + "name": "payload", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "challengeDeposit", + "type": "tuple" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "config", + "type": "tuple" + } + ], + "internalType": "struct ERC3000Data.Container", + "name": "_container", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "_disputeId", + "type": "uint256" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes32", + "name": "failureMap", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_role", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "_who", + "type": "address" + } + ], + "name": "revoke", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "roles", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "submitter", + "type": "address" + }, + { + "internalType": "contract IERC3000Executor", + "name": "executor", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct ERC3000Data.Action[]", + "name": "actions", + "type": "tuple[]" + }, + { + "internalType": "bytes32", + "name": "allowFailuresMap", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "address", + "name": "challenger", + "type": "address" + } + ], + "internalType": "struct ERC3000Data.Payload", + "name": "payload", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "challengeDeposit", + "type": "tuple" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "config", + "type": "tuple" + } + ], + "internalType": "struct ERC3000Data.Container", + "name": "_container", + "type": "tuple" + } + ], + "name": "schedule", + "outputs": [ + { + "internalType": "bytes32", + "name": "containerHash", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "submitter", + "type": "address" + }, + { + "internalType": "contract IERC3000Executor", + "name": "executor", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct ERC3000Data.Action[]", + "name": "actions", + "type": "tuple[]" + }, + { + "internalType": "bytes32", + "name": "allowFailuresMap", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "address", + "name": "challenger", + "type": "address" + } + ], + "internalType": "struct ERC3000Data.Payload", + "name": "payload", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "executionDelay", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "scheduleDeposit", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Collateral", + "name": "challengeDeposit", + "type": "tuple" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "rules", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxCalldataSize", + "type": "uint256" + } + ], + "internalType": "struct ERC3000Data.Config", + "name": "config", + "type": "tuple" + } + ], + "internalType": "struct ERC3000Data.Container", + "name": "_container", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "_reason", + "type": "bytes" + } + ], + "name": "veto", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Vetoed", - "inputs": [ - { "type": "bytes32", "name": "containerHash", "indexed": true }, - { "type": "address", "name": "actor", "indexed": true }, - { "type": "bytes", "name": "reason", "indexed": false } - ], - "anonymous": false - } - ] -} + ] +} \ No newline at end of file diff --git a/packages/hardhat/hardhat.config.ts b/packages/hardhat/hardhat.config.ts index d762425b..f0e3da85 100644 --- a/packages/hardhat/hardhat.config.ts +++ b/packages/hardhat/hardhat.config.ts @@ -1,20 +1,17 @@ import { config as dotenvConfig } from "dotenv"; -import "solidity-coverage"; import "hardhat-deploy"; -import { utils } from "ethers"; import fs from "fs"; import chalk from "chalk"; -import "@nomiclabs/hardhat-waffle"; -import "@eth-optimism/hardhat-ovm"; -import "@nomiclabs/hardhat-web3"; import "@tenderly/hardhat-tenderly"; import "@nomiclabs/hardhat-etherscan"; +import "@openzeppelin/hardhat-upgrades"; +import "@nomiclabs/hardhat-ethers"; import "hardhat-typechain"; +import "typechain"; +import "solidity-coverage"; import { task, HardhatUserConfig, types } from "hardhat/config"; import { HttpNetworkUserConfig } from "hardhat/types"; import { resolve } from "path"; -import { HardhatNetworkAccountsUserConfig } from "../../node_modules/hardhat/src/types/config"; -import deployQuestFactory from "./deploy/deploy-quest_factory"; import deployQuest from "./deploy/deploy-quest"; import deployGovernQueue, { generateQueueConfig, @@ -27,35 +24,23 @@ import exportContractResult from "./scripts/export-contract-result"; import GovernAbi from "./abi/contracts/Externals/Govern.json"; import GovernQueueAbi from "./abi/contracts/Externals/GovernQueue.json"; import CelesteMockGoerli from "./deployments/goerli/OwnableCeleste.json"; +import upgradeQuestFactory from "./scripts/upgrade-quest-factory"; dotenvConfig({ path: resolve( - __dirname, - fs - .readdirSync("../../") - .filter( - (allFilesPaths: string) => allFilesPaths.match(/\.env$/) !== null - )[0] + __dirname + "/../../", + fs.readdirSync("../../").filter((allFilesPaths: string) => { + let result = allFilesPaths.match(/\.env$/) !== null; + return result; + })[0] ), }); -const { isAddress, getAddress, formatUnits, parseUnits } = utils; - -/* - 📡 This is where you configure your deploy configuration for 🏗 scaffold-eth - - check out `packages/scripts/deploy.js` to customize your deployment - - out of the box it will auto deploy anything in the `contracts` folder and named *.sol - plus it will use *.args for constructor args -*/ - // // Select the network you want to deploy to here: // const defaultNetwork = "localhost"; const mainnetGwei = 21; - function mnemonic() { try { if (!process.env.MNEMONIC || !process.env.PRIVATE_KEY) @@ -72,7 +57,7 @@ function mnemonic() { return "test test test test test test test test test test test junk"; } -function getAccounts(): HardhatNetworkAccountsUserConfig { +function getAccounts() { if (process.env.PRIVATE_KEY) { return [process.env.PRIVATE_KEY as any]; } @@ -124,6 +109,7 @@ const hardhatConfig: HardhatUserConfig = { chainId: 5, url: "https://eth-goerli.g.alchemy.com/v2/E6EdrejZ7PPswowaPl3AfLkdFGEXm1PJ", accounts: getAccounts(), + gasPrice: 20000000000, // 20 Gwei }, xdai: { chainId: 100, @@ -163,7 +149,6 @@ const hardhatConfig: HardhatUserConfig = { url: "https://kovan.optimism.io", gasPrice: 0, accounts: getAccounts(), - ovm: true, companionNetworks: { l1: "kovan", }, @@ -172,7 +157,6 @@ const hardhatConfig: HardhatUserConfig = { url: "http://localhost:8545", gasPrice: 0, accounts: getAccounts(), - ovm: true, companionNetworks: { l1: "localOptimismL1", }, @@ -222,7 +206,7 @@ const hardhatConfig: HardhatUserConfig = { version: "0.5.8", }, { - version: "0.8.1", + version: "0.8.2", settings: { optimizer: { enabled: true, @@ -232,11 +216,11 @@ const hardhatConfig: HardhatUserConfig = { }, ], }, - ovm: { - solcVersion: "0.7.6", - }, etherscan: { - apiKey: process.env.ETHERSCAN_API_KEY, + // @ts-ignore + apiKey: { + goerli: process.env.ETHERSCAN_API_KEY, + }, }, namedAccounts: { deployer: { @@ -255,6 +239,10 @@ const hardhatConfig: HardhatUserConfig = { goerli: defaultConfig.RootOwner.goerli, }, // Goerli Gnosis Safe address }, + typechain: { + outDir: "typechain", + target: "ethers-v5", + }, }; const DEBUG = false; @@ -303,7 +291,8 @@ task("fundedwallet", "Create a wallet (pk) link and fund it with deployer?") // IF NOT SEND USING LOCAL HARDHAT NODE: if (localDeployerMnemonic) { let deployerWallet = ethers.Wallet.fromMnemonic(localDeployerMnemonic); - deployerWallet = deployerWallet.connect(ethers.provider); + const signers = await ethers.getSigners(); + deployerWallet = deployerWallet.connect(signers[0].provider); console.log( "💵 Sending " + amount + @@ -485,8 +474,8 @@ task( ); async function addr(ethers, addr) { - if (isAddress(addr)) { - return getAddress(addr); + if (ethers.isAddress(addr)) { + return ethers.getAddress(addr); } const accounts = await ethers.provider.listAccounts(); if (accounts[addr] !== undefined) { @@ -496,7 +485,7 @@ async function addr(ethers, addr) { } task("accounts", "Prints the list of accounts", async (_, { ethers }) => { - const accounts = await ethers.provider.listAccounts(); + const accounts = await ethers.getSigners(); accounts.forEach((account) => console.log(account)); }); @@ -511,7 +500,7 @@ task("balance", "Prints an account's balance") const balance = await ethers.provider.getBalance( await addr(ethers, taskArgs.account) ); - console.log(formatUnits(balance, "ether"), "ETH"); + console.log(ethers.utils.formatUnits(balance, "ether"), "ETH"); }); function send(signer, txparams) { @@ -542,19 +531,19 @@ task("send", "Send ETH") to = await addr(ethers, taskArgs.to); debug(`Normalized to address: ${to}`); } - + var signerAddress = await fromSigner.getAddress(); const txRequest = { - from: await fromSigner.getAddress(), + from: signerAddress, to, - value: parseUnits( + value: ethers.utils.parseUnits( taskArgs.amount ? taskArgs.amount : "0", "ether" - ).toHexString(), - nonce: await fromSigner.getTransactionCount(), - gasPrice: parseUnits( + ), + nonce: await ethers.provider.getTransactionCount(signerAddress), + gasPrice: ethers.utils.parseUnits( taskArgs.gasPrice ? taskArgs.gasPrice : "1.001", "gwei" - ).toHexString(), + ), gasLimit: taskArgs.gasLimit ? taskArgs.gasLimit : 24000, chainId: network.config.chainId, data: undefined, @@ -815,37 +804,16 @@ task("newQuestFactory:gnosis") "Address of the govern", governGnosis.address ) - .addOptionalParam( - "initialOwner", - "Initial owner of the QuestFactory (will be able to change deposits)" - ) - .addOptionalParam( - "createDepositToken", - "Address of the create quest deposit (default is HNY)", - defaultConfig.CreateQuestDeposit.xdai.token - ) - .addOptionalParam( - "createDepositAmount", - "Amount of the quest create deposit token", - defaultConfig.CreateQuestDeposit.xdai.amount, - types.float - ) - .addOptionalParam( - "playDepositToken", - "Address of the play quest deposit (default is HNY)", - defaultConfig.PlayQuestDeposit.xdai.token - ) - .addOptionalParam( - "playDepositAmount", - "Amount of the quest play deposit token", - defaultConfig.PlayQuestDeposit.xdai.amount, - types.float - ) .setAction(async (args, hre) => { - const deployResult = await deployQuestFactory(hre, args); + console.log("Starting by deploying the Quest template..."); + await hre.run("newQuest"); + + console.log("Deploying proxy upgrade for QuestFactory..."); + const address = await upgradeQuestFactory(hre, args); + console.log( - "Deployed quest factory (" + hre.network.name + "):", - deployResult.address + "Deployed proxy upgrade for QuestFactory (" + hre.network.name + "):", + address ); }); @@ -856,40 +824,16 @@ task("newQuestFactory:goerli") "Address of the govern", "0xe43217F71e496475660a3391FFbD1367e354e002" ) - .addOptionalParam( - "initialOwner", - "Initial owner of the QuestFactory (will be able to change deposits)", - defaultConfig.RootOwner.goerli - ) - .addOptionalParam( - "createDepositToken", - "Address of the create quest deposit", - defaultConfig.CreateQuestDeposit.goerli.token - ) - .addOptionalParam( - "createDepositAmount", - "Address of the govern", - defaultConfig.CreateQuestDeposit.goerli.amount, - types.float - ) - .addOptionalParam( - "playDepositToken", - "Address of the play quest deposit", - defaultConfig.PlayQuestDeposit.goerli.token - ) - .addOptionalParam( - "playDepositAmount", - "Address of the govern", - defaultConfig.PlayQuestDeposit.goerli.amount, - types.float - ) .setAction(async (args, hre) => { - console.log("Deploying QuestFactory..."); - const deployResult = await deployQuestFactory(hre, args); + console.log("Starting by deploying the Quest template..."); + await hre.run("newQuest", hre); + + console.log("Deploying proxy upgrade for QuestFactory..."); + const address = await upgradeQuestFactory(hre, args); console.log( - "Deployed QuestFactory (" + hre.network.name + "):", - deployResult.address + "Deployed proxy upgrade for QuestFactory (" + hre.network.name + "):", + address ); }); @@ -898,7 +842,7 @@ task("newQuest") .setAction(async (hre) => { const deployResult = await deployQuest(hre); console.log( - "Deployed quest (" + hre.network.name + "):", + "Deployed quest template (" + hre.network.name + "):", deployResult.address ); }); @@ -1079,7 +1023,7 @@ task("deployAll:goerli") .setAction(deployAll); task("grantGovernQueue").setAction( - async (_args, { web3, getNamedAccounts }) => { + async (_args, { ethers, getNamedAccounts }) => { const { owner } = await getNamedAccounts(); const publicQueueFonctions = [ "schedule", @@ -1098,11 +1042,12 @@ task("grantGovernQueue").setAction( console.log("GovernQueue roles:"); const publicGrant = "0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF"; let roles = []; + var governQueueAbiInterface = new ethers.utils.Interface(GovernQueueAbi); for (const obj of GovernQueueAbi) { if (obj.type !== "function" || !queueFonctions.includes(obj.name)) { continue; } - let signature = web3.eth.abi.encodeFunctionSignature(obj as any); + let signature = governQueueAbiInterface.getSighash(obj.name); roles.push({ signature, address: ownerOnlyQueueFonctions.includes(obj.name) @@ -1116,11 +1061,12 @@ task("grantGovernQueue").setAction( `[${roles.map((x) => `[0,"${x.signature}","${x.address}"]`).join(",")}]` ); console.log("Govern roles:"); + var governAbiInterface = new ethers.utils.Interface(GovernAbi); for (const obj of GovernAbi) { if (obj.type !== "function" || !aclGovernFunctions.includes(obj.name)) { continue; } - let signature = web3.eth.abi.encodeFunctionSignature(obj as any); + let signature = governAbiInterface.getSighash(obj.name); roles.push({ signature, address: owner, diff --git a/packages/hardhat/package.json b/packages/hardhat/package.json index d5fa78b0..e700575c 100644 --- a/packages/hardhat/package.json +++ b/packages/hardhat/package.json @@ -3,54 +3,55 @@ "version": "1.0.0", "main": "index.js", "license": "MIT", - "devDependencies": { - "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.10", - "@types/chai": "^4.2.21", - "@types/mocha": "^9.0.0", - "@types/node": "^14.14.22", - "@types/ramda": "^0.27.38", - "chai": "^4.2.0", - "eslint-config-airbnb": "^18.2.0", - "eslint-config-prettier": "^6.11.0", - "eslint-plugin-babel": "^5.3.1", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-jsx-a11y": "^6.4.1", - "eslint-plugin-prettier": "^3.1.4", - "eslint-plugin-react": "^7.23.1", - "eslint-plugin-react-hooks": "^4.2.0", - "mocha": "^9.1.1", - "prettier": "^2.3.1", - "prettier-plugin-solidity": "^1.0.0-beta.14", - "ts-generator": "^0.1.1", - "ts-node": "^10.2.1", - "typescript": "^4.2.2" - }, "dependencies": { "@eth-optimism/hardhat-ovm": "0.2.2", "@ethersproject/hardware-wallets": "^5.0.14", "@ethersproject/solidity": "^5.0.9", "@nomicfoundation/hardhat-network-helpers": "^1.0.6", + "@nomiclabs/hardhat-ethers": "2.0.0", "@nomiclabs/hardhat-etherscan": "^3.1.0", "@nomiclabs/hardhat-waffle": "^2.0.0", "@nomiclabs/hardhat-web3": "^2.0.0", "@openzeppelin/contracts": "^4.9.2", + "@openzeppelin/contracts-upgradeable": "^4.9.3", + "@openzeppelin/hardhat-upgrades": "^1.0.0", "@tenderly/hardhat-tenderly": "1.0.10", "@typechain/ethers-v5": "^5.0.0", + "@types/chai": "^4.2.21", + "@types/mocha": "^9.0.0", + "@types/node": "^14.14.22", + "@types/ramda": "^0.27.38", + "chai": "^4.2.0", "chalk": "^4.1.0", "cross-var": "^1.1.0", "dotenv": "^10.0.0", "dotenv-cli": "^4.0.0", + "eslint-config-airbnb": "^18.2.0", + "eslint-config-prettier": "^6.11.0", + "eslint-plugin-babel": "^5.3.1", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-jsx-a11y": "^6.4.1", + "eslint-plugin-prettier": "^3.1.4", + "eslint-plugin-react": "^7.23.1", + "eslint-plugin-react-hooks": "^4.2.0", "ethereum-waffle": "^3.4.0", - "ethers": "^5.4.6", + "ethers": "^5.0.0", "ganache-cli": "^6.12.2", - "hardhat": "2.9.5", + "hardhat": "2.17.0", "hardhat-deploy": "^0.9.0", "hardhat-typechain": "^0.3.5", + "mocha": "^9.1.1", "node-watch": "^0.7.0", + "prettier": "^2.3.1", + "prettier-plugin-solidity": "^1.0.0-beta.14", "qrcode-terminal": "^0.12.0", "ramda": "^0.27.1", - "solidity-coverage": "0.8.2", - "typechain": "^4.0.0" + "solidity-coverage": "0.8.4", + "ts-generator": "^0.1.1", + "ts-node": "^10.2.1", + "typechain": "^4.0.0", + "typechain-target-ethers-v5": "^5.0.1", + "typescript": "^4.2.2" }, "scripts": { "chain": "hardhat node --hostname 0.0.0.0 --network hardhat --no-deploy --show-accounts", @@ -70,6 +71,8 @@ "queue-grant:gnosis": "hardhat grantGovernQueue --network xdai", "queue-grant:goerli": "hardhat grantGovernQueue --network goerli", "deploy-all:local": "hardhat deployAll:goerli", + "deploy-questFactory:goerli": "hardhat newQuestFactory:goerli --network goerli", + "deploy-questFactory:gnosis": "hardhat newQuestFactory:gnosis --network xdai", "console": "hardhat console", "watch": "node scripts/watch.js", "accounts": "hardhat accounts", diff --git a/packages/hardhat/scripts/deploy-govern_queue.ts b/packages/hardhat/scripts/deploy-govern_queue.ts index a10008bc..126c483c 100644 --- a/packages/hardhat/scripts/deploy-govern_queue.ts +++ b/packages/hardhat/scripts/deploy-govern_queue.ts @@ -1,7 +1,6 @@ import GovernQueueFactoryAbi from "../abi/contracts/Externals/GovernQueueFactory.json"; import { HardhatRuntimeEnvironment, Network } from "hardhat/types"; -import fs from "fs"; -import { BigNumber, ethers } from "ethers"; +import { ethers } from "ethers"; import exportContractResult from "./export-contract-result"; import GovernQueueAbi from "../abi/contracts/Externals/GovernQueue.json"; diff --git a/packages/hardhat/scripts/upgrade-quest-factory.ts b/packages/hardhat/scripts/upgrade-quest-factory.ts new file mode 100644 index 00000000..d1ec909a --- /dev/null +++ b/packages/hardhat/scripts/upgrade-quest-factory.ts @@ -0,0 +1,65 @@ +import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { buildQuestFactoryConstructorArguments } from "../deploy/deploy-quest_factory"; +import exportContractResult from "../scripts/export-contract-result"; + +export default async function upgradeQuestFactory( + { + network, + ethers, + upgrades, + getNamedAccounts, + run, + }: HardhatRuntimeEnvironment, + args?: { + governAddress: string; + createDepositToken: string; + createDepositAmount: number; + playDepositToken: string; + playDepositAmount: number; + } +) { + const QuestFactoryProxy = require(`../deployments/${network.name}/QuestFactory.json`); + const abi = + require(`../artifacts/contracts/QuestFactory.sol/QuestFactory.json`).abi; + + const constructorArguments = buildQuestFactoryConstructorArguments({ + getNamedAccounts, + args, + network, + ethers, + }); + + const contractFactory = await ethers.getContractFactory("QuestFactory"); + const newContractUpgrade = await upgrades.upgradeProxy( + QuestFactoryProxy.address, + contractFactory + ); + newContractUpgrade.deployed(); + + console.log({ constructorArguments }); + + try { + console.log("Verifying QuestFactory..."); + await new Promise((res, rej) => { + setTimeout( + () => + run("verify:verify", { + address: newContractUpgrade.address, + constructorArguments: [], + }) + .then(res) + .catch(rej), + 30000 + ); // Wait for contract to be deployed + }); + } catch (error) { + console.error("Failed when verifying the Quest contract", error); + } + + exportContractResult(network, "QuestFactory", { + address: QuestFactoryProxy.address, + abi: abi, + }); + + return newContractUpgrade.address; +} diff --git a/packages/hardhat/subgraph.yaml b/packages/hardhat/subgraph.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/hardhat/test/Quest.test.ts b/packages/hardhat/test/Quest.test.ts index fa1ff278..b71611e6 100644 --- a/packages/hardhat/test/Quest.test.ts +++ b/packages/hardhat/test/Quest.test.ts @@ -1,4 +1,3 @@ -// @ts-ignore import { ethers, network } from "hardhat"; import { use, expect } from "chai"; import { solidity } from "ethereum-waffle"; @@ -9,8 +8,8 @@ import { fromNumber, } from "./test-helper"; import { TokenMock, TokenMock__factory } from "../typechain"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signers"; import { time } from "@nomicfoundation/hardhat-network-helpers"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; use(solidity); @@ -734,6 +733,39 @@ describe("[Contract] Quest", function () { // Assert await expect(act()).to.be.revertedWith("ERROR: Player already exists"); }); + it("SHOULD revert if it's a whitelisted quest", async () => { + // Arrange + const quest = await deployQuest( + "fakeTitle", + "0x", + rewardToken, + epochNow + 3600, // in 1 hour + govern.address, + creator.address, + fromNumber(0), + createDepositToken, + depositAmount, + playDepositToken, + depositAmount, + creator, + 0, + true + ); + const playerInitialBalance = fromNumber(1000); + await playDepositToken + .connect(player) + .mint(player.address, playerInitialBalance); + await playDepositToken + .connect(player) + .approve(quest.address, depositAmount); + // Act + const act = () => quest.connect(player).play(player.address); + + // Assert + await expect(act()).to.be.revertedWith( + "ERROR: Can't self register and play a whitelisted Quest" + ); + }); }); describe("unplay()", () => { @@ -869,6 +901,155 @@ describe("[Contract] Quest", function () { // Assert await expect(act()).to.be.revertedWith("ERROR: player not in list"); }); + it("SHOULD revert WHEN quest is whitelisted", async () => { + // Arrange + const quest = await deployQuest( + "fakeTitle", + "0x", + rewardToken, + epochNow + 3600, // in 1 hour + govern.address, + creator.address, + fromNumber(0), + createDepositToken, + depositAmount, + playDepositToken, + depositAmount, + creator, + 0, + true + ); + const playerInitialBalance = fromNumber(1000); + await playDepositToken + .connect(player) + .mint(player.address, playerInitialBalance); + await playDepositToken + .connect(player) + .approve(quest.address, depositAmount); + + // Act + const act = () => quest.connect(player).unplay(player.address); + + // Assert + await expect(act()).to.be.revertedWith( + "ERROR: can't unplay a whitelisted quest" + ); + }); + }); + describe("constructor()", () => { + it("SHOULD revert if max players greater than 0 and isWhiteList", async () => { + //Arrange + const maxPlayers = 3; + + //Act + const act = () => + deployQuest( + "fakeTitle", + "0x", + rewardToken, + epochNow + 3600, // in 1 hour + govern.address, + creator.address, + fromNumber(0), + createDepositToken, + depositAmount, + playDepositToken, + depositAmount, + creator, + maxPlayers, + true + ); + //Assert + await expect(act()).to.be.revertedWith( + "ERROR: Can't create a whiteListed quest with max players greater than 0 (infinity)" + ); + }); + }); + describe("setWhiteList()", () => { + it("SHOULD set the player list to the one in the parameters", async () => { + //Arrange + const quest = await deployQuest( + "fakeTitle", + "0x", + rewardToken, + epochNow + 3600, // in 1 hour + govern.address, + creator.address, + fromNumber(0), + createDepositToken, + depositAmount, + playDepositToken, + depositAmount, + creator, + 0, + true + ); + //Act + const act = () => + quest.connect(creator).setWhiteList([player.address, other.address]); + //Assert + await expect(act()).to.emit(quest, "QuestWhiteListChanged"); + expect(await quest.getPlayers()).to.deep.eq([ + player.address, + other.address, + ]); + expect(await quest.canExecute(player.address)).to.eq(true); + expect(await quest.canExecute(other.address)).to.eq(true); + }); + it("SHOULD revert if one or more players is already in list", async () => { + //Arrange + const quest = await deployQuest( + "fakeTitle", + "0x", + rewardToken, + epochNow + 3600, // in 1 hour + govern.address, + creator.address, + fromNumber(0), + createDepositToken, + depositAmount, + playDepositToken, + depositAmount, + creator, + 0, + true + ); + //Act + await quest.connect(creator).setWhiteList([player.address, other.address]); + const act = async () => + await quest.connect(creator).setWhiteList([player.address]); + //Assert + await expect(act()).to.be.revertedWith( + "ERROR: One or more players is already in whitelist" + ); + }); + it("SHOULD revert if it's not a whitelisted quest", async () => { + //Arrange + const quest = await deployQuest( + "fakeTitle", + "0x", + rewardToken, + epochNow + 3600, // in 1 hour + govern.address, + creator.address, + fromNumber(0), + createDepositToken, + depositAmount, + playDepositToken, + depositAmount, + creator, + 0, + false + ); + //Act + const act = () => + quest.connect(creator).setWhiteList([player.address, other.address]); + + //Assert + await expect(act()).to.be.revertedWith( + "ERROR: Can't set the white list to a non-whitelisted contract" + ); + }); }); describe("getPlayers()", () => { diff --git a/packages/hardhat/test/QuestFactory.test.ts b/packages/hardhat/test/QuestFactory.test.ts index b14a815d..76b02811 100644 --- a/packages/hardhat/test/QuestFactory.test.ts +++ b/packages/hardhat/test/QuestFactory.test.ts @@ -1,4 +1,4 @@ -import { ethers } from "hardhat"; +import { ethers, upgrades } from "hardhat"; import { use, expect } from "chai"; import { solidity } from "ethereum-waffle"; import { @@ -8,8 +8,8 @@ import { TokenMock, TokenMock__factory, } from "../typechain"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signers"; import { extractQuestAddressFromTransaction, fromNumber } from "./test-helper"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; use(solidity); @@ -27,21 +27,6 @@ describe("[Contract] QuestFactory", function () { [owner, stranger] = await ethers.getSigners(); }); - it("SHOULD transfer ownership WHEN initialOwner is different than deployer", async function () { - // Arrange - // Act - questFactoryContract = await new QuestFactory__factory(owner).deploy( - owner.address, - createDepositToken.address, - depositAmount, - playDepositToken.address, - depositAmount, - stranger.address - ); - // Assert - expect(await questFactoryContract.owner()).to.equal(stranger.address); - }); - beforeEach(async function () { const tokenMockFactory = new TokenMock__factory(owner); rewardToken = await tokenMockFactory.deploy("Reward Token", "RTOKEN"); @@ -54,250 +39,280 @@ describe("[Contract] QuestFactory", function () { "PDTOKEN" ); otherToken = await tokenMockFactory.deploy("Other Token", "OTOKEN"); - questFactoryContract = await new QuestFactory__factory(owner).deploy( - owner.address, - createDepositToken.address, - depositAmount, - playDepositToken.address, - depositAmount, - owner.address - ); await createDepositToken .connect(owner) .mint(owner.address, fromNumber(1000)); }); - it("SHOULD set the owner address correctly", async function () { - expect(!!owner.address).to.eq(true); // truthy - }); - - describe("createQuest()", function () { - it("SHOULD emit QuestCreated", async function () { - // Arrange - const title = "title"; - const detailIPFS = "0x"; - const expireTime = 0; // Unix Epoch 0 - const maxPlayers = 1; - await createDepositToken - .connect(owner) - .approve(questFactoryContract.address, depositAmount); - - // Act - // Assert - expect( - await questFactoryContract.createQuest( - title, - detailIPFS, - rewardToken.address, - expireTime, - owner.address, - maxPlayers - ) - ).to.emit(questFactoryContract, "QuestCreated"); - }); - - it("SHOULD collect deposit and transfer to new quests", async () => { - // Arrange - const title = "title"; - const detailIPFS = "0x"; - const expireTime = 0; // Unix Epoch 0 - const maxPlayers = 1; - - await createDepositToken - .connect(owner) - .approve(questFactoryContract.address, depositAmount); - - // Act - const newQuestAddress = await extractQuestAddressFromTransaction( - await questFactoryContract.createQuest( - title, - detailIPFS, - rewardToken.address, - expireTime, - owner.address, - maxPlayers - ) + describe("Methods", () => { + beforeEach(async function () { + const contractFactory = await ethers.getContractFactory( + "QuestFactory", + owner ); - - // Assert - expect(await createDepositToken.balanceOf(newQuestAddress)).to.eq( + questFactoryContract = (await upgrades.deployProxy( + contractFactory, + [owner.address], + { + initializer: "initialize", + } + )) as QuestFactory; + questFactoryContract.setCreateDeposit( + createDepositToken.address, depositAmount ); + questFactoryContract.setPlayDeposit( + playDepositToken.address, + depositAmount + ); + await questFactoryContract.deployed(); }); - it("SHOULD revert WHEN creator didn't aproved enough funds", async () => { - // Arrange - const title = "title"; - const detailIPFS = "0x"; - const expireTime = 0; // Unix Epoch 0 - const maxPlayers = 1; - - await createDepositToken - .connect(owner) - .approve(questFactoryContract.address, depositAmount.div(2)); - // Act - const act = () => - questFactoryContract.createQuest( - title, - detailIPFS, - rewardToken.address, - expireTime, - owner.address, - maxPlayers - ); - - // Assert - await expect(act()).to.be.revertedWith("ERROR : Deposit bad allowance"); + it("SHOULD set the owner address correctly", async function () { + expect(!!owner.address).to.eq(true); // truthy }); - }); - describe("setCreateDeposit()", function () { - it("SHOULD emit CreateDepositChanged WHEN valid", async () => { - // Arrange - // Act - const act = () => - questFactoryContract + describe("createQuest()", function () { + it("SHOULD emit QuestCreated", async function () { + // Arrange + const title = "title"; + const detailIPFS = "0x"; + const expireTime = 0; // Unix Epoch 0 + const maxPlayers = 1; + const isWhiteList = false; + await createDepositToken .connect(owner) - .setCreateDeposit(otherToken.address, depositAmount); + .approve(questFactoryContract.address, depositAmount); - // Assert - expect(await act()).to.emit(questFactoryContract, "CreateDepositChanged"); - const [token, amount] = await questFactoryContract.createDeposit(); - expect(token).to.eq(otherToken.address); - expect(amount.eq(depositAmount)).to.eq(true); - }); + // Act + // Assert + expect( + await questFactoryContract.createQuest( + title, + detailIPFS, + rewardToken.address, + expireTime, + owner.address, + maxPlayers, + isWhiteList + ) + ).to.emit(questFactoryContract, "QuestCreated"); + }); - it("SHOULD revert WHEN not owner", async () => { - // Arrange - // Act - const act = () => - questFactoryContract - .connect(stranger) - .setCreateDeposit(otherToken.address, depositAmount); - // Assert - await expect(act()).to.be.revertedWith( - "Ownable: caller is not the owner" - ); - }); + it("SHOULD collect deposit and transfer to new quests", async () => { + // Arrange + const title = "title"; + const detailIPFS = "0x"; + const expireTime = 0; // Unix Epoch 0 + const maxPlayers = 1; + const isWhiteList = false; - it("already created quests SHOULD keep old deposit WHEN change deposit", async () => { - // Arrange - const maxPlayers = 1; - await createDepositToken - .connect(owner) - .approve(questFactoryContract.address, depositAmount); - const questAddress = await extractQuestAddressFromTransaction( - await questFactoryContract + await createDepositToken .connect(owner) - .createQuest( - "title", - "0x", + .approve(questFactoryContract.address, depositAmount); + + // Act + const newQuestAddress = await extractQuestAddressFromTransaction( + await questFactoryContract.createQuest( + title, + detailIPFS, rewardToken.address, - 0, + expireTime, owner.address, - maxPlayers + maxPlayers, + isWhiteList ) - ); - const quest = new Quest__factory(owner).attach(questAddress); - const otherDepositAmount = fromNumber(2); - // Act - await questFactoryContract - .connect(owner) - .setCreateDeposit(otherToken.address, otherDepositAmount); - // Assert - const [token, amount] = await quest.createDeposit(); - expect(token).to.eq(createDepositToken.address); - expect(amount.eq(depositAmount)).to.eq(true); - }); - }); + ); + + // Assert + expect(await createDepositToken.balanceOf(newQuestAddress)).to.eq( + depositAmount + ); + }); - describe("setPlayDeposit()", function () { - it("SHOULD emit PlayDepositChanged WHEN valid", async () => { - // Arrange - // Act - const act = () => - questFactoryContract + it("SHOULD revert WHEN creator didn't aproved enough funds", async () => { + // Arrange + const title = "title"; + const detailIPFS = "0x"; + const expireTime = 0; // Unix Epoch 0 + const maxPlayers = 1; + const isWhiteList = false; + + await createDepositToken .connect(owner) - .setPlayDeposit(otherToken.address, depositAmount); + .approve(questFactoryContract.address, depositAmount.div(2)); + // Act + const act = () => + questFactoryContract.createQuest( + title, + detailIPFS, + rewardToken.address, + expireTime, + owner.address, + maxPlayers, + isWhiteList + ); - // Assert - expect(await act()).to.emit(questFactoryContract, "PlayDepositChanged"); - const [token, amount] = await questFactoryContract.playDeposit(); - expect(token).to.eq(otherToken.address); - expect(amount.eq(depositAmount)).to.eq(true); + // Assert + await expect(act()).to.be.revertedWith("ERROR : Deposit bad allowance"); + }); }); - it("SHOULD revert WHEN not owner", async () => { - // Arrange - // Act - const act = () => - questFactoryContract - .connect(stranger) - .setPlayDeposit(otherToken.address, depositAmount); - // Assert - await expect(act()).to.be.revertedWith( - "Ownable: caller is not the owner" - ); - }); + describe("setCreateDeposit()", function () { + it("SHOULD emit CreateDepositChanged WHEN valid", async () => { + // Arrange + // Act + const act = () => + questFactoryContract + .connect(owner) + .setCreateDeposit(otherToken.address, depositAmount); + + // Assert + expect(await act()).to.emit( + questFactoryContract, + "CreateDepositChanged" + ); + const [token, amount] = await questFactoryContract.createDeposit(); + expect(token).to.eq(otherToken.address); + expect(amount.eq(depositAmount)).to.eq(true); + }); + + it("SHOULD revert WHEN not owner", async () => { + // Arrange + // Act + const act = () => + questFactoryContract + .connect(stranger) + .setCreateDeposit(otherToken.address, depositAmount); + // Assert + await expect(act()).to.be.revertedWith( + "Ownable: caller is not the owner" + ); + }); - it("already created quests SHOULD keep old deposit WHEN change deposit", async () => { - // Arrange - const maxPlayers = 1; - await createDepositToken - .connect(owner) - .approve(questFactoryContract.address, depositAmount); - const questAddress = await extractQuestAddressFromTransaction( + it("already created quests SHOULD keep old deposit WHEN change deposit", async () => { + // Arrange + const maxPlayers = 1; + const isWhiteList = false; + await createDepositToken + .connect(owner) + .approve(questFactoryContract.address, depositAmount); + const questAddress = await extractQuestAddressFromTransaction( + await questFactoryContract + .connect(owner) + .createQuest( + "title", + "0x", + rewardToken.address, + 0, + owner.address, + maxPlayers, + isWhiteList + ) + ); + const quest = new Quest__factory(owner).attach(questAddress); + const otherDepositAmount = fromNumber(2); + // Act await questFactoryContract .connect(owner) - .createQuest( - "title", - "0x", - rewardToken.address, - 0, - owner.address, - maxPlayers - ) - ); - const quest = new Quest__factory(owner).attach(questAddress); - const otherDepositAmount = fromNumber(2); - // Act - await questFactoryContract - .connect(owner) - .setPlayDeposit(otherToken.address, otherDepositAmount); - // Assert - const [token, amount] = await quest.playDeposit(); - expect(token).to.eq(playDepositToken.address); - expect(amount.eq(depositAmount)).to.eq(true); + .setCreateDeposit(otherToken.address, otherDepositAmount); + // Assert + const [token, amount] = await quest.createDeposit(); + expect(token).to.eq(createDepositToken.address); + expect(amount.eq(depositAmount)).to.eq(true); + }); }); - }); - describe("setAragonGovernAddress()", function () { - it("SHOULD set AragonGovernAddress WHEN valid", async () => { - // Arrange - const newGovernAddress = "0x0000000000000000000000000000000000000001"; - // Act - await questFactoryContract - .connect(owner) - .setAragonGovernAddress(newGovernAddress); + describe("setPlayDeposit()", function () { + it("SHOULD emit PlayDepositChanged WHEN valid", async () => { + // Arrange + // Act + const act = () => + questFactoryContract + .connect(owner) + .setPlayDeposit(otherToken.address, depositAmount); - // Assert - expect(await questFactoryContract.aragonGovernAddress()).to.eq( - newGovernAddress - ); + // Assert + expect(await act()).to.emit(questFactoryContract, "PlayDepositChanged"); + const [token, amount] = await questFactoryContract.playDeposit(); + expect(token).to.eq(otherToken.address); + expect(amount.eq(depositAmount)).to.eq(true); + }); + + it("SHOULD revert WHEN not owner", async () => { + // Arrange + // Act + const act = () => + questFactoryContract + .connect(stranger) + .setPlayDeposit(otherToken.address, depositAmount); + // Assert + await expect(act()).to.be.revertedWith( + "Ownable: caller is not the owner" + ); + }); + + it("already created quests SHOULD keep old deposit WHEN change deposit", async () => { + // Arrange + const maxPlayers = 1; + const isWhiteList = false; + await createDepositToken + .connect(owner) + .approve(questFactoryContract.address, depositAmount); + const questAddress = await extractQuestAddressFromTransaction( + await questFactoryContract + .connect(owner) + .createQuest( + "title", + "0x", + rewardToken.address, + 0, + owner.address, + maxPlayers, + isWhiteList + ) + ); + const quest = new Quest__factory(owner).attach(questAddress); + const otherDepositAmount = fromNumber(2); + // Act + await questFactoryContract + .connect(owner) + .setPlayDeposit(otherToken.address, otherDepositAmount); + // Assert + const [token, amount] = await quest.playDeposit(); + expect(token).to.eq(playDepositToken.address); + expect(amount.eq(depositAmount)).to.eq(true); + }); }); - it("SHOULD revert WHEN not owner", async () => { - // Arrange - const newGovernAddress = "0x0000000000000000000000000000000000000001"; - // Act - const act = () => - questFactoryContract - .connect(stranger) + describe("setAragonGovernAddress()", function () { + it("SHOULD set AragonGovernAddress WHEN valid", async () => { + // Arrange + const newGovernAddress = "0x0000000000000000000000000000000000000001"; + // Act + await questFactoryContract + .connect(owner) .setAragonGovernAddress(newGovernAddress); - // Assert - await expect(act()).to.be.revertedWith( - "Ownable: caller is not the owner" - ); + + // Assert + expect(await questFactoryContract.aragonGovernAddress()).to.eq( + newGovernAddress + ); + }); + + it("SHOULD revert WHEN not owner", async () => { + // Arrange + const newGovernAddress = "0x0000000000000000000000000000000000000001"; + // Act + const act = () => + questFactoryContract + .connect(stranger) + .setAragonGovernAddress(newGovernAddress); + // Assert + await expect(act()).to.be.revertedWith( + "Ownable: caller is not the owner" + ); + }); }); }); }); diff --git a/packages/hardhat/test/test-helper.ts b/packages/hardhat/test/test-helper.ts index c26b5b6a..cd8b17c0 100644 --- a/packages/hardhat/test/test-helper.ts +++ b/packages/hardhat/test/test-helper.ts @@ -1,4 +1,4 @@ -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signers"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address"; import { BigNumber, ContractTransaction } from "ethers"; import { ethers } from "hardhat"; import { Address } from "hardhat-deploy/dist/types"; @@ -21,19 +21,25 @@ export const deployQuest = async ( playDepositToken: TokenMock, playDepositAmount: BigNumber, creator: SignerWithAddress, - maxPlayers: number = 0 + maxPlayers: number = 0, + isWhiteList: boolean = false ) => { const quest = await new Quest__factory(creator).deploy( title, detailIpfsHash, - rewardToken.address, - expireTime, - aragonGovernAddress, - fundsRecoveryAddress, + { token: createDepositToken.address, amount: createDepositAmount }, { token: playDepositToken.address, amount: playDepositAmount }, - creator.address, - maxPlayers + + { + questCreator: creator.address, + maxPlayers: maxPlayers, + rewardToken: rewardToken.address, + expireTime: expireTime, + aragonGovernAddress: aragonGovernAddress, + fundsRecoveryAddress: fundsRecoveryAddress, + isWhiteList: isWhiteList, + } ); await quest.deployed(); await rewardToken.connect(quest.signer).mint(quest.address, initialBalance); diff --git a/packages/hardhat/typechain/ContextUpgradeable.d.ts b/packages/hardhat/typechain/ContextUpgradeable.d.ts new file mode 100644 index 00000000..a27bd184 --- /dev/null +++ b/packages/hardhat/typechain/ContextUpgradeable.d.ts @@ -0,0 +1,52 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { + ethers, + EventFilter, + Signer, + BigNumber, + BigNumberish, + PopulatedTransaction, +} from "ethers"; +import { Contract, ContractTransaction } from "@ethersproject/contracts"; +import { BytesLike } from "@ethersproject/bytes"; +import { Listener, Provider } from "@ethersproject/providers"; +import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; + +interface ContextUpgradeableInterface extends ethers.utils.Interface { + functions: {}; + + events: { + "Initialized(uint8)": EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: "Initialized"): EventFragment; +} + +export class ContextUpgradeable extends Contract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + on(event: EventFilter | string, listener: Listener): this; + once(event: EventFilter | string, listener: Listener): this; + addListener(eventName: EventFilter | string, listener: Listener): this; + removeAllListeners(eventName: EventFilter | string): this; + removeListener(eventName: any, listener: Listener): this; + + interface: ContextUpgradeableInterface; + + functions: {}; + + callStatic: {}; + + filters: { + Initialized(version: null): EventFilter; + }; + + estimateGas: {}; + + populateTransaction: {}; +} diff --git a/packages/hardhat/typechain/Deposit.d.ts b/packages/hardhat/typechain/Deposit.d.ts deleted file mode 100644 index aff74ab7..00000000 --- a/packages/hardhat/typechain/Deposit.d.ts +++ /dev/null @@ -1,198 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { - ethers, - EventFilter, - Signer, - BigNumber, - BigNumberish, - PopulatedTransaction, -} from "ethers"; -import { - Contract, - ContractTransaction, - Overrides, - CallOverrides, -} from "@ethersproject/contracts"; -import { BytesLike } from "@ethersproject/bytes"; -import { Listener, Provider } from "@ethersproject/providers"; -import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; - -interface DepositInterface extends ethers.utils.Interface { - functions: { - "amount()": FunctionFragment; - "collectFrom(address)": FunctionFragment; - "releaseTo(address)": FunctionFragment; - "token()": FunctionFragment; - }; - - encodeFunctionData(functionFragment: "amount", values?: undefined): string; - encodeFunctionData(functionFragment: "collectFrom", values: [string]): string; - encodeFunctionData(functionFragment: "releaseTo", values: [string]): string; - encodeFunctionData(functionFragment: "token", values?: undefined): string; - - decodeFunctionResult(functionFragment: "amount", data: BytesLike): Result; - decodeFunctionResult( - functionFragment: "collectFrom", - data: BytesLike - ): Result; - decodeFunctionResult(functionFragment: "releaseTo", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "token", data: BytesLike): Result; - - events: { - "Lock(address,address,uint256)": EventFragment; - "Unlock(address,address,uint256)": EventFragment; - }; - - getEvent(nameOrSignatureOrTopic: "Lock"): EventFragment; - getEvent(nameOrSignatureOrTopic: "Unlock"): EventFragment; -} - -export class Deposit extends Contract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - on(event: EventFilter | string, listener: Listener): this; - once(event: EventFilter | string, listener: Listener): this; - addListener(eventName: EventFilter | string, listener: Listener): this; - removeAllListeners(eventName: EventFilter | string): this; - removeListener(eventName: any, listener: Listener): this; - - interface: DepositInterface; - - functions: { - amount(overrides?: CallOverrides): Promise<[BigNumber]>; - - "amount()"(overrides?: CallOverrides): Promise<[BigNumber]>; - - collectFrom( - _from: string, - overrides?: Overrides - ): Promise; - - "collectFrom(address)"( - _from: string, - overrides?: Overrides - ): Promise; - - releaseTo(_to: string, overrides?: Overrides): Promise; - - "releaseTo(address)"( - _to: string, - overrides?: Overrides - ): Promise; - - token(overrides?: CallOverrides): Promise<[string]>; - - "token()"(overrides?: CallOverrides): Promise<[string]>; - }; - - amount(overrides?: CallOverrides): Promise; - - "amount()"(overrides?: CallOverrides): Promise; - - collectFrom( - _from: string, - overrides?: Overrides - ): Promise; - - "collectFrom(address)"( - _from: string, - overrides?: Overrides - ): Promise; - - releaseTo(_to: string, overrides?: Overrides): Promise; - - "releaseTo(address)"( - _to: string, - overrides?: Overrides - ): Promise; - - token(overrides?: CallOverrides): Promise; - - "token()"(overrides?: CallOverrides): Promise; - - callStatic: { - amount(overrides?: CallOverrides): Promise; - - "amount()"(overrides?: CallOverrides): Promise; - - collectFrom(_from: string, overrides?: CallOverrides): Promise; - - "collectFrom(address)"( - _from: string, - overrides?: CallOverrides - ): Promise; - - releaseTo(_to: string, overrides?: CallOverrides): Promise; - - "releaseTo(address)"(_to: string, overrides?: CallOverrides): Promise; - - token(overrides?: CallOverrides): Promise; - - "token()"(overrides?: CallOverrides): Promise; - }; - - filters: { - Lock(token: string | null, from: string | null, amount: null): EventFilter; - - Unlock(token: string | null, to: string | null, amount: null): EventFilter; - }; - - estimateGas: { - amount(overrides?: CallOverrides): Promise; - - "amount()"(overrides?: CallOverrides): Promise; - - collectFrom(_from: string, overrides?: Overrides): Promise; - - "collectFrom(address)"( - _from: string, - overrides?: Overrides - ): Promise; - - releaseTo(_to: string, overrides?: Overrides): Promise; - - "releaseTo(address)"( - _to: string, - overrides?: Overrides - ): Promise; - - token(overrides?: CallOverrides): Promise; - - "token()"(overrides?: CallOverrides): Promise; - }; - - populateTransaction: { - amount(overrides?: CallOverrides): Promise; - - "amount()"(overrides?: CallOverrides): Promise; - - collectFrom( - _from: string, - overrides?: Overrides - ): Promise; - - "collectFrom(address)"( - _from: string, - overrides?: Overrides - ): Promise; - - releaseTo( - _to: string, - overrides?: Overrides - ): Promise; - - "releaseTo(address)"( - _to: string, - overrides?: Overrides - ): Promise; - - token(overrides?: CallOverrides): Promise; - - "token()"(overrides?: CallOverrides): Promise; - }; -} diff --git a/packages/hardhat/typechain/DepositLib.d.ts b/packages/hardhat/typechain/DepositLib.d.ts deleted file mode 100644 index 9e8a1249..00000000 --- a/packages/hardhat/typechain/DepositLib.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { - ethers, - EventFilter, - Signer, - BigNumber, - BigNumberish, - PopulatedTransaction, -} from "ethers"; -import { - Contract, - ContractTransaction, - CallOverrides, -} from "@ethersproject/contracts"; -import { BytesLike } from "@ethersproject/bytes"; -import { Listener, Provider } from "@ethersproject/providers"; -import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; - -interface DepositLibInterface extends ethers.utils.Interface { - functions: { - "c_0x86fb8751(bytes32)": FunctionFragment; - }; - - encodeFunctionData( - functionFragment: "c_0x86fb8751", - values: [BytesLike] - ): string; - - decodeFunctionResult( - functionFragment: "c_0x86fb8751", - data: BytesLike - ): Result; - - events: {}; -} - -export class DepositLib extends Contract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - on(event: EventFilter | string, listener: Listener): this; - once(event: EventFilter | string, listener: Listener): this; - addListener(eventName: EventFilter | string, listener: Listener): this; - removeAllListeners(eventName: EventFilter | string): this; - removeListener(eventName: any, listener: Listener): this; - - interface: DepositLibInterface; - - functions: { - c_0x86fb8751( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise<[void]>; - - "c_0x86fb8751(bytes32)"( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise<[void]>; - }; - - c_0x86fb8751( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0x86fb8751(bytes32)"( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - - callStatic: { - c_0x86fb8751( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0x86fb8751(bytes32)"( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - }; - - filters: {}; - - estimateGas: { - c_0x86fb8751( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0x86fb8751(bytes32)"( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - }; - - populateTransaction: { - c_0x86fb8751( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0x86fb8751(bytes32)"( - c__0x86fb8751: BytesLike, - overrides?: CallOverrides - ): Promise; - }; -} diff --git a/packages/hardhat/typechain/DisputeManager.d.ts b/packages/hardhat/typechain/DisputeManager.d.ts deleted file mode 100644 index 58f294ae..00000000 --- a/packages/hardhat/typechain/DisputeManager.d.ts +++ /dev/null @@ -1,254 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { - ethers, - EventFilter, - Signer, - BigNumber, - BigNumberish, - PopulatedTransaction, -} from "ethers"; -import { - Contract, - ContractTransaction, - Overrides, - CallOverrides, -} from "@ethersproject/contracts"; -import { BytesLike } from "@ethersproject/bytes"; -import { Listener, Provider } from "@ethersproject/providers"; -import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; - -interface DisputeManagerInterface extends ethers.utils.Interface { - functions: { - "getDisputeFees()": FunctionFragment; - "computeRuling(uint256)": FunctionFragment; - "getDispute(uint256)": FunctionFragment; - }; - - encodeFunctionData( - functionFragment: "getDisputeFees", - values?: undefined - ): string; - encodeFunctionData( - functionFragment: "computeRuling", - values: [BigNumberish] - ): string; - encodeFunctionData( - functionFragment: "getDispute", - values: [BigNumberish] - ): string; - - decodeFunctionResult( - functionFragment: "getDisputeFees", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "computeRuling", - data: BytesLike - ): Result; - decodeFunctionResult(functionFragment: "getDispute", data: BytesLike): Result; - - events: {}; -} - -export class DisputeManager extends Contract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - on(event: EventFilter | string, listener: Listener): this; - once(event: EventFilter | string, listener: Listener): this; - addListener(eventName: EventFilter | string, listener: Listener): this; - removeAllListeners(eventName: EventFilter | string): this; - removeListener(eventName: any, listener: Listener): this; - - interface: DisputeManagerInterface; - - functions: { - getDisputeFees(overrides?: CallOverrides): Promise<[string, BigNumber]>; - - "getDisputeFees()"(overrides?: CallOverrides): Promise<[string, BigNumber]>; - - computeRuling( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - "computeRuling(uint256)"( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - getDispute( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise< - [string, number, number, number, BigNumber, BigNumber] & { - subject: string; - possibleRulings: number; - state: number; - finalRuling: number; - lastRoundId: BigNumber; - createTermId: BigNumber; - } - >; - - "getDispute(uint256)"( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise< - [string, number, number, number, BigNumber, BigNumber] & { - subject: string; - possibleRulings: number; - state: number; - finalRuling: number; - lastRoundId: BigNumber; - createTermId: BigNumber; - } - >; - }; - - getDisputeFees(overrides?: CallOverrides): Promise<[string, BigNumber]>; - - "getDisputeFees()"(overrides?: CallOverrides): Promise<[string, BigNumber]>; - - computeRuling( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - "computeRuling(uint256)"( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - getDispute( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise< - [string, number, number, number, BigNumber, BigNumber] & { - subject: string; - possibleRulings: number; - state: number; - finalRuling: number; - lastRoundId: BigNumber; - createTermId: BigNumber; - } - >; - - "getDispute(uint256)"( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise< - [string, number, number, number, BigNumber, BigNumber] & { - subject: string; - possibleRulings: number; - state: number; - finalRuling: number; - lastRoundId: BigNumber; - createTermId: BigNumber; - } - >; - - callStatic: { - getDisputeFees(overrides?: CallOverrides): Promise<[string, BigNumber]>; - - "getDisputeFees()"(overrides?: CallOverrides): Promise<[string, BigNumber]>; - - computeRuling( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise<[string, number] & { subject: string; finalRuling: number }>; - - "computeRuling(uint256)"( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise<[string, number] & { subject: string; finalRuling: number }>; - - getDispute( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise< - [string, number, number, number, BigNumber, BigNumber] & { - subject: string; - possibleRulings: number; - state: number; - finalRuling: number; - lastRoundId: BigNumber; - createTermId: BigNumber; - } - >; - - "getDispute(uint256)"( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise< - [string, number, number, number, BigNumber, BigNumber] & { - subject: string; - possibleRulings: number; - state: number; - finalRuling: number; - lastRoundId: BigNumber; - createTermId: BigNumber; - } - >; - }; - - filters: {}; - - estimateGas: { - getDisputeFees(overrides?: CallOverrides): Promise; - - "getDisputeFees()"(overrides?: CallOverrides): Promise; - - computeRuling( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - "computeRuling(uint256)"( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - getDispute( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise; - - "getDispute(uint256)"( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise; - }; - - populateTransaction: { - getDisputeFees(overrides?: CallOverrides): Promise; - - "getDisputeFees()"( - overrides?: CallOverrides - ): Promise; - - computeRuling( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - "computeRuling(uint256)"( - _disputeId: BigNumberish, - overrides?: Overrides - ): Promise; - - getDispute( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise; - - "getDispute(uint256)"( - _disputeId: BigNumberish, - overrides?: CallOverrides - ): Promise; - }; -} diff --git a/packages/hardhat/typechain/IERC20Permit.d.ts b/packages/hardhat/typechain/IERC20PermitUpgradeable.d.ts similarity index 97% rename from packages/hardhat/typechain/IERC20Permit.d.ts rename to packages/hardhat/typechain/IERC20PermitUpgradeable.d.ts index 086fc968..f0549518 100644 --- a/packages/hardhat/typechain/IERC20Permit.d.ts +++ b/packages/hardhat/typechain/IERC20PermitUpgradeable.d.ts @@ -20,7 +20,7 @@ import { BytesLike } from "@ethersproject/bytes"; import { Listener, Provider } from "@ethersproject/providers"; import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; -interface IERC20PermitInterface extends ethers.utils.Interface { +interface IERC20PermitUpgradeableInterface extends ethers.utils.Interface { functions: { "DOMAIN_SEPARATOR()": FunctionFragment; "nonces(address)": FunctionFragment; @@ -55,7 +55,7 @@ interface IERC20PermitInterface extends ethers.utils.Interface { events: {}; } -export class IERC20Permit extends Contract { +export class IERC20PermitUpgradeable extends Contract { connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; @@ -66,7 +66,7 @@ export class IERC20Permit extends Contract { removeAllListeners(eventName: EventFilter | string): this; removeListener(eventName: any, listener: Listener): this; - interface: IERC20PermitInterface; + interface: IERC20PermitUpgradeableInterface; functions: { DOMAIN_SEPARATOR(overrides?: CallOverrides): Promise<[string]>; diff --git a/packages/hardhat/typechain/IERC20Upgradeable.d.ts b/packages/hardhat/typechain/IERC20Upgradeable.d.ts new file mode 100644 index 00000000..9f8ca151 --- /dev/null +++ b/packages/hardhat/typechain/IERC20Upgradeable.d.ts @@ -0,0 +1,415 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { + ethers, + EventFilter, + Signer, + BigNumber, + BigNumberish, + PopulatedTransaction, +} from "ethers"; +import { + Contract, + ContractTransaction, + Overrides, + CallOverrides, +} from "@ethersproject/contracts"; +import { BytesLike } from "@ethersproject/bytes"; +import { Listener, Provider } from "@ethersproject/providers"; +import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; + +interface IERC20UpgradeableInterface extends ethers.utils.Interface { + functions: { + "allowance(address,address)": FunctionFragment; + "approve(address,uint256)": FunctionFragment; + "balanceOf(address)": FunctionFragment; + "totalSupply()": FunctionFragment; + "transfer(address,uint256)": FunctionFragment; + "transferFrom(address,address,uint256)": FunctionFragment; + }; + + encodeFunctionData( + functionFragment: "allowance", + values: [string, string] + ): string; + encodeFunctionData( + functionFragment: "approve", + values: [string, BigNumberish] + ): string; + encodeFunctionData(functionFragment: "balanceOf", values: [string]): string; + encodeFunctionData( + functionFragment: "totalSupply", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "transfer", + values: [string, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "transferFrom", + values: [string, string, BigNumberish] + ): string; + + decodeFunctionResult(functionFragment: "allowance", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "totalSupply", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "transfer", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "transferFrom", + data: BytesLike + ): Result; + + events: { + "Approval(address,address,uint256)": EventFragment; + "Transfer(address,address,uint256)": EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: "Approval"): EventFragment; + getEvent(nameOrSignatureOrTopic: "Transfer"): EventFragment; +} + +export class IERC20Upgradeable extends Contract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + on(event: EventFilter | string, listener: Listener): this; + once(event: EventFilter | string, listener: Listener): this; + addListener(eventName: EventFilter | string, listener: Listener): this; + removeAllListeners(eventName: EventFilter | string): this; + removeListener(eventName: any, listener: Listener): this; + + interface: IERC20UpgradeableInterface; + + functions: { + allowance( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + + "allowance(address,address)"( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + + approve( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "approve(address,uint256)"( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + "balanceOf(address)"( + account: string, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + + totalSupply(overrides?: CallOverrides): Promise<[BigNumber]>; + + "totalSupply()"(overrides?: CallOverrides): Promise<[BigNumber]>; + + transfer( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transfer(address,uint256)"( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transferFrom(address,address,uint256)"( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + }; + + allowance( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + "allowance(address,address)"( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + approve( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "approve(address,uint256)"( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise; + + "balanceOf(address)"( + account: string, + overrides?: CallOverrides + ): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + "totalSupply()"(overrides?: CallOverrides): Promise; + + transfer( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transfer(address,uint256)"( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transferFrom(address,address,uint256)"( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + callStatic: { + allowance( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + "allowance(address,address)"( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + approve( + spender: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + "approve(address,uint256)"( + spender: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise; + + "balanceOf(address)"( + account: string, + overrides?: CallOverrides + ): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + "totalSupply()"(overrides?: CallOverrides): Promise; + + transfer( + to: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + "transfer(address,uint256)"( + to: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + "transferFrom(address,address,uint256)"( + from: string, + to: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + }; + + filters: { + Approval( + owner: string | null, + spender: string | null, + value: null + ): EventFilter; + + Transfer(from: string | null, to: string | null, value: null): EventFilter; + }; + + estimateGas: { + allowance( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + "allowance(address,address)"( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + approve( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "approve(address,uint256)"( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise; + + "balanceOf(address)"( + account: string, + overrides?: CallOverrides + ): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + "totalSupply()"(overrides?: CallOverrides): Promise; + + transfer( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transfer(address,uint256)"( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transferFrom(address,address,uint256)"( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + }; + + populateTransaction: { + allowance( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + "allowance(address,address)"( + owner: string, + spender: string, + overrides?: CallOverrides + ): Promise; + + approve( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "approve(address,uint256)"( + spender: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + balanceOf( + account: string, + overrides?: CallOverrides + ): Promise; + + "balanceOf(address)"( + account: string, + overrides?: CallOverrides + ): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + "totalSupply()"(overrides?: CallOverrides): Promise; + + transfer( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transfer(address,uint256)"( + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + + "transferFrom(address,address,uint256)"( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides + ): Promise; + }; +} diff --git a/packages/hardhat/typechain/Initializable.d.ts b/packages/hardhat/typechain/Initializable.d.ts new file mode 100644 index 00000000..b90cd586 --- /dev/null +++ b/packages/hardhat/typechain/Initializable.d.ts @@ -0,0 +1,52 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { + ethers, + EventFilter, + Signer, + BigNumber, + BigNumberish, + PopulatedTransaction, +} from "ethers"; +import { Contract, ContractTransaction } from "@ethersproject/contracts"; +import { BytesLike } from "@ethersproject/bytes"; +import { Listener, Provider } from "@ethersproject/providers"; +import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; + +interface InitializableInterface extends ethers.utils.Interface { + functions: {}; + + events: { + "Initialized(uint8)": EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: "Initialized"): EventFragment; +} + +export class Initializable extends Contract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + on(event: EventFilter | string, listener: Listener): this; + once(event: EventFilter | string, listener: Listener): this; + addListener(eventName: EventFilter | string, listener: Listener): this; + removeAllListeners(eventName: EventFilter | string): this; + removeListener(eventName: any, listener: Listener): this; + + interface: InitializableInterface; + + functions: {}; + + callStatic: {}; + + filters: { + Initialized(version: null): EventFilter; + }; + + estimateGas: {}; + + populateTransaction: {}; +} diff --git a/packages/hardhat/typechain/Models.d.ts b/packages/hardhat/typechain/Models.d.ts deleted file mode 100644 index f09ad453..00000000 --- a/packages/hardhat/typechain/Models.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { - ethers, - EventFilter, - Signer, - BigNumber, - BigNumberish, - PopulatedTransaction, -} from "ethers"; -import { - Contract, - ContractTransaction, - CallOverrides, -} from "@ethersproject/contracts"; -import { BytesLike } from "@ethersproject/bytes"; -import { Listener, Provider } from "@ethersproject/providers"; -import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; - -interface ModelsInterface extends ethers.utils.Interface { - functions: { - "c_0xa9dfceef(bytes32)": FunctionFragment; - }; - - encodeFunctionData( - functionFragment: "c_0xa9dfceef", - values: [BytesLike] - ): string; - - decodeFunctionResult( - functionFragment: "c_0xa9dfceef", - data: BytesLike - ): Result; - - events: {}; -} - -export class Models extends Contract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - on(event: EventFilter | string, listener: Listener): this; - once(event: EventFilter | string, listener: Listener): this; - addListener(eventName: EventFilter | string, listener: Listener): this; - removeAllListeners(eventName: EventFilter | string): this; - removeListener(eventName: any, listener: Listener): this; - - interface: ModelsInterface; - - functions: { - c_0xa9dfceef( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise<[void]>; - - "c_0xa9dfceef(bytes32)"( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise<[void]>; - }; - - c_0xa9dfceef( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0xa9dfceef(bytes32)"( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - - callStatic: { - c_0xa9dfceef( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0xa9dfceef(bytes32)"( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - }; - - filters: {}; - - estimateGas: { - c_0xa9dfceef( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0xa9dfceef(bytes32)"( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - }; - - populateTransaction: { - c_0xa9dfceef( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - - "c_0xa9dfceef(bytes32)"( - c__0xa9dfceef: BytesLike, - overrides?: CallOverrides - ): Promise; - }; -} diff --git a/packages/hardhat/typechain/Ownable.d.ts b/packages/hardhat/typechain/OwnableUpgradeable.d.ts similarity index 93% rename from packages/hardhat/typechain/Ownable.d.ts rename to packages/hardhat/typechain/OwnableUpgradeable.d.ts index bfbe509a..a302233d 100644 --- a/packages/hardhat/typechain/Ownable.d.ts +++ b/packages/hardhat/typechain/OwnableUpgradeable.d.ts @@ -20,7 +20,7 @@ import { BytesLike } from "@ethersproject/bytes"; import { Listener, Provider } from "@ethersproject/providers"; import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi"; -interface OwnableInterface extends ethers.utils.Interface { +interface OwnableUpgradeableInterface extends ethers.utils.Interface { functions: { "owner()": FunctionFragment; "renounceOwnership()": FunctionFragment; @@ -48,13 +48,15 @@ interface OwnableInterface extends ethers.utils.Interface { ): Result; events: { + "Initialized(uint8)": EventFragment; "OwnershipTransferred(address,address)": EventFragment; }; + getEvent(nameOrSignatureOrTopic: "Initialized"): EventFragment; getEvent(nameOrSignatureOrTopic: "OwnershipTransferred"): EventFragment; } -export class Ownable extends Contract { +export class OwnableUpgradeable extends Contract { connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; @@ -65,7 +67,7 @@ export class Ownable extends Contract { removeAllListeners(eventName: EventFilter | string): this; removeListener(eventName: any, listener: Listener): this; - interface: OwnableInterface; + interface: OwnableUpgradeableInterface; functions: { owner(overrides?: CallOverrides): Promise<[string]>; @@ -126,6 +128,8 @@ export class Ownable extends Contract { }; filters: { + Initialized(version: null): EventFilter; + OwnershipTransferred( previousOwner: string | null, newOwner: string | null diff --git a/packages/hardhat/typechain/Quest.d.ts b/packages/hardhat/typechain/Quest.d.ts index df774282..7e0a4c44 100644 --- a/packages/hardhat/typechain/Quest.d.ts +++ b/packages/hardhat/typechain/Quest.d.ts @@ -31,6 +31,7 @@ interface QuestInterface extends ethers.utils.Interface { "fundsRecoveryAddress()": FunctionFragment; "getPlayers()": FunctionFragment; "isCreateDepositReleased()": FunctionFragment; + "isWhiteList()": FunctionFragment; "maxPlayers()": FunctionFragment; "play(address)": FunctionFragment; "playDeposit()": FunctionFragment; @@ -39,6 +40,7 @@ interface QuestInterface extends ethers.utils.Interface { "questTitle()": FunctionFragment; "recoverFundsAndDeposit()": FunctionFragment; "rewardToken()": FunctionFragment; + "setWhiteList(address[])": FunctionFragment; "unplay(address)": FunctionFragment; }; @@ -75,6 +77,10 @@ interface QuestInterface extends ethers.utils.Interface { functionFragment: "isCreateDepositReleased", values?: undefined ): string; + encodeFunctionData( + functionFragment: "isWhiteList", + values?: undefined + ): string; encodeFunctionData( functionFragment: "maxPlayers", values?: undefined @@ -104,6 +110,10 @@ interface QuestInterface extends ethers.utils.Interface { functionFragment: "rewardToken", values?: undefined ): string; + encodeFunctionData( + functionFragment: "setWhiteList", + values: [string[]] + ): string; encodeFunctionData(functionFragment: "unplay", values: [string]): string; decodeFunctionResult( @@ -127,6 +137,10 @@ interface QuestInterface extends ethers.utils.Interface { functionFragment: "isCreateDepositReleased", data: BytesLike ): Result; + decodeFunctionResult( + functionFragment: "isWhiteList", + data: BytesLike + ): Result; decodeFunctionResult(functionFragment: "maxPlayers", data: BytesLike): Result; decodeFunctionResult(functionFragment: "play", data: BytesLike): Result; decodeFunctionResult( @@ -150,17 +164,23 @@ interface QuestInterface extends ethers.utils.Interface { functionFragment: "rewardToken", data: BytesLike ): Result; + decodeFunctionResult( + functionFragment: "setWhiteList", + data: BytesLike + ): Result; decodeFunctionResult(functionFragment: "unplay", data: BytesLike): Result; events: { "QuestClaimed(bytes,address,uint256)": EventFragment; "QuestPlayed(address,uint256)": EventFragment; "QuestUnplayed(address,uint256)": EventFragment; + "QuestWhiteListChanged(address[],uint256)": EventFragment; }; getEvent(nameOrSignatureOrTopic: "QuestClaimed"): EventFragment; getEvent(nameOrSignatureOrTopic: "QuestPlayed"): EventFragment; getEvent(nameOrSignatureOrTopic: "QuestUnplayed"): EventFragment; + getEvent(nameOrSignatureOrTopic: "QuestWhiteListChanged"): EventFragment; } export class Quest extends Contract { @@ -250,6 +270,10 @@ export class Quest extends Contract { "isCreateDepositReleased()"(overrides?: CallOverrides): Promise<[boolean]>; + isWhiteList(overrides?: CallOverrides): Promise<[boolean]>; + + "isWhiteList()"(overrides?: CallOverrides): Promise<[boolean]>; + maxPlayers(overrides?: CallOverrides): Promise<[number]>; "maxPlayers()"(overrides?: CallOverrides): Promise<[number]>; @@ -291,6 +315,16 @@ export class Quest extends Contract { "rewardToken()"(overrides?: CallOverrides): Promise<[string]>; + setWhiteList( + _players: string[], + overrides?: Overrides + ): Promise; + + "setWhiteList(address[])"( + _players: string[], + overrides?: Overrides + ): Promise; + unplay( _player: string, overrides?: Overrides @@ -375,6 +409,10 @@ export class Quest extends Contract { "isCreateDepositReleased()"(overrides?: CallOverrides): Promise; + isWhiteList(overrides?: CallOverrides): Promise; + + "isWhiteList()"(overrides?: CallOverrides): Promise; + maxPlayers(overrides?: CallOverrides): Promise; "maxPlayers()"(overrides?: CallOverrides): Promise; @@ -416,6 +454,16 @@ export class Quest extends Contract { "rewardToken()"(overrides?: CallOverrides): Promise; + setWhiteList( + _players: string[], + overrides?: Overrides + ): Promise; + + "setWhiteList(address[])"( + _players: string[], + overrides?: Overrides + ): Promise; + unplay(_player: string, overrides?: Overrides): Promise; "unplay(address)"( @@ -497,6 +545,10 @@ export class Quest extends Contract { "isCreateDepositReleased()"(overrides?: CallOverrides): Promise; + isWhiteList(overrides?: CallOverrides): Promise; + + "isWhiteList()"(overrides?: CallOverrides): Promise; + maxPlayers(overrides?: CallOverrides): Promise; "maxPlayers()"(overrides?: CallOverrides): Promise; @@ -533,6 +585,13 @@ export class Quest extends Contract { "rewardToken()"(overrides?: CallOverrides): Promise; + setWhiteList(_players: string[], overrides?: CallOverrides): Promise; + + "setWhiteList(address[])"( + _players: string[], + overrides?: CallOverrides + ): Promise; + unplay(_player: string, overrides?: CallOverrides): Promise; "unplay(address)"( @@ -547,6 +606,8 @@ export class Quest extends Contract { QuestPlayed(player: null, timestamp: null): EventFilter; QuestUnplayed(player: null, timestamp: null): EventFilter; + + QuestWhiteListChanged(whiteListPlayers: null, timestamp: null): EventFilter; }; estimateGas: { @@ -604,6 +665,10 @@ export class Quest extends Contract { "isCreateDepositReleased()"(overrides?: CallOverrides): Promise; + isWhiteList(overrides?: CallOverrides): Promise; + + "isWhiteList()"(overrides?: CallOverrides): Promise; + maxPlayers(overrides?: CallOverrides): Promise; "maxPlayers()"(overrides?: CallOverrides): Promise; @@ -636,6 +701,13 @@ export class Quest extends Contract { "rewardToken()"(overrides?: CallOverrides): Promise; + setWhiteList(_players: string[], overrides?: Overrides): Promise; + + "setWhiteList(address[])"( + _players: string[], + overrides?: Overrides + ): Promise; + unplay(_player: string, overrides?: Overrides): Promise; "unplay(address)"( @@ -717,6 +789,10 @@ export class Quest extends Contract { overrides?: CallOverrides ): Promise; + isWhiteList(overrides?: CallOverrides): Promise; + + "isWhiteList()"(overrides?: CallOverrides): Promise; + maxPlayers(overrides?: CallOverrides): Promise; "maxPlayers()"(overrides?: CallOverrides): Promise; @@ -758,6 +834,16 @@ export class Quest extends Contract { "rewardToken()"(overrides?: CallOverrides): Promise; + setWhiteList( + _players: string[], + overrides?: Overrides + ): Promise; + + "setWhiteList(address[])"( + _players: string[], + overrides?: Overrides + ): Promise; + unplay( _player: string, overrides?: Overrides diff --git a/packages/hardhat/typechain/QuestFactory.d.ts b/packages/hardhat/typechain/QuestFactory.d.ts index 0427223f..9e7f7e3e 100644 --- a/packages/hardhat/typechain/QuestFactory.d.ts +++ b/packages/hardhat/typechain/QuestFactory.d.ts @@ -24,7 +24,8 @@ interface QuestFactoryInterface extends ethers.utils.Interface { functions: { "aragonGovernAddress()": FunctionFragment; "createDeposit()": FunctionFragment; - "createQuest(string,bytes,address,uint256,address,uint32)": FunctionFragment; + "createQuest(string,bytes,address,uint256,address,uint32,bool)": FunctionFragment; + "initialize(address)": FunctionFragment; "owner()": FunctionFragment; "playDeposit()": FunctionFragment; "renounceOwnership()": FunctionFragment; @@ -32,6 +33,7 @@ interface QuestFactoryInterface extends ethers.utils.Interface { "setCreateDeposit(address,uint256)": FunctionFragment; "setPlayDeposit(address,uint256)": FunctionFragment; "transferOwnership(address)": FunctionFragment; + "version()": FunctionFragment; }; encodeFunctionData( @@ -44,8 +46,17 @@ interface QuestFactoryInterface extends ethers.utils.Interface { ): string; encodeFunctionData( functionFragment: "createQuest", - values: [string, BytesLike, string, BigNumberish, string, BigNumberish] + values: [ + string, + BytesLike, + string, + BigNumberish, + string, + BigNumberish, + boolean + ] ): string; + encodeFunctionData(functionFragment: "initialize", values: [string]): string; encodeFunctionData(functionFragment: "owner", values?: undefined): string; encodeFunctionData( functionFragment: "playDeposit", @@ -71,6 +82,7 @@ interface QuestFactoryInterface extends ethers.utils.Interface { functionFragment: "transferOwnership", values: [string] ): string; + encodeFunctionData(functionFragment: "version", values?: undefined): string; decodeFunctionResult( functionFragment: "aragonGovernAddress", @@ -84,6 +96,7 @@ interface QuestFactoryInterface extends ethers.utils.Interface { functionFragment: "createQuest", data: BytesLike ): Result; + decodeFunctionResult(functionFragment: "initialize", data: BytesLike): Result; decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; decodeFunctionResult( functionFragment: "playDeposit", @@ -109,15 +122,18 @@ interface QuestFactoryInterface extends ethers.utils.Interface { functionFragment: "transferOwnership", data: BytesLike ): Result; + decodeFunctionResult(functionFragment: "version", data: BytesLike): Result; events: { "CreateDepositChanged(uint256,address,uint256)": EventFragment; + "Initialized(uint8)": EventFragment; "OwnershipTransferred(address,address)": EventFragment; "PlayDepositChanged(uint256,address,uint256)": EventFragment; - "QuestCreated(address,string,bytes,address,uint256,address,address,uint256,address,uint256,address,uint32)": EventFragment; + "QuestCreated(address,string,bytes,address,uint256,address,tuple,tuple,address,uint32,bool,uint256)": EventFragment; }; getEvent(nameOrSignatureOrTopic: "CreateDepositChanged"): EventFragment; + getEvent(nameOrSignatureOrTopic: "Initialized"): EventFragment; getEvent(nameOrSignatureOrTopic: "OwnershipTransferred"): EventFragment; getEvent(nameOrSignatureOrTopic: "PlayDepositChanged"): EventFragment; getEvent(nameOrSignatureOrTopic: "QuestCreated"): EventFragment; @@ -156,16 +172,28 @@ export class QuestFactory extends Contract { _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, overrides?: Overrides ): Promise; - "createQuest(string,bytes,address,uint256,address,uint32)"( + "createQuest(string,bytes,address,uint256,address,uint32,bool)"( _questTitle: string, _questDetailsRef: BytesLike, _rewardToken: string, _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, + overrides?: Overrides + ): Promise; + + initialize( + _aragonGovernAddress: string, + overrides?: Overrides + ): Promise; + + "initialize(address)"( + _aragonGovernAddress: string, overrides?: Overrides ): Promise; @@ -228,6 +256,10 @@ export class QuestFactory extends Contract { newOwner: string, overrides?: Overrides ): Promise; + + version(overrides?: CallOverrides): Promise<[BigNumber]>; + + "version()"(overrides?: CallOverrides): Promise<[BigNumber]>; }; aragonGovernAddress(overrides?: CallOverrides): Promise; @@ -249,16 +281,28 @@ export class QuestFactory extends Contract { _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, overrides?: Overrides ): Promise; - "createQuest(string,bytes,address,uint256,address,uint32)"( + "createQuest(string,bytes,address,uint256,address,uint32,bool)"( _questTitle: string, _questDetailsRef: BytesLike, _rewardToken: string, _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, + overrides?: Overrides + ): Promise; + + initialize( + _aragonGovernAddress: string, + overrides?: Overrides + ): Promise; + + "initialize(address)"( + _aragonGovernAddress: string, overrides?: Overrides ): Promise; @@ -322,6 +366,10 @@ export class QuestFactory extends Contract { overrides?: Overrides ): Promise; + version(overrides?: CallOverrides): Promise; + + "version()"(overrides?: CallOverrides): Promise; + callStatic: { aragonGovernAddress(overrides?: CallOverrides): Promise; @@ -342,19 +390,31 @@ export class QuestFactory extends Contract { _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, overrides?: CallOverrides ): Promise; - "createQuest(string,bytes,address,uint256,address,uint32)"( + "createQuest(string,bytes,address,uint256,address,uint32,bool)"( _questTitle: string, _questDetailsRef: BytesLike, _rewardToken: string, _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, overrides?: CallOverrides ): Promise; + initialize( + _aragonGovernAddress: string, + overrides?: CallOverrides + ): Promise; + + "initialize(address)"( + _aragonGovernAddress: string, + overrides?: CallOverrides + ): Promise; + owner(overrides?: CallOverrides): Promise; "owner()"(overrides?: CallOverrides): Promise; @@ -414,6 +474,10 @@ export class QuestFactory extends Contract { newOwner: string, overrides?: CallOverrides ): Promise; + + version(overrides?: CallOverrides): Promise; + + "version()"(overrides?: CallOverrides): Promise; }; filters: { @@ -423,6 +487,8 @@ export class QuestFactory extends Contract { amount: null ): EventFilter; + Initialized(version: null): EventFilter; + OwnershipTransferred( previousOwner: string | null, newOwner: string | null @@ -437,12 +503,12 @@ export class QuestFactory extends Contract { rewardTokenAddress: null, expireTime: null, fundsRecoveryAddress: null, - createDepositToken: null, - createDepositAmount: null, - playDepositToken: null, - playDepositAmount: null, + createDeposit: null, + playDeposit: null, creator: null, - maxPlayers: null + maxPlayers: null, + isWhiteList: null, + version: null ): EventFilter; }; @@ -462,16 +528,28 @@ export class QuestFactory extends Contract { _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, overrides?: Overrides ): Promise; - "createQuest(string,bytes,address,uint256,address,uint32)"( + "createQuest(string,bytes,address,uint256,address,uint32,bool)"( _questTitle: string, _questDetailsRef: BytesLike, _rewardToken: string, _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, + overrides?: Overrides + ): Promise; + + initialize( + _aragonGovernAddress: string, + overrides?: Overrides + ): Promise; + + "initialize(address)"( + _aragonGovernAddress: string, overrides?: Overrides ): Promise; @@ -530,6 +608,10 @@ export class QuestFactory extends Contract { newOwner: string, overrides?: Overrides ): Promise; + + version(overrides?: CallOverrides): Promise; + + "version()"(overrides?: CallOverrides): Promise; }; populateTransaction: { @@ -552,16 +634,28 @@ export class QuestFactory extends Contract { _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, overrides?: Overrides ): Promise; - "createQuest(string,bytes,address,uint256,address,uint32)"( + "createQuest(string,bytes,address,uint256,address,uint32,bool)"( _questTitle: string, _questDetailsRef: BytesLike, _rewardToken: string, _expireTime: BigNumberish, _fundsRecoveryAddress: string, _maxPlayers: BigNumberish, + _isWhiteList: boolean, + overrides?: Overrides + ): Promise; + + initialize( + _aragonGovernAddress: string, + overrides?: Overrides + ): Promise; + + "initialize(address)"( + _aragonGovernAddress: string, overrides?: Overrides ): Promise; @@ -620,5 +714,9 @@ export class QuestFactory extends Contract { newOwner: string, overrides?: Overrides ): Promise; + + version(overrides?: CallOverrides): Promise; + + "version()"(overrides?: CallOverrides): Promise; }; } diff --git a/packages/hardhat/typechain/factories/ContextUpgradeable__factory.ts b/packages/hardhat/typechain/factories/ContextUpgradeable__factory.ts new file mode 100644 index 00000000..8fca806c --- /dev/null +++ b/packages/hardhat/typechain/factories/ContextUpgradeable__factory.ts @@ -0,0 +1,33 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer } from "ethers"; +import { Provider } from "@ethersproject/providers"; + +import type { ContextUpgradeable } from "../ContextUpgradeable"; + +export class ContextUpgradeable__factory { + static connect( + address: string, + signerOrProvider: Signer | Provider + ): ContextUpgradeable { + return new Contract(address, _abi, signerOrProvider) as ContextUpgradeable; + } +} + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8", + }, + ], + name: "Initialized", + type: "event", + }, +]; diff --git a/packages/hardhat/typechain/factories/DepositLib__factory.ts b/packages/hardhat/typechain/factories/DepositLib__factory.ts deleted file mode 100644 index 8dfb05fc..00000000 --- a/packages/hardhat/typechain/factories/DepositLib__factory.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { Signer } from "ethers"; -import { Provider, TransactionRequest } from "@ethersproject/providers"; -import { Contract, ContractFactory, Overrides } from "@ethersproject/contracts"; - -import type { DepositLib } from "../DepositLib"; - -export class DepositLib__factory extends ContractFactory { - constructor(signer?: Signer) { - super(_abi, _bytecode, signer); - } - - deploy(overrides?: Overrides): Promise { - return super.deploy(overrides || {}) as Promise; - } - getDeployTransaction(overrides?: Overrides): TransactionRequest { - return super.getDeployTransaction(overrides || {}); - } - attach(address: string): DepositLib { - return super.attach(address) as DepositLib; - } - connect(signer: Signer): DepositLib__factory { - return super.connect(signer) as DepositLib__factory; - } - static connect( - address: string, - signerOrProvider: Signer | Provider - ): DepositLib { - return new Contract(address, _abi, signerOrProvider) as DepositLib; - } -} - -const _abi = [ - { - inputs: [ - { - internalType: "bytes32", - name: "c__0x86fb8751", - type: "bytes32", - }, - ], - name: "c_0x86fb8751", - outputs: [], - stateMutability: "pure", - type: "function", - }, -]; - -const _bytecode = - "0x60e0610052600b82828239805160001a607314610045577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c8063176bc871146038575b600080fd5b604e6004803603810190604a91906066565b6050565b005b50565b6000813590506060816096565b92915050565b600060208284031215607757600080fd5b60006083848285016053565b91505092915050565b6000819050919050565b609d81608c565b811460a757600080fd5b5056fea2646970667358221220a32ca1d88683ae95494422ab83791ee969d3214649243cd5f3714835d30da88d64736f6c63430008010033"; diff --git a/packages/hardhat/typechain/factories/Deposit__factory.ts b/packages/hardhat/typechain/factories/Deposit__factory.ts deleted file mode 100644 index 222b2906..00000000 --- a/packages/hardhat/typechain/factories/Deposit__factory.ts +++ /dev/null @@ -1,166 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { Signer, BigNumberish } from "ethers"; -import { Provider, TransactionRequest } from "@ethersproject/providers"; -import { Contract, ContractFactory, Overrides } from "@ethersproject/contracts"; - -import type { Deposit } from "../Deposit"; - -export class Deposit__factory extends ContractFactory { - constructor(signer?: Signer) { - super(_abi, _bytecode, signer); - } - - deploy( - _token: string, - _amount: BigNumberish, - overrides?: Overrides - ): Promise { - return super.deploy(_token, _amount, overrides || {}) as Promise; - } - getDeployTransaction( - _token: string, - _amount: BigNumberish, - overrides?: Overrides - ): TransactionRequest { - return super.getDeployTransaction(_token, _amount, overrides || {}); - } - attach(address: string): Deposit { - return super.attach(address) as Deposit; - } - connect(signer: Signer): Deposit__factory { - return super.connect(signer) as Deposit__factory; - } - static connect( - address: string, - signerOrProvider: Signer | Provider - ): Deposit { - return new Contract(address, _abi, signerOrProvider) as Deposit; - } -} - -const _abi = [ - { - inputs: [ - { - internalType: "contract IERC20", - name: "_token", - type: "address", - }, - { - internalType: "uint256", - name: "_amount", - type: "uint256", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "token", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "Lock", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "token", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "to", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "Unlock", - type: "event", - }, - { - inputs: [], - name: "amount", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_from", - type: "address", - }, - ], - name: "collectFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_to", - type: "address", - }, - ], - name: "releaseTo", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "token", - outputs: [ - { - internalType: "contract IERC20", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, -]; - -const _bytecode = - "0x608060405234801561001057600080fd5b5060405161081338038061081383398101604081905261002f91610058565b600080546001600160a01b0319166001600160a01b039390931692909217909155600155610090565b6000806040838503121561006a578182fd5b82516001600160a01b0381168114610080578283fd5b6020939093015192949293505050565b6107748061009f6000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80633865aba414610051578063aa8c217c14610066578063d1fb564614610084578063fc0c546a14610097575b600080fd5b61006461005f3660046104df565b6100ac565b005b61006e61013c565b60405161007b9190610709565b60405180910390f35b6100646100923660046104df565b610142565b61009f6101c4565b60405161007b91906105a6565b60015415610139576001546000546100e09173ffffffffffffffffffffffffffffffffffffffff90911690839030906101e0565b60005460015460405173ffffffffffffffffffffffffffffffffffffffff8085169316917fec36c0364d931187a76cf66d7eee08fad0ec2e8b7458a8d8b26b36769d4d13f3916101309190610709565b60405180910390a35b50565b60015481565b60015415610139576001546000546101749173ffffffffffffffffffffffffffffffffffffffff909116908390610289565b60005460015460405173ffffffffffffffffffffffffffffffffffffffff8085169316917fc1c90b8e0705b212262c0dbd7580efe1862c2f185bf96899226f7596beb2db09916101309190610709565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b610283846323b872dd60e01b8585856040516024016102019392919061054f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526102ad565b50505050565b6102a88363a9059cbb60e01b8484604051602401610201929190610580565b505050565b600061030f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661036c9092919063ffffffff16565b8051909150156102a8578080602001905181019061032d9190610513565b6102a8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610363906106ac565b60405180910390fd5b606061037b8484600085610385565b90505b9392505050565b6060824710156103c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036390610618565b6103ca85610486565b610400576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036390610675565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516104299190610533565b60006040518083038185875af1925050503d8060008114610466576040519150601f19603f3d011682016040523d82523d6000602084013e61046b565b606091505b509150915061047b82828661048c565b979650505050505050565b3b151590565b6060831561049b57508161037e565b8251156104ab5782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036391906105c7565b6000602082840312156104f0578081fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461037e578182fd5b600060208284031215610524578081fd5b8151801515811461037e578182fd5b60008251610545818460208701610712565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b60006020825282518060208401526105e6816040850160208701610712565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b90815260200190565b60005b8381101561072d578181015183820152602001610715565b83811115610283575050600091015256fea2646970667358221220511af073f57b2590d6b52d9bb2fc33242fe8ca7c6b43ad0954dc69ebd9845f3b64736f6c63430008010033"; diff --git a/packages/hardhat/typechain/factories/DisputeManager__factory.ts b/packages/hardhat/typechain/factories/DisputeManager__factory.ts deleted file mode 100644 index 9742f52b..00000000 --- a/packages/hardhat/typechain/factories/DisputeManager__factory.ts +++ /dev/null @@ -1,140 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { Signer } from "ethers"; -import { Provider, TransactionRequest } from "@ethersproject/providers"; -import { Contract, ContractFactory, Overrides } from "@ethersproject/contracts"; - -import type { DisputeManager } from "../DisputeManager"; - -export class DisputeManager__factory extends ContractFactory { - constructor(signer?: Signer) { - super(_abi, _bytecode, signer); - } - - deploy( - mockCelesteAddress: string, - overrides?: Overrides - ): Promise { - return super.deploy( - mockCelesteAddress, - overrides || {} - ) as Promise; - } - getDeployTransaction( - mockCelesteAddress: string, - overrides?: Overrides - ): TransactionRequest { - return super.getDeployTransaction(mockCelesteAddress, overrides || {}); - } - attach(address: string): DisputeManager { - return super.attach(address) as DisputeManager; - } - connect(signer: Signer): DisputeManager__factory { - return super.connect(signer) as DisputeManager__factory; - } - static connect( - address: string, - signerOrProvider: Signer | Provider - ): DisputeManager { - return new Contract(address, _abi, signerOrProvider) as DisputeManager; - } -} - -const _abi = [ - { - constant: true, - inputs: [], - name: "getDisputeFees", - outputs: [ - { - name: "", - type: "address", - }, - { - name: "", - type: "uint256", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: false, - inputs: [ - { - name: "_disputeId", - type: "uint256", - }, - ], - name: "computeRuling", - outputs: [ - { - name: "subject", - type: "address", - }, - { - name: "finalRuling", - type: "uint8", - }, - ], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: true, - inputs: [ - { - name: "_disputeId", - type: "uint256", - }, - ], - name: "getDispute", - outputs: [ - { - name: "subject", - type: "address", - }, - { - name: "possibleRulings", - type: "uint8", - }, - { - name: "state", - type: "uint8", - }, - { - name: "finalRuling", - type: "uint8", - }, - { - name: "lastRoundId", - type: "uint256", - }, - { - name: "createTermId", - type: "uint64", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - name: "mockCelesteAddress", - type: "address", - }, - ], - payable: false, - stateMutability: "nonpayable", - type: "constructor", - }, -]; - -const _bytecode = - "0x608060405234801561001057600080fd5b5060405160208061051b8339810180604052602081101561003057600080fd5b8101908080519060200190929190505050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505061048a806100916000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80637b751b9e14610046578063bd881e5314610097578063e3a96cbd1461011a575b600080fd5b61004e6101d9565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b6100c3600480360360208110156100ad57600080fd5b81019080803590602001909291905050506102aa565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600481111561010557fe5b60ff1681526020019250505060405180910390f35b6101466004803603602081101561013057600080fd5b810190808035906020019092919050505061036c565b604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018660ff1660ff16815260200185600481111561019457fe5b60ff1681526020018460ff1660ff1681526020018381526020018267ffffffffffffffff1667ffffffffffffffff168152602001965050505050505060405180910390f35b60008060008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637b751b9e6040518163ffffffff1660e01b815260040160606040518083038186803b15801561024857600080fd5b505afa15801561025c573d6000803e3d6000fd5b505050506040513d606081101561027257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050509250925092508181945094505050509091565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663564a565d846040518263ffffffff1660e01b815260040180828152602001915050604080518083038186803b15801561031e57600080fd5b505afa158015610332573d6000803e3d6000fd5b505050506040513d604081101561034857600080fd5b81019080805190602001909291908051906020019092919050505091509150915091565b6000806000806000806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663564a565d8a6040518263ffffffff1660e01b815260040180828152602001915050604080518083038186803b1580156103e957600080fd5b505afa1580156103fd573d6000803e3d6000fd5b505050506040513d604081101561041357600080fd5b8101908080519060200190929190805190602001909291905050509150915081600082600080600084945082925081915080905097509750975097509750975050509193955091939556fea165627a7a723058201860abd576668e1f1c4de0a864e93cbc83e3b43f7403bfd4b851651284cfd0a90029"; diff --git a/packages/hardhat/typechain/factories/ERC20__factory.ts b/packages/hardhat/typechain/factories/ERC20__factory.ts index d9260d93..819e1147 100644 --- a/packages/hardhat/typechain/factories/ERC20__factory.ts +++ b/packages/hardhat/typechain/factories/ERC20__factory.ts @@ -328,4 +328,4 @@ const _abi = [ ]; const _bytecode = - "0x60806040523480156200001157600080fd5b5060405162000e3a38038062000e3a8339810160408190526200003491620001c1565b81516200004990600390602085019062000068565b5080516200005f90600490602084019062000068565b5050506200027b565b828054620000769062000228565b90600052602060002090601f0160209004810192826200009a5760008555620000e5565b82601f10620000b557805160ff1916838001178555620000e5565b82800160010185558215620000e5579182015b82811115620000e5578251825591602001919060010190620000c8565b50620000f3929150620000f7565b5090565b5b80821115620000f35760008155600101620000f8565b600082601f8301126200011f578081fd5b81516001600160401b03808211156200013c576200013c62000265565b604051601f8301601f19908116603f0116810190828211818310171562000167576200016762000265565b8160405283815260209250868385880101111562000183578485fd5b8491505b83821015620001a6578582018301518183018401529082019062000187565b83821115620001b757848385830101525b9695505050505050565b60008060408385031215620001d4578182fd5b82516001600160401b0380821115620001eb578384fd5b620001f9868387016200010e565b935060208501519150808211156200020f578283fd5b506200021e858286016200010e565b9150509250929050565b6002810460018216806200023d57607f821691505b602082108114156200025f57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b610baf806200028b6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80633950935111610081578063a457c2d71161005b578063a457c2d714610177578063a9059cbb1461018a578063dd62ed3e1461019d576100c9565b8063395093511461014957806370a082311461015c57806395d89b411461016f576100c9565b806318160ddd116100b257806318160ddd1461010c57806323b872dd14610121578063313ce56714610134576100c9565b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d66101b0565b6040516100e391906107fb565b60405180910390f35b6100ff6100fa3660046107c7565b610242565b6040516100e391906107f0565b610114610264565b6040516100e39190610ad1565b6100ff61012f36600461078c565b61026a565b61013c610298565b6040516100e39190610ada565b6100ff6101573660046107c7565b61029d565b61011461016a366004610739565b6102c9565b6100d66102f5565b6100ff6101853660046107c7565b610304565b6100ff6101983660046107c7565b61036f565b6101146101ab36600461075a565b610387565b6060600380546101bf90610b25565b80601f01602080910402602001604051908101604052809291908181526020018280546101eb90610b25565b80156102385780601f1061020d57610100808354040283529160200191610238565b820191906000526020600020905b81548152906001019060200180831161021b57829003601f168201915b5050505050905090565b60008061024d6103bf565b905061025a8185856103c3565b5060019392505050565b60025490565b6000806102756103bf565b90506102828582856104d2565b61028d858585610554565b506001949350505050565b601290565b6000806102a86103bf565b905061025a8185856102ba8589610387565b6102c49190610ae8565b6103c3565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020545b919050565b6060600480546101bf90610b25565b60008061030f6103bf565b9050600061031d8286610387565b905083811015610362576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161035990610a74565b60405180910390fd5b61028d82868684036103c3565b60008061037a6103bf565b905061025a818585610554565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b3390565b73ffffffffffffffffffffffffffffffffffffffff8316610410576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161035990610a17565b73ffffffffffffffffffffffffffffffffffffffff821661045d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610359906108c9565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104c5908590610ad1565b60405180910390a3505050565b60006104de8484610387565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461054e5781811015610541576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161035990610926565b61054e84848484036103c3565b50505050565b73ffffffffffffffffffffffffffffffffffffffff83166105a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610359906109ba565b73ffffffffffffffffffffffffffffffffffffffff82166105ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103599061086c565b6105f9838383610710565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610659576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103599061095d565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526020819052604080822085850390559185168152908120805484929061069d908490610ae8565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107019190610ad1565b60405180910390a361054e8484845b505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146102f057600080fd5b60006020828403121561074a578081fd5b61075382610715565b9392505050565b6000806040838503121561076c578081fd5b61077583610715565b915061078360208401610715565b90509250929050565b6000806000606084860312156107a0578081fd5b6107a984610715565b92506107b760208501610715565b9150604084013590509250925092565b600080604083850312156107d9578182fd5b6107e283610715565b946020939093013593505050565b901515815260200190565b6000602080835283518082850152825b818110156108275785810183015185820160400152820161080b565b818111156108385783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201527f6573730000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560408201527f7373000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601d908201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604082015260600190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260408201527f616c616e63650000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460408201527f6472657373000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460408201527f7265737300000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760408201527f207a65726f000000000000000000000000000000000000000000000000000000606082015260800190565b90815260200190565b60ff91909116815260200190565b60008219821115610b20577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b500190565b600281046001821680610b3957607f821691505b60208210811415610b73577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea26469706673582212202d85590ab4ea505a824ce50557dd397092341765c6bdb86c099a9db4bbe0365b64736f6c63430008010033"; + "0x60806040523480156200001157600080fd5b5060405162000dad38038062000dad8339810160408190526200003491620001c1565b81516200004990600390602085019062000068565b5080516200005f90600490602084019062000068565b5050506200027b565b828054620000769062000228565b90600052602060002090601f0160209004810192826200009a5760008555620000e5565b82601f10620000b557805160ff1916838001178555620000e5565b82800160010185558215620000e5579182015b82811115620000e5578251825591602001919060010190620000c8565b50620000f3929150620000f7565b5090565b5b80821115620000f35760008155600101620000f8565b600082601f8301126200011f578081fd5b81516001600160401b03808211156200013c576200013c62000265565b604051601f8301601f19908116603f0116810190828211818310171562000167576200016762000265565b8160405283815260209250868385880101111562000183578485fd5b8491505b83821015620001a6578582018301518183018401529082019062000187565b83821115620001b757848385830101525b9695505050505050565b60008060408385031215620001d4578182fd5b82516001600160401b0380821115620001eb578384fd5b620001f9868387016200010e565b935060208501519150808211156200020f578283fd5b506200021e858286016200010e565b9150509250929050565b6002810460018216806200023d57607f821691505b602082108114156200025f57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b610b22806200028b6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80633950935111610081578063a457c2d71161005b578063a457c2d714610171578063a9059cbb14610184578063dd62ed3e14610197576100c9565b8063395093511461014357806370a082311461015657806395d89b4114610169576100c9565b806318160ddd116100b257806318160ddd1461010f57806323b872dd14610121578063313ce56714610134576100c9565b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d66101dd565b6040516100e391906109ea565b60405180910390f35b6100ff6100fa3660046109c1565b61026f565b60405190151581526020016100e3565b6002545b6040519081526020016100e3565b6100ff61012f366004610986565b610287565b604051601281526020016100e3565b6100ff6101513660046109c1565b6102ab565b610113610164366004610933565b6102f7565b6100d6610323565b6100ff61017f3660046109c1565b610332565b6100ff6101923660046109c1565b610408565b6101136101a5366004610954565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101ec90610a98565b80601f016020809104026020016040519081016040528092919081815260200182805461021890610a98565b80156102655780601f1061023a57610100808354040283529160200191610265565b820191906000526020600020905b81548152906001019060200180831161024857829003601f168201915b5050505050905090565b60003361027d818585610416565b5060019392505050565b6000336102958582856105c9565b6102a08585856106a0565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061027d90829086906102f2908790610a5b565b610416565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020545b919050565b6060600480546101ec90610a98565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190838110156103fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6102a08286868403610416565b60003361027d8185856106a0565b73ffffffffffffffffffffffffffffffffffffffff83166104b8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016103f2565b73ffffffffffffffffffffffffffffffffffffffff821661055b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016103f2565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461069a578181101561068d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016103f2565b61069a8484848403610416565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610743576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016103f2565b73ffffffffffffffffffffffffffffffffffffffff82166107e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016103f2565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020548181101561089c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016103f2565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a361069a565b803573ffffffffffffffffffffffffffffffffffffffff8116811461031e57600080fd5b600060208284031215610944578081fd5b61094d8261090f565b9392505050565b60008060408385031215610966578081fd5b61096f8361090f565b915061097d6020840161090f565b90509250929050565b60008060006060848603121561099a578081fd5b6109a38461090f565b92506109b16020850161090f565b9150604084013590509250925092565b600080604083850312156109d3578182fd5b6109dc8361090f565b946020939093013593505050565b6000602080835283518082850152825b81811015610a16578581018301518582016040015282016109fa565b81811115610a275783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60008219821115610a93577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b500190565b600281046001821680610aac57607f821691505b60208210811415610ae6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea26469706673582212203354817b5f0645fe69094d0c7a8d6759956aa555cb245b0d583dab70855162fa64736f6c63430008020033"; diff --git a/packages/hardhat/typechain/factories/IERC20Permit__factory.ts b/packages/hardhat/typechain/factories/IERC20PermitUpgradeable__factory.ts similarity index 86% rename from packages/hardhat/typechain/factories/IERC20Permit__factory.ts rename to packages/hardhat/typechain/factories/IERC20PermitUpgradeable__factory.ts index f24b21ea..e876a9b5 100644 --- a/packages/hardhat/typechain/factories/IERC20Permit__factory.ts +++ b/packages/hardhat/typechain/factories/IERC20PermitUpgradeable__factory.ts @@ -5,14 +5,18 @@ import { Contract, Signer } from "ethers"; import { Provider } from "@ethersproject/providers"; -import type { IERC20Permit } from "../IERC20Permit"; +import type { IERC20PermitUpgradeable } from "../IERC20PermitUpgradeable"; -export class IERC20Permit__factory { +export class IERC20PermitUpgradeable__factory { static connect( address: string, signerOrProvider: Signer | Provider - ): IERC20Permit { - return new Contract(address, _abi, signerOrProvider) as IERC20Permit; + ): IERC20PermitUpgradeable { + return new Contract( + address, + _abi, + signerOrProvider + ) as IERC20PermitUpgradeable; } } diff --git a/packages/hardhat/typechain/factories/IERC20Upgradeable__factory.ts b/packages/hardhat/typechain/factories/IERC20Upgradeable__factory.ts new file mode 100644 index 00000000..5a09857c --- /dev/null +++ b/packages/hardhat/typechain/factories/IERC20Upgradeable__factory.ts @@ -0,0 +1,203 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer } from "ethers"; +import { Provider } from "@ethersproject/providers"; + +import type { IERC20Upgradeable } from "../IERC20Upgradeable"; + +export class IERC20Upgradeable__factory { + static connect( + address: string, + signerOrProvider: Signer | Provider + ): IERC20Upgradeable { + return new Contract(address, _abi, signerOrProvider) as IERC20Upgradeable; + } +} + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Transfer", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "address", + name: "spender", + type: "address", + }, + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, +]; diff --git a/packages/hardhat/typechain/factories/Initializable__factory.ts b/packages/hardhat/typechain/factories/Initializable__factory.ts new file mode 100644 index 00000000..4ede7881 --- /dev/null +++ b/packages/hardhat/typechain/factories/Initializable__factory.ts @@ -0,0 +1,33 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer } from "ethers"; +import { Provider } from "@ethersproject/providers"; + +import type { Initializable } from "../Initializable"; + +export class Initializable__factory { + static connect( + address: string, + signerOrProvider: Signer | Provider + ): Initializable { + return new Contract(address, _abi, signerOrProvider) as Initializable; + } +} + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8", + }, + ], + name: "Initialized", + type: "event", + }, +]; diff --git a/packages/hardhat/typechain/factories/Models__factory.ts b/packages/hardhat/typechain/factories/Models__factory.ts deleted file mode 100644 index ecdc4043..00000000 --- a/packages/hardhat/typechain/factories/Models__factory.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { Signer } from "ethers"; -import { Provider, TransactionRequest } from "@ethersproject/providers"; -import { Contract, ContractFactory, Overrides } from "@ethersproject/contracts"; - -import type { Models } from "../Models"; - -export class Models__factory extends ContractFactory { - constructor(signer?: Signer) { - super(_abi, _bytecode, signer); - } - - deploy(overrides?: Overrides): Promise { - return super.deploy(overrides || {}) as Promise; - } - getDeployTransaction(overrides?: Overrides): TransactionRequest { - return super.getDeployTransaction(overrides || {}); - } - attach(address: string): Models { - return super.attach(address) as Models; - } - connect(signer: Signer): Models__factory { - return super.connect(signer) as Models__factory; - } - static connect(address: string, signerOrProvider: Signer | Provider): Models { - return new Contract(address, _abi, signerOrProvider) as Models; - } -} - -const _abi = [ - { - inputs: [ - { - internalType: "bytes32", - name: "c__0xa9dfceef", - type: "bytes32", - }, - ], - name: "c_0xa9dfceef", - outputs: [], - stateMutability: "pure", - type: "function", - }, -]; - -const _bytecode = - "0x60e0610052600b82828239805160001a607314610045577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c8063b8b153ba146038575b600080fd5b604e6004803603810190604a91906066565b6050565b005b50565b6000813590506060816096565b92915050565b600060208284031215607757600080fd5b60006083848285016053565b91505092915050565b6000819050919050565b609d81608c565b811460a757600080fd5b5056fea26469706673582212207c4ab43236faaa19caf7c418568056772ad922fb8ab65826357969db54c19b4364736f6c63430008010033"; diff --git a/packages/hardhat/typechain/factories/OwnableCeleste__factory.ts b/packages/hardhat/typechain/factories/OwnableCeleste__factory.ts index bf4e594c..f9bc4bc1 100644 --- a/packages/hardhat/typechain/factories/OwnableCeleste__factory.ts +++ b/packages/hardhat/typechain/factories/OwnableCeleste__factory.ts @@ -334,4 +334,4 @@ const _abi = [ ]; const _bytecode = - "0x608060405234801561001057600080fd5b506040516040806111bf8339810180604052604081101561003057600080fd5b81019080805190602001909291908051906020019092919050505033600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060018190555050506110db806100e46000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80637e9adccf11610097578063db18af6c11610066578063db18af6c1461051d578063db9bee4614610592578063e00dd161146105dc578063e55156b5146105fa576100f5565b80637e9adccf1461038b5780638da5cb5b146103b9578063bd881e5314610403578063c13517e114610486576100f5565b8063647846a5116100d3578063647846a5146101fc57806369e15404146102465780637b751b9e146102645780637cb57c64146102e8576100f5565b806313af4035146100fa5780631da213f21461013e578063564a565d14610179575b600080fd5b61013c6004803603602081101561011057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610648565b005b6101776004803603604081101561015457600080fd5b8101908080359060200190929190803560ff16906020019092919050505061074f565b005b6101a56004803603602081101561018f57600080fd5b81019080803590602001909291905050506109a0565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260048111156101e757fe5b60ff1681526020019250505060405180910390f35b6102046109f1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61024e610a16565b6040518082815260200191505060405180910390f35b61026c610a1c565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390f35b610389600480360360608110156102fe57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561034557600080fd5b82018360208201111561035757600080fd5b8035906020019184600183028401116401000000008311171561037957600080fd5b9091929391929390505050610a52565b005b6103b7600480360360208110156103a157600080fd5b8101908080359060200190929190505050610a58565b005b6103c1610a5b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61042f6004803603602081101561041957600080fd5b8101908080359060200190929190505050610a81565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600481111561047157fe5b60ff1681526020019250505060405180910390f35b6105076004803603604081101561049c57600080fd5b8101908080359060200190929190803590602001906401000000008111156104c357600080fd5b8201836020820111156104d557600080fd5b803590602001918460018302840111640100000000831117156104f757600080fd5b9091929391929390505050610adc565b6040518082815260200191505060405180910390f35b6105496004803603602081101561053357600080fd5b8101908080359060200190929190505050610c80565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b61059a610e2f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105e4610e37565b6040518082815260200191505060405180910390f35b6106466004803603604081101561061057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e3d565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461070b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4552523a4e4f545f4f574e45520000000000000000000000000000000000000081525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610812576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4552523a4e4f545f4f574e45520000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600481111561081f57fe5b81600481111561082b57fe5b1415801561085057506001600481111561084157fe5b81600481111561084d57fe5b14155b6108c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4552523a4f5554434f4d455f4e4f545f41535349474e41424c4500000000000081525060200191505060405180910390fd5b6000600460008481526020019081526020016000209050600160048111156108e657fe5b8160000160149054906101000a900460ff16600481111561090357fe5b14610976576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f4552523a4e4f545f44495350555445440000000000000000000000000000000081525060200191505060405180910390fd5b818160000160146101000a81548160ff0219169083600481111561099657fe5b0217905550505050565b60046020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060000160149054906101000a900460ff16905082565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b6000806000306000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600154925092509250909192565b50505050565b50565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060006004600085815260200190815260200160002090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692508060000160149054906101000a900460ff16915050915091565b600080600254905060405180604001604052803373ffffffffffffffffffffffffffffffffffffffff16815260200160016004811115610b1857fe5b8152506004600083815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548160ff02191690836004811115610b9957fe5b0217905550905050600260008154809291906001019190505550610c0333306001546000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f4b909392919063ffffffff16565b610c75576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4552523a4445504f5349545f4641494c4544000000000000000000000000000081525060200191505060405180910390fd5b809150509392505050565b600080600060046000858152602001908152602001600020905060036004811115610ca757fe5b8160000160149054906101000a900460ff166004811115610cc457fe5b1415610cfb578060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660039250925050610e2a565b600480811115610d0757fe5b8160000160149054906101000a900460ff166004811115610d2457fe5b1415610d5b578060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660049250925050610e2a565b60026004811115610d6857fe5b8160000160149054906101000a900460ff166004811115610d8557fe5b1415610dbc578060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660009250925050610e2a565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f554e45585045435445445f53544154450000000000000000000000000000000081525060200191505060405180910390fd5b915091565b600030905090565b60025481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4552523a4e4f545f4f574e45520000000000000000000000000000000000000081525060200191505060405180910390fd5b80600181905550816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600060608573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050611052868261105d565b915050949350505050565b6000806040516020818551602087016000895af160008111156110a3573d600081146110905760208114611099576110a1565b600193506110a1565b600183511493505b505b5050809150509291505056fea165627a7a72305820bd4a295db9bcaba2a85d13d7982dc2f3a1586e33fa938dd46dc0ba2833ca42570029"; + "0x608060405234801561001057600080fd5b506040516040806111bf8339810180604052604081101561003057600080fd5b81019080805190602001909291908051906020019092919050505033600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060018190555050506110db806100e46000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80637e9adccf11610097578063db18af6c11610066578063db18af6c1461051d578063db9bee4614610592578063e00dd161146105dc578063e55156b5146105fa576100f5565b80637e9adccf1461038b5780638da5cb5b146103b9578063bd881e5314610403578063c13517e114610486576100f5565b8063647846a5116100d3578063647846a5146101fc57806369e15404146102465780637b751b9e146102645780637cb57c64146102e8576100f5565b806313af4035146100fa5780631da213f21461013e578063564a565d14610179575b600080fd5b61013c6004803603602081101561011057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610648565b005b6101776004803603604081101561015457600080fd5b8101908080359060200190929190803560ff16906020019092919050505061074f565b005b6101a56004803603602081101561018f57600080fd5b81019080803590602001909291905050506109a0565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260048111156101e757fe5b60ff1681526020019250505060405180910390f35b6102046109f1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61024e610a16565b6040518082815260200191505060405180910390f35b61026c610a1c565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390f35b610389600480360360608110156102fe57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561034557600080fd5b82018360208201111561035757600080fd5b8035906020019184600183028401116401000000008311171561037957600080fd5b9091929391929390505050610a52565b005b6103b7600480360360208110156103a157600080fd5b8101908080359060200190929190505050610a58565b005b6103c1610a5b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61042f6004803603602081101561041957600080fd5b8101908080359060200190929190505050610a81565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600481111561047157fe5b60ff1681526020019250505060405180910390f35b6105076004803603604081101561049c57600080fd5b8101908080359060200190929190803590602001906401000000008111156104c357600080fd5b8201836020820111156104d557600080fd5b803590602001918460018302840111640100000000831117156104f757600080fd5b9091929391929390505050610adc565b6040518082815260200191505060405180910390f35b6105496004803603602081101561053357600080fd5b8101908080359060200190929190505050610c80565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b61059a610e2f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105e4610e37565b6040518082815260200191505060405180910390f35b6106466004803603604081101561061057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e3d565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461070b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4552523a4e4f545f4f574e45520000000000000000000000000000000000000081525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610812576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4552523a4e4f545f4f574e45520000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600481111561081f57fe5b81600481111561082b57fe5b1415801561085057506001600481111561084157fe5b81600481111561084d57fe5b14155b6108c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4552523a4f5554434f4d455f4e4f545f41535349474e41424c4500000000000081525060200191505060405180910390fd5b6000600460008481526020019081526020016000209050600160048111156108e657fe5b8160000160149054906101000a900460ff16600481111561090357fe5b14610976576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f4552523a4e4f545f44495350555445440000000000000000000000000000000081525060200191505060405180910390fd5b818160000160146101000a81548160ff0219169083600481111561099657fe5b0217905550505050565b60046020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060000160149054906101000a900460ff16905082565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b6000806000306000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600154925092509250909192565b50505050565b50565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060006004600085815260200190815260200160002090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692508060000160149054906101000a900460ff16915050915091565b600080600254905060405180604001604052803373ffffffffffffffffffffffffffffffffffffffff16815260200160016004811115610b1857fe5b8152506004600083815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548160ff02191690836004811115610b9957fe5b0217905550905050600260008154809291906001019190505550610c0333306001546000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f4b909392919063ffffffff16565b610c75576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4552523a4445504f5349545f4641494c4544000000000000000000000000000081525060200191505060405180910390fd5b809150509392505050565b600080600060046000858152602001908152602001600020905060036004811115610ca757fe5b8160000160149054906101000a900460ff166004811115610cc457fe5b1415610cfb578060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660039250925050610e2a565b600480811115610d0757fe5b8160000160149054906101000a900460ff166004811115610d2457fe5b1415610d5b578060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660049250925050610e2a565b60026004811115610d6857fe5b8160000160149054906101000a900460ff166004811115610d8557fe5b1415610dbc578060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660009250925050610e2a565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f554e45585045435445445f53544154450000000000000000000000000000000081525060200191505060405180910390fd5b915091565b600030905090565b60025481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4552523a4e4f545f4f574e45520000000000000000000000000000000000000081525060200191505060405180910390fd5b80600181905550816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600060608573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050611052868261105d565b915050949350505050565b6000806040516020818551602087016000895af160008111156110a3573d600081146110905760208114611099576110a1565b600193506110a1565b600183511493505b505b5050809150509291505056fea165627a7a72305820ad526ae7aa1ab8e65a1ec5cf369673b6a337ae20ff8df8363900beea6b1185150029"; diff --git a/packages/hardhat/typechain/factories/Ownable__factory.ts b/packages/hardhat/typechain/factories/OwnableUpgradeable__factory.ts similarity index 77% rename from packages/hardhat/typechain/factories/Ownable__factory.ts rename to packages/hardhat/typechain/factories/OwnableUpgradeable__factory.ts index e8c9147d..bcae2396 100644 --- a/packages/hardhat/typechain/factories/Ownable__factory.ts +++ b/packages/hardhat/typechain/factories/OwnableUpgradeable__factory.ts @@ -5,18 +5,31 @@ import { Contract, Signer } from "ethers"; import { Provider } from "@ethersproject/providers"; -import type { Ownable } from "../Ownable"; +import type { OwnableUpgradeable } from "../OwnableUpgradeable"; -export class Ownable__factory { +export class OwnableUpgradeable__factory { static connect( address: string, signerOrProvider: Signer | Provider - ): Ownable { - return new Contract(address, _abi, signerOrProvider) as Ownable; + ): OwnableUpgradeable { + return new Contract(address, _abi, signerOrProvider) as OwnableUpgradeable; } } const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8", + }, + ], + name: "Initialized", + type: "event", + }, { anonymous: false, inputs: [ diff --git a/packages/hardhat/typechain/factories/QuestFactory__factory.ts b/packages/hardhat/typechain/factories/QuestFactory__factory.ts index d678bb96..538301ea 100644 --- a/packages/hardhat/typechain/factories/QuestFactory__factory.ts +++ b/packages/hardhat/typechain/factories/QuestFactory__factory.ts @@ -2,7 +2,7 @@ /* tslint:disable */ /* eslint-disable */ -import { Signer, BigNumberish } from "ethers"; +import { Signer } from "ethers"; import { Provider, TransactionRequest } from "@ethersproject/providers"; import { Contract, ContractFactory, Overrides } from "@ethersproject/contracts"; @@ -13,43 +13,11 @@ export class QuestFactory__factory extends ContractFactory { super(_abi, _bytecode, signer); } - deploy( - _aragonGovernAddress: string, - _createDepositToken: string, - _createDepositAmount: BigNumberish, - _playDepositToken: string, - _playDepositAmount: BigNumberish, - _initialOwner: string, - overrides?: Overrides - ): Promise { - return super.deploy( - _aragonGovernAddress, - _createDepositToken, - _createDepositAmount, - _playDepositToken, - _playDepositAmount, - _initialOwner, - overrides || {} - ) as Promise; + deploy(overrides?: Overrides): Promise { + return super.deploy(overrides || {}) as Promise; } - getDeployTransaction( - _aragonGovernAddress: string, - _createDepositToken: string, - _createDepositAmount: BigNumberish, - _playDepositToken: string, - _playDepositAmount: BigNumberish, - _initialOwner: string, - overrides?: Overrides - ): TransactionRequest { - return super.getDeployTransaction( - _aragonGovernAddress, - _createDepositToken, - _createDepositAmount, - _playDepositToken, - _playDepositAmount, - _initialOwner, - overrides || {} - ); + getDeployTransaction(overrides?: Overrides): TransactionRequest { + return super.getDeployTransaction(overrides || {}); } attach(address: string): QuestFactory { return super.attach(address) as QuestFactory; @@ -67,38 +35,7 @@ export class QuestFactory__factory extends ContractFactory { const _abi = [ { - inputs: [ - { - internalType: "address", - name: "_aragonGovernAddress", - type: "address", - }, - { - internalType: "contract IERC20", - name: "_createDepositToken", - type: "address", - }, - { - internalType: "uint256", - name: "_createDepositAmount", - type: "uint256", - }, - { - internalType: "contract IERC20", - name: "_playDepositToken", - type: "address", - }, - { - internalType: "uint256", - name: "_playDepositAmount", - type: "uint256", - }, - { - internalType: "address", - name: "_initialOwner", - type: "address", - }, - ], + inputs: [], stateMutability: "nonpayable", type: "constructor", }, @@ -127,6 +64,19 @@ const _abi = [ name: "CreateDepositChanged", type: "event", }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8", + }, + ], + name: "Initialized", + type: "event", + }, { anonymous: false, inputs: [ @@ -211,40 +161,64 @@ const _abi = [ type: "address", }, { + components: [ + { + internalType: "contract IERC20Upgradeable", + name: "token", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], indexed: false, - internalType: "address", - name: "createDepositToken", - type: "address", - }, - { + internalType: "struct Models.Deposit", + name: "createDeposit", + type: "tuple", + }, + { + components: [ + { + internalType: "contract IERC20Upgradeable", + name: "token", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], indexed: false, - internalType: "uint256", - name: "createDepositAmount", - type: "uint256", + internalType: "struct Models.Deposit", + name: "playDeposit", + type: "tuple", }, { indexed: false, internalType: "address", - name: "playDepositToken", + name: "creator", type: "address", }, { indexed: false, - internalType: "uint256", - name: "playDepositAmount", - type: "uint256", + internalType: "uint32", + name: "maxPlayers", + type: "uint32", }, { indexed: false, - internalType: "address", - name: "creator", - type: "address", + internalType: "bool", + name: "isWhiteList", + type: "bool", }, { indexed: false, - internalType: "uint32", - name: "maxPlayers", - type: "uint32", + internalType: "uint256", + name: "version", + type: "uint256", }, ], name: "QuestCreated", @@ -268,7 +242,7 @@ const _abi = [ name: "createDeposit", outputs: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -294,7 +268,7 @@ const _abi = [ type: "bytes", }, { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "_rewardToken", type: "address", }, @@ -313,6 +287,11 @@ const _abi = [ name: "_maxPlayers", type: "uint32", }, + { + internalType: "bool", + name: "_isWhiteList", + type: "bool", + }, ], name: "createQuest", outputs: [ @@ -325,6 +304,19 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, + { + inputs: [ + { + internalType: "address", + name: "_aragonGovernAddress", + type: "address", + }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [], name: "owner", @@ -343,7 +335,7 @@ const _abi = [ name: "playDeposit", outputs: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -379,7 +371,7 @@ const _abi = [ { inputs: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -397,7 +389,7 @@ const _abi = [ { inputs: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -425,7 +417,20 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, + { + inputs: [], + name: "version", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, ]; const _bytecode = - "0x60806040523480156200001157600080fd5b506040516200396b3803806200396b83398101604081905262000034916200028c565b6200004862000042620000a3565b620000a7565b600180546001600160a01b0319166001600160a01b0388161790556200006f8585620000f7565b6200007b838362000177565b6001600160a01b038116331462000097576200009781620001eb565b505050505050620003b7565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6200010162000235565b6040805180820182526001600160a01b0384168082526020909101839052600280546001600160a01b03191690911790556003829055517f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f250920079906200016b9042908590859062000382565b60405180910390a15050565b6200018162000235565b6040805180820182526001600160a01b0384168082526020909101839052600480546001600160a01b03191690911790556005829055517f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb89906200016b9042908590859062000382565b620001f562000235565b6001600160a01b038116620002275760405162461bcd60e51b81526004016200021e9062000307565b60405180910390fd5b6200023281620000a7565b50565b6200023f620000a3565b6001600160a01b0316620002526200027d565b6001600160a01b0316146200027b5760405162461bcd60e51b81526004016200021e906200034d565b565b6000546001600160a01b031690565b60008060008060008060c08789031215620002a5578182fd5b8651620002b281620003a1565b6020880151909650620002c581620003a1565b604088015160608901519196509450620002df81620003a1565b608088015160a08901519194509250620002f981620003a1565b809150509295509295509295565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b9283526001600160a01b03919091166020830152604082015260600190565b6001600160a01b03811681146200023257600080fd5b6135a480620003c76000396000f3fe60806040523480156200001157600080fd5b5060043610620000cf5760003560e01c8063b0a87ac11162000081578063e87fae211162000063578063e87fae21146200015e578063edeecdd31462000175578063f2fde38b146200018c57620000cf565b8063b0a87ac1146200014a578063d03ffefb146200015457620000cf565b80638c43b41111620000b75780638c43b41114620000f75780638c53c9bd146200010e5780638da5cb5b146200013157620000cf565b8062732e3014620000d4578063715018a614620000ed575b600080fd5b620000eb620000e536600462000c39565b620001a3565b005b620000eb620001f4565b620000eb6200010836600462000c7a565b6200020c565b62000118620002b1565b6040516200012892919062000f50565b60405180910390f35b6200013b620002d3565b60405162000128919062000e2d565b6200013b620002ef565b620001186200030b565b6200013b6200016f36600462000ca8565b6200032d565b620000eb6200018636600462000c7a565b620004be565b620000eb6200019d36600462000c39565b62000557565b620001ad620005c8565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b620001fe620005c8565b6200020a600062000642565b565b62000216620005c8565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020909101839052600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001690911790556005829055517f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb8990620002a590429085908590620011ec565b60405180910390a15050565b60045460055473ffffffffffffffffffffffffffffffffffffffff9091169082565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60025460035473ffffffffffffffffffffffffffffffffffffffff9091169082565b60015460408051808201825260025473ffffffffffffffffffffffffffffffffffffffff9081168252600354602080840191909152835180850185526004548316815260055491810191909152925160009485948c948c948c948c9491909116928b929133908c90620003a09062000b6e565b620003b59a9998979695949392919062000f8b565b604051809103906000f080158015620003d2573d6000803e3d6000fd5b506040805180820190915260025473ffffffffffffffffffffffffffffffffffffffff168152600354602082015290915062000410903383620006b7565b7f6b2fd076e791d7e0318fa62bf6e275ebe9ff601badea3d9bfdc43c02317d1119818989898989600260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260010154600460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460010154338e604051620004ab9c9b9a9998979695949392919062000ea6565b60405180910390a1979650505050505050565b620004c8620005c8565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020909101839052600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001690911790556003829055517f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f25092007990620002a590429085908590620011ec565b62000561620005c8565b73ffffffffffffffffffffffffffffffffffffffff8116620005ba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001032565b60405180910390fd5b620005c58162000642565b50565b620005d2620006d4565b73ffffffffffffffffffffffffffffffffffffffff16620005f2620002d3565b73ffffffffffffffffffffffffffffffffffffffff16146200020a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b190620010ec565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620006c38383620006d8565b620006cf838262000807565b505050565b3390565b602082015115620008035781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e906200073d908590309060040162000e4e565b60206040518083038186803b1580156200075657600080fd5b505afa1580156200076b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000791919062000d7b565b90508260200151811015620007d4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001121565b60208301518351620006cf9173ffffffffffffffffffffffffffffffffffffffff90911690849030906200083f565b5050565b602082015115620008035760208201518251620008039173ffffffffffffffffffffffffffffffffffffffff909116908390620008ec565b620008e6846323b872dd60e01b858585604051602401620008639392919062000e75565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526200090e565b50505050565b620006cf8363a9059cbb60e01b84846040516024016200086392919062000f50565b600062000972826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620009cc9092919063ffffffff16565b805190915015620006cf578080602001905181019062000993919062000c58565b620006cf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1906200118f565b6060620009dd8484600085620009e7565b90505b9392505050565b60608247101562000a26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1906200108f565b62000a318562000af6565b62000a6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b19062001158565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405162000a95919062000e0f565b60006040518083038185875af1925050503d806000811462000ad4576040519150601f19603f3d011682016040523d82523d6000602084013e62000ad9565b606091505b509150915062000aeb82828662000b16565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff81163b15155b919050565b6060831562000b27575081620009e0565b82511562000b385782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005b1919062000f76565b6122d5806200129a83390190565b600067ffffffffffffffff8084111562000b9a5762000b9a62001247565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171562000be35762000be362001247565b8160405280935085815286868601111562000bfd57600080fd5b858560208301376000602087830101525050509392505050565b803562000b118162001276565b803563ffffffff8116811462000b1157600080fd5b60006020828403121562000c4b578081fd5b8135620009e08162001276565b60006020828403121562000c6a578081fd5b81518015158114620009e0578182fd5b6000806040838503121562000c8d578081fd5b823562000c9a8162001276565b946020939093013593505050565b60008060008060008060c0878903121562000cc1578182fd5b863567ffffffffffffffff8082111562000cd9578384fd5b818901915089601f83011262000ced578384fd5b62000cfe8a83356020850162000b7c565b9750602089013591508082111562000d14578384fd5b508701601f8101891362000d26578283fd5b62000d378982356020840162000b7c565b95505062000d486040880162000c17565b93506060870135925062000d5f6080880162000c17565b915062000d6f60a0880162000c24565b90509295509295509295565b60006020828403121562000d8d578081fd5b5051919050565b6000815180845262000dae81602086016020860162001218565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b805173ffffffffffffffffffffffffffffffffffffffff168252602090810151910152565b63ffffffff169052565b6000825162000e2381846020870162001218565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b600073ffffffffffffffffffffffffffffffffffffffff808f168352610180602084015262000eda61018084018f62000d94565b838103604085015262000eee818f62000d94565b925050808c1660608401528a6080840152808a1660a084015280891660c08401528760e0840152808716610100840152856101208401528085166101408401525062000f3f61016083018462000e05565b9d9c50505050505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b600060208252620009e0602083018462000d94565b600061018080835262000fa18184018e62000d94565b9050828103602084015262000fb7818d62000d94565b91505073ffffffffffffffffffffffffffffffffffffffff808b166040840152896060840152808916608084015280881660a084015262000ffc60c084018862000de0565b6200100c61010084018762000de0565b8085166101408401525063ffffffff83166101608301529b9a5050505050505050505050565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601d908201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b92835273ffffffffffffffffffffffffffffffffffffffff919091166020830152604082015260600190565b60005b83811015620012355781810151838201526020016200121b565b83811115620008e65750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620005c557600080fdfe60806040523480156200001157600080fd5b50604051620022d5380380620022d58339810160408190526200003491620002b7565b8951620000499060019060208d019062000118565b5088516200005f9060029060208c019062000118565b50600380546001600160a01b03199081166001600160a01b039a8b16179091556004979097556005805488169689169690961790955560068054600080548916938a16939093179092558351600880548916918a169190911790556020938401516009558251600a80548916918a169190911790559190920151600b55600c805460ff19169055931693169290921763ffffffff60a01b1916600160a01b63ffffffff90931692909202919091179055506200044e9050565b8280546200012690620003e2565b90600052602060002090601f0160209004810192826200014a576000855562000195565b82601f106200016557805160ff191683800117855562000195565b8280016001018555821562000195579182015b828111156200019557825182559160200191906001019062000178565b50620001a3929150620001a7565b5090565b5b80821115620001a35760008155600101620001a8565b8051620001cb8162000435565b919050565b600082601f830112620001e1578081fd5b81516001600160401b03811115620001fd57620001fd6200041f565b602062000213601f8301601f19168201620003af565b828152858284870101111562000227578384fd5b835b838110156200024657858101830151828201840152820162000229565b838111156200025757848385840101525b5095945050505050565b60006040828403121562000273578081fd5b6200027f6040620003af565b905081516200028e8162000435565b808252506020820151602082015292915050565b805163ffffffff81168114620001cb57600080fd5b6000806000806000806000806000806101808b8d031215620002d7578586fd5b8a516001600160401b0380821115620002ee578788fd5b620002fc8e838f01620001d0565b9b5060208d015191508082111562000312578788fd5b50620003218d828e01620001d0565b9950506200033260408c01620001be565b975060608b015196506200034960808c01620001be565b95506200035960a08c01620001be565b94506200036a8c60c08d0162000261565b93506200037c8c6101008d0162000261565b92506200038d6101408c01620001be565b91506200039e6101608c01620002a2565b90509295989b9194979a5092959850565b604051601f8201601f191681016001600160401b0381118282101715620003da57620003da6200041f565b604052919050565b600281046001821680620003f757607f821691505b602082108114156200041957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200044b57600080fd5b50565b611e77806200045e6000396000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80638c53c9bd116100b2578063d03ffefb11610081578063e492814f11610066578063e492814f14610255578063f294cf3814610268578063f7c618c11461027057610136565b8063d03ffefb14610238578063e0c234231461024057610136565b80638c53c9bd146101e5578063a888c2cd146101fb578063b0a87ac11461021d578063b434151c1461022557610136565b8063579ca2c9116101095780637ceae310116100ee5780637ceae310146101b557806385c99e2b146101bd5780638b5b9ccc146101d057610136565b8063579ca2c9146101985780636c3a4cce146101a057610136565b8063151dfb061461013b578063310a1ee31461015057806348d6cb531461016e5780634c2412a214610183575b600080fd5b61014e610149366004611638565b610278565b005b610158610553565b6040516101659190611cae565b60405180910390f35b610176610559565b60405161016591906118f2565b61018b610562565b6040516101659190611cb7565b61014e610586565b6101a861074f565b60405161016591906117f9565b6101a861076b565b6101766101cb366004611638565b610787565b6101d86107bd565b6040516101659190611898565b6101ed61082c565b604051610165929190611872565b61020e610209366004611763565b61084e565b60405161016593929190611910565b6101a8610927565b61014e61023336600461166e565b610943565b6101ed610cc0565b610248610ce2565b60405161016591906118fd565b61014e610263366004611638565b610d70565b610248610fe1565b6101a8610fee565b3373ffffffffffffffffffffffffffffffffffffffff821614806102b3575060005473ffffffffffffffffffffffffffffffffffffffff1633145b6102f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60405180910390fd5b60006102fd8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1415610359576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e9906119df565b600d805461036990600190611d05565b815481106103a0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610400577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d805480610480577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b549181019190915261051690836110d2565b7fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb6071555541758242604051610547929190611872565b60405180910390a15050565b60045481565b600c5460ff1681565b60065474010000000000000000000000000000000000000000900463ffffffff1681565b6004544210156105c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a73565b600c5460ff16610634576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff9081168252600954602083015261060892166110d2565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319061068b9030906004016117f9565b60206040518083038186803b1580156106a357600080fd5b505afa1580156106b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106db919061177b565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff9182169116141561072257600d54600b5461071e9161071791611cc8565b829061110b565b9150505b60065460035461074c9173ffffffffffffffffffffffffffffffffffffffff918216911683611131565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60006107928261100a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d80548060200260200160405190810160405280929190818152602001828054801561082257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116107f7575b5050505050905090565b600a54600b5473ffffffffffffffffffffffffffffffffffffffff9091169082565b6007818154811061085e57600080fd5b906000526020600020906003020160009150905080600001805461088190611d48565b80601f01602080910402602001604051908101604052809291908181526020018280546108ad90611d48565b80156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60055473ffffffffffffffffffffffffffffffffffffffff163314610994576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611ae1565b83516109cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b86565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a0823190610a239030906004016117f9565b60206040518083038186803b158015610a3b57600080fd5b505afa158015610a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a73919061177b565b90508115610b095760085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610abc57600954600090610ab290839061110b565b9450610ac0915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b0957600d54600b54600091610b0491610afd9190611cc8565b859061110b565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b7f576000610b3b828561110b565b915050600860010154811015610b7d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611982565b505b8215610ba957600354610ba99073ffffffffffffffffffffffffffffffffffffffff168585611131565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880192610c279284920190611570565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b90610cb190879087908790611910565b60405180910390a15050505050565b60085460095473ffffffffffffffffffffffffffffffffffffffff9091169082565b60028054610cef90611d48565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1b90611d48565b8015610d685780601f10610d3d57610100808354040283529160200191610d68565b820191906000526020600020905b815481529060010190602001808311610d4b57829003601f168201915b505050505081565b3373ffffffffffffffffffffffffffffffffffffffff82161480610dab575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610de1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60065474010000000000000000000000000000000000000000900463ffffffff161580610e305750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b610e66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611aaa565b6004544210610ea1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e99061194b565b6000610eac8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610f07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bbd565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b546020820152610f3f9033306111d7565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790556040517f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a1906105479084904290611872565b60018054610cef90611d48565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b6000805b600d548110156110aa578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611069577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156110985790506107b8565b806110a281611d9c565b91505061100e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b60208201511561110757602082015182516111079173ffffffffffffffffffffffffffffffffffffffff909116908390611131565b5050565b600080838311156111215750600090508061112a565b50600190508183035b9250929050565b6111d28363a9059cbb60e01b8484604051602401611150929190611872565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526111eb565b505050565b6111e183836112a1565b6111d283826110d2565b600061124d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166113c09092919063ffffffff16565b8051909150156111d2578080602001905181019061126b9190611652565b6111d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bf4565b6020820151156111075781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e90611303908590309060040161181a565b60206040518083038186803b15801561131b57600080fd5b505afa15801561132f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611353919061177b565b90508260200151811015611393576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b18565b602083015183516111d29173ffffffffffffffffffffffffffffffffffffffff90911690849030906113d9565b60606113cf8484600085611400565b90505b9392505050565b6113fa846323b872dd60e01b85858560405160240161115093929190611841565b50505050565b60608247101561143c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a16565b61144585611501565b61147b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b4f565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114a491906117dd565b60006040518083038185875af1925050503d80600081146114e1576040519150601f19603f3d011682016040523d82523d6000602084013e6114e6565b606091505b50915091506114f682828661151d565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6060831561152c5750816113d2565b82511561153c5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e991906118fd565b82805461157c90611d48565b90600052602060002090601f01602090048101928261159e57600085556115e4565b82601f106115b757805160ff19168380011785556115e4565b828001600101855582156115e4579182015b828111156115e45782518255916020019190600101906115c9565b506115f09291506115f4565b5090565b5b808211156115f057600081556001016115f5565b803573ffffffffffffffffffffffffffffffffffffffff811681146107b857600080fd5b80356107b881611e33565b600060208284031215611649578081fd5b6113d282611609565b600060208284031215611663578081fd5b81516113d281611e33565b60008060008060808587031215611683578283fd5b843567ffffffffffffffff8082111561169a578485fd5b818701915087601f8301126116ad578485fd5b8135818111156116bf576116bf611e04565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561170557611705611e04565b816040528281528a602084870101111561171d578788fd5b826020860160208301378760208483010152809850505050505061174360208601611609565b9250604085013591506117586060860161162d565b905092959194509250565b600060208284031215611774578081fd5b5035919050565b60006020828403121561178c578081fd5b5051919050565b600081518084526117ab816020860160208601611d1c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516117ef818460208701611d1c565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156118e657835173ffffffffffffffffffffffffffffffffffffffff16835292840192918401916001016118b4565b50909695505050505050565b901515815260200190565b6000602082526113d26020830184611793565b6000606082526119236060830186611793565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b60208082526014908201527f4552524f523a2051756573742065787069726564000000000000000000000000604082015260600190565b60208082526027908201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460408201527f20626f756e747900000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f4552524f523a20706c61796572206e6f7420696e206c69737400000000000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526012908201527f4552524f523a204e6f7420657870697265640000000000000000000000000000604082015260600190565b6020808252601a908201527f4552524f523a204d617820706c61796572732072656163686564000000000000604082015260600190565b60208082526018908201527f4552524f523a2053656e646572206e6f7420676f7665726e0000000000000000604082015260600190565b6020808252601d908201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526012908201527f4552524f523a204e6f2065766964656e63650000000000000000000000000000604082015260600190565b6020808252601c908201527f4552524f523a20506c6179657220616c72656164792065786973747300000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560408201527f61746f7200000000000000000000000000000000000000000000000000000000606082015260800190565b90815260200190565b63ffffffff91909116815260200190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611d0057611d00611dd5565b500290565b600082821015611d1757611d17611dd5565b500390565b60005b83811015611d37578181015183820152602001611d1f565b838111156113fa5750506000910152565b600281046001821680611d5c57607f821691505b60208210811415611d96577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611dce57611dce611dd5565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b801515811461074c57600080fdfea2646970667358221220001ecc7e3a56a6e8ceba0a2f6f0020ef13bacde460faf1b1cca5699bfd12ab1764736f6c63430008010033a264697066735822122006ddcb5ccdb8532fd391ece411b1311d2d44d237eb8d1044c11f2c762c9eb08564736f6c63430008010033"; + "0x608060405234801561001057600080fd5b5061001961001e565b6100dd565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116146100db576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b614076806100ec6000396000f3fe60806040523480156200001157600080fd5b5060043610620000e75760003560e01c8063b0a87ac1116200008d578063d03ffefb1162000063578063d03ffefb1462000223578063edeecdd31462000248578063f2fde38b146200025f57620000e7565b8063b0a87ac114620001d4578063b628a33f14620001f5578063c4d66de8146200020c57620000e7565b80638c43b41111620000c35780638c43b411146200012b5780638c53c9bd14620001425780638da5cb5b146200019457620000e7565b8062732e3014620000ec57806354fd4d501462000105578063715018a61462000121575b600080fd5b62000103620000fd366004620011a4565b62000276565b005b6200010e600381565b6040519081526020015b60405180910390f35b62000103620002c7565b620001036200013c366004620011e2565b620002df565b606854606954620001679173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091520162000118565b60335473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200162000118565b606554620001ae9073ffffffffffffffffffffffffffffffffffffffff1681565b620001ae6200020636600462001210565b62000384565b620001036200021d366004620011a4565b620004ef565b606654606754620001679173ffffffffffffffffffffffffffffffffffffffff169082565b6200010362000259366004620011e2565b620006d5565b6200010362000270366004620011a4565b62000773565b6200028062000830565b606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b620002d162000830565b620002dd6000620008b3565b565b620002e962000830565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020918201849052606880547fffffffffffffffffffffffff0000000000000000000000000000000000000000168217905560698490558251428152918201529081018290527f013c800b1a136f9798a25e471501a7b824156d1e9cba8439821c5a41adf2fb89906060015b60405180910390a15050565b60408051808201825260665473ffffffffffffffffffffffffffffffffffffffff9081168252606754602080840191909152835180850185526068548316815260695481830152845160e08101865233815263ffffffff88169281019290925289831682860152606082018990526065548316608083015291871660a082015284151560c0820152925160009384938c938c93919290916200042690620010a3565b6200043695949392919062001468565b604051809103906000f08015801562000453573d6000803e3d6000fd5b506040805180820190915260665473ffffffffffffffffffffffffffffffffffffffff1681526067546020820152909150620004919033836200092a565b7f2d0b32d809449b38bb442a046b092f68efaf9d4bef7678947afd25048117f187818a8a8a8a8a60666068338d8d6003604051620004db9c9b9a9998979695949392919062001366565b60405180910390a198975050505050505050565b600054610100900460ff1615808015620005105750600054600160ff909116105b80620005355750620005223062000947565b15801562000535575060005460ff166001145b620005c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200062657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b6200063062000967565b606580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790558015620006d157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200162000378565b5050565b620006df62000830565b60408051808201825273ffffffffffffffffffffffffffffffffffffffff84168082526020918201849052606680547fffffffffffffffffffffffff0000000000000000000000000000000000000000168217905560678490558251428152918201529081018290527f35c5e8a6f8bed2c61a2eb1996d117b1b96192314c0d4ca7cd96360f2509200799060600162000378565b6200077d62000830565b73ffffffffffffffffffffffffffffffffffffffff811662000822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401620005be565b6200082d81620008b3565b50565b60335473ffffffffffffffffffffffffffffffffffffffff163314620002dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401620005be565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b62000936838362000a0a565b62000942838262000b63565b505050565b73ffffffffffffffffffffffffffffffffffffffff81163b15155b919050565b600054610100900460ff1662000a00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401620005be565b620002dd62000b9b565b602082015115620006d15781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b15801562000a8757600080fd5b505afa15801562000a9c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ac29190620012e3565b9050826020015181101562000b34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401620005be565b60208301518351620009429173ffffffffffffffffffffffffffffffffffffffff909116908490309062000c3f565b602082015115620006d15760208201518251620006d19173ffffffffffffffffffffffffffffffffffffffff90911690839062000d23565b600054610100900460ff1662000c34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401620005be565b620002dd33620008b3565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905262000d1d9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262000d7b565b50505050565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052620009429084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640162000c9a565b600062000ddf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1662000e919092919063ffffffff16565b905080516000148062000e0357508080602001905181019062000e039190620011c3565b62000942576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401620005be565b606062000ea2848460008562000eaa565b949350505050565b60608247101562000f3e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401620005be565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405162000f69919062001348565b60006040518083038185875af1925050503d806000811462000fa8576040519150601f19603f3d011682016040523d82523d6000602084013e62000fad565b606091505b509150915062000fc08783838762000fcb565b979650505050505050565b60608315620010565782516200104e5762000fe68562000947565b6200104e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620005be565b508162000ea2565b62000ea283838151156200106d5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005be919062001453565b612a2e806200161383390190565b600067ffffffffffffffff80841115620010cf57620010cf620015b1565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715620011185762001118620015b1565b816040528093508581528686860111156200113257600080fd5b858560208301376000602087830101525050509392505050565b80356200096281620015e0565b8035620009628162001603565b600082601f83011262001177578081fd5b6200118883833560208501620010b1565b9392505050565b803563ffffffff811681146200096257600080fd5b600060208284031215620011b6578081fd5b81356200118881620015e0565b600060208284031215620011d5578081fd5b8151620011888162001603565b60008060408385031215620011f5578081fd5b82356200120281620015e0565b946020939093013593505050565b600080600080600080600060e0888a0312156200122b578283fd5b873567ffffffffffffffff8082111562001243578485fd5b818a0191508a601f83011262001257578485fd5b620012688b833560208501620010b1565b985060208a01359150808211156200127e578485fd5b506200128d8a828b0162001166565b9650506200129e604089016200114c565b945060608801359350620012b5608089016200114c565b9250620012c560a089016200118f565b9150620012d560c0890162001159565b905092959891949750929550565b600060208284031215620012f5578081fd5b5051919050565b600081518084526200131681602086016020860162001582565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516200135c81846020870162001582565b9190910192915050565b600073ffffffffffffffffffffffffffffffffffffffff808f1683526101c060208401526200139a6101c084018f620012fc565b8381036040850152620013ae818f620012fc565b925050808c1660608401528a6080840152808a1660a0840152620013f660c084018a805473ffffffffffffffffffffffffffffffffffffffff16825260010154602090910152565b875473ffffffffffffffffffffffffffffffffffffffff166101008401526001909701546101208301529590941661014085015263ffffffff9290921661016084015215156101808301526101a090910152979650505050505050565b600060208252620011886020830184620012fc565b60006101a08083526200147e81840189620012fc565b90508281036020840152620014948188620012fc565b865173ffffffffffffffffffffffffffffffffffffffff166040850152602087015160608501529150620014c59050565b835173ffffffffffffffffffffffffffffffffffffffff166080830152602084015160a0830152825173ffffffffffffffffffffffffffffffffffffffff90811660c0840152602084015163ffffffff1660e084015260408401518116610100840152606084015161012084015260808401511661014083015260a08301516200156861016084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060c0830151801515610180840152509695505050505050565b60005b838110156200159f57818101518382015260200162001585565b8381111562000d1d5750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146200082d57600080fd5b80151581146200082d57600080fdfe60806040523480156200001157600080fd5b5060405162002a2e38038062002a2e833981016040819052620000349162000423565b8060c0015180156200005057506000816020015163ffffffff16115b15620000e35760405162461bcd60e51b815260206004820152605260248201527f4552524f523a2043616e27742063726561746520612077686974654c6973746560448201527f642071756573742077697468206d617820706c61796572732067726561746572606482015271207468616e20302028696e66696e6974792960701b608482015260a40160405180910390fd5b8451620000f8906001906020880190620001f1565b5083516200010e906002906020870190620001f1565b506040810151600380546001600160a01b03199081166001600160a01b03938416179091556060830151600455608083015160058054831691841691909117905560a083015160068054855160008054861691871691909117905587516008805486169187169190911790556020978801516009558651600a8054861691871691909117905595870151600b55600c805460ff191690559584015160c0909401519490911691161763ffffffff60a01b1916600160a01b63ffffffff909216919091021760ff60c01b1916600160c01b9115159190910217905550620005909050565b828054620001ff9062000524565b90600052602060002090601f0160209004810192826200022357600085556200026e565b82601f106200023e57805160ff19168380011785556200026e565b828001600101855582156200026e579182015b828111156200026e57825182559160200191906001019062000251565b506200027c92915062000280565b5090565b5b808211156200027c576000815560010162000281565b60006001600160401b03831115620002b357620002b362000561565b6020620002c9601f8501601f19168201620004f1565b9150838252848484011115620002de57600080fd5b60005b84811015620002fc57838101518382018301528101620002e1565b848111156200030e5760008286850101525b50509392505050565b8051620003248162000577565b919050565b805180151581146200032457600080fd5b6000604082840312156200034c578081fd5b620003586040620004f1565b90508151620003678162000577565b808252506020820151602082015292915050565b600060e082840312156200038d578081fd5b6200039960e0620004f1565b90508151620003a88162000577565b8152602082015163ffffffff81168114620003c257600080fd5b6020820152620003d56040830162000317565b604082015260608201516060820152620003f26080830162000317565b60808201526200040560a0830162000317565b60a08201526200041860c0830162000329565b60c082015292915050565b60008060008060006101a086880312156200043c578081fd5b85516001600160401b038082111562000453578283fd5b818801915088601f83011262000467578283fd5b620004788983516020850162000297565b965060208801519150808211156200048e578283fd5b508601601f81018813620004a0578182fd5b620004b18882516020840162000297565b945050620004c387604088016200033a565b9250620004d487608088016200033a565b9150620004e58760c088016200037b565b90509295509295909350565b604051601f8201601f191681016001600160401b03811182821017156200051c576200051c62000561565b604052919050565b6002810460018216806200053957607f821691505b602082108114156200055b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200058d57600080fd5b50565b61248e80620005a06000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c80638b5b9ccc116100cd578063d03ffefb11610081578063e492814f11610066578063e492814f146103ab578063f294cf38146103be578063f7c618c1146103c65761016c565b8063d03ffefb14610372578063e0c23423146103965761016c565b8063a888c2cd116100b2578063a888c2cd1461031d578063b0a87ac11461033f578063b434151c1461035f5761016c565b80638b5b9ccc146102b85780638c53c9bd146102cd5761016c565b8063579ca2c911610124578063775b9c1311610109578063775b9c13146102725780637ceae3101461028557806385c99e2b146102a55761016c565b8063579ca2c9146102255780636c3a4cce1461022d5761016c565b8063310a1ee311610155578063310a1ee3146101c457806348d6cb53146101db5780634c2412a2146101e85761016c565b8063151dfb06146101715780632f17b18214610186575b600080fd5b61018461017f366004611f3f565b6103e6565b005b6006546101af907801000000000000000000000000000000000000000000000000900460ff1681565b60405190151581526020015b60405180910390f35b6101cd60045481565b6040519081526020016101bb565b600c546101af9060ff1681565b6006546102109074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff90911681526020016101bb565b610184610807565b60005461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101bb565b610184610280366004611f60565b6109fb565b60065461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6101af6102b3366004611f3f565b610cc8565b6102c0610cfe565b6040516101bb91906121e9565b600a54600b546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016101bb565b61033061032b366004612103565b610d6d565b6040516101bb93929190612231565b60055461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b61018461036d36600461202a565b610e46565b6008546009546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b61039e611274565b6040516101bb919061221e565b6101846103b9366004611f3f565b611302565b61039e61170d565b60035461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6006547801000000000000000000000000000000000000000000000000900460ff161561049a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2063616e277420756e706c617920612077686974656c6973746560448201527f642071756573740000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff821614806104d5575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610560576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b600061056b8261171a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156105f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552524f523a20706c61796572206e6f7420696e206c697374000000000000006044820152606401610491565b600d8054610607906001906122f8565b8154811061063e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff909216918390811061069e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d80548061071e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54918101919091526107b490836117e2565b6040805173ffffffffffffffffffffffffffffffffffffffff841681524260208201527fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb60715555417591015b60405180910390a15050565b600454421015610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f74206578706972656400000000000000000000000000006044820152606401610491565b600c5460ff166108e5576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff908116825260095460208301526108b992166117e2565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561094f57600080fd5b505afa158015610963573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610987919061211b565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff918216911614156109ce57600d54600b546109ca916109c3916122bb565b829061181b565b9150505b6006546003546109f89173ffffffffffffffffffffffffffffffffffffffff918216911683611841565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610aa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f4f6e6c792063726561746f722063616e2063616c6c20746869732066756e637460448201527f696f6e00000000000000000000000000000000000000000000000000000000006064820152608401610491565b6006547801000000000000000000000000000000000000000000000000900460ff161515600114610b55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4552524f523a2043616e27742073657420746865207768697465206c6973742060448201527f746f2061206e6f6e2d77686974656c697374656420636f6e74726163740000006064820152608401610491565b6000805b82518163ffffffff161015610bf457610bb7838263ffffffff1681518110610baa577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015161171a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610be257600191505b80610bec816123c8565b915050610b59565b508015610c83576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552524f523a204f6e65206f72206d6f726520706c617965727320697320616c60448201527f726561647920696e2077686974656c69737400000000000000000000000000006064820152608401610491565b8151610c9690600d906020850190611dfd565b507fb1565d66d9899787abe67ac307850cf339a24f69de2bf7ffa4179e0eaeb939b082426040516107fb9291906121fc565b6000610cd38261171a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d805480602002602001604051908101604052809291908181526020018280548015610d6357602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610d38575b5050505050905090565b60078181548110610d7d57600080fd5b9060005260206000209060030201600091509050806000018054610da09061233b565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcc9061233b565b8015610e195780601f10610dee57610100808354040283529160200191610e19565b820191906000526020600020905b815481529060010190602001808311610dfc57829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff163314610ec7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552524f523a2053656e646572206e6f7420676f7665726e00000000000000006044820152606401610491565b8351610f2f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f2065766964656e636500000000000000000000000000006044820152606401610491565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b158015610f9957600080fd5b505afa158015610fad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd1919061211b565b905081156110675760085460035473ffffffffffffffffffffffffffffffffffffffff9081169116141561101a5760095460009061101090839061181b565b945061101e915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff9081169116141561106757600d54600b546000916110629161105b91906122bb565b859061181b565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415611133576000611099828561181b565b915050600860010154811015611131576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460448201527f20626f756e7479000000000000000000000000000000000000000000000000006064820152608401610491565b505b821561115d5760035461115d9073ffffffffffffffffffffffffffffffffffffffff168585611841565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801926111db9284920190611e87565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b9061126590879087908790612231565b60405180910390a15050505050565b600280546112819061233b565b80601f01602080910402602001604051908101604052809291908181526020018280546112ad9061233b565b80156112fa5780601f106112cf576101008083540402835291602001916112fa565b820191906000526020600020905b8154815290600101906020018083116112dd57829003601f168201915b505050505081565b6006547801000000000000000000000000000000000000000000000000900460ff16156113b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4552524f523a2043616e27742073656c6620726567697374657220616e64207060448201527f6c617920612077686974656c69737465642051756573740000000000000000006064820152608401610491565b3373ffffffffffffffffffffffffffffffffffffffff821614806113ec575060005473ffffffffffffffffffffffffffffffffffffffff1633145b611477576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b60065474010000000000000000000000000000000000000000900463ffffffff1615806114c65750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b61152c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4552524f523a204d617820706c617965727320726561636865640000000000006044820152606401610491565b6004544210611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4552524f523a20517565737420657870697265640000000000000000000000006044820152606401610491565b60006115a28261171a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461162d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552524f523a20506c6179657220616c726561647920657869737473000000006044820152606401610491565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54602082015261166590333061191a565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155604080519182524260208301527f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a191016107fb565b600180546112819061233b565b6000805b600d548110156117ba578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611779577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156117a8579050610cf9565b806117b28161238f565b91505061171e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b60208201511561181757602082015182516118179173ffffffffffffffffffffffffffffffffffffffff909116908390611841565b5050565b600080838311156118315750600090508061183a565b50600190508183035b9250929050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526119159084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261192e565b505050565b6119248383611a3d565b61191583826117e2565b6000611990826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611b8d9092919063ffffffff16565b90508051600014806119b15750808060200190518101906119b1919061200e565b611915576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610491565b6020820151156118175781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b158015611ab857600080fd5b505afa158015611acc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af0919061211b565b90508260200151811015611b60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401610491565b602083015183516119159173ffffffffffffffffffffffffffffffffffffffff9091169084903090611ba4565b6060611b9c8484600085611c08565b949350505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611c029085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611893565b50505050565b606082471015611c9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610491565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611cc391906121cd565b60006040518083038185875af1925050503d8060008114611d00576040519150601f19603f3d011682016040523d82523d6000602084013e611d05565b606091505b5091509150611d1687838387611d21565b979650505050505050565b60608315611db4578251611dad5773ffffffffffffffffffffffffffffffffffffffff85163b611dad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610491565b5081611b9c565b611b9c8383815115611dc95781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610491919061221e565b828054828255906000526020600020908101928215611e77579160200282015b82811115611e7757825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611e1d565b50611e83929150611efb565b5090565b828054611e939061233b565b90600052602060002090601f016020900481019282611eb55760008555611e77565b82601f10611ece57805160ff1916838001178555611e77565b82800160010185558215611e77579182015b82811115611e77578251825591602001919060010190611ee0565b5b80821115611e835760008155600101611efc565b803573ffffffffffffffffffffffffffffffffffffffff81168114610cf957600080fd5b8035610cf98161244a565b600060208284031215611f50578081fd5b611f5982611f10565b9392505050565b60006020808385031215611f72578182fd5b823567ffffffffffffffff80821115611f89578384fd5b818501915085601f830112611f9c578384fd5b813581811115611fae57611fae61241b565b8381029150611fbe84830161226c565b8181528481019084860184860187018a1015611fd8578788fd5b8795505b8386101561200157611fed81611f10565b835260019590950194918601918601611fdc565b5098975050505050505050565b60006020828403121561201f578081fd5b8151611f598161244a565b6000806000806080858703121561203f578283fd5b843567ffffffffffffffff80821115612056578485fd5b818701915087601f830112612069578485fd5b813560208282111561207d5761207d61241b565b6120ad817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160161226c565b925081835289818386010111156120c2578687fd5b8181850182850137868183850101528297506120df818a01611f10565b965050505050604085013591506120f860608601611f34565b905092959194509250565b600060208284031215612114578081fd5b5035919050565b60006020828403121561212c578081fd5b5051919050565b6000815180845260208085019450808401835b8381101561217857815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101612146565b509495945050505050565b6000815180845261219b81602086016020860161230f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516121df81846020870161230f565b9190910192915050565b600060208252611f596020830184612133565b60006040825261220f6040830185612133565b90508260208301529392505050565b600060208252611f596020830184612183565b6000606082526122446060830186612183565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156122b3576122b361241b565b604052919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156122f3576122f36123ec565b500290565b60008282101561230a5761230a6123ec565b500390565b60005b8381101561232a578181015183820152602001612312565b83811115611c025750506000910152565b60028104600182168061234f57607f821691505b60208210811415612389577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156123c1576123c16123ec565b5060010190565b600063ffffffff808316818114156123e2576123e26123ec565b6001019392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b80151581146109f857600080fdfea26469706673582212201d95e7743bcb101068cc9a865b5573cbcd2079b13e70e82b4992d89773670e1c64736f6c63430008020033a2646970667358221220cafd3128d67a577592a54666fe90eb14cbffaab5a5d7020a86280d4fe134225964736f6c63430008020033"; diff --git a/packages/hardhat/typechain/factories/Quest__factory.ts b/packages/hardhat/typechain/factories/Quest__factory.ts index cc62bee4..9f04ee40 100644 --- a/packages/hardhat/typechain/factories/Quest__factory.ts +++ b/packages/hardhat/typechain/factories/Quest__factory.ts @@ -16,54 +16,50 @@ export class Quest__factory extends ContractFactory { deploy( _questTitle: string, _questDetailsRef: BytesLike, - _rewardToken: string, - _expireTime: BigNumberish, - _aragonGovernAddress: string, - _fundsRecoveryAddress: string, _createDeposit: { token: string; amount: BigNumberish }, _playDeposit: { token: string; amount: BigNumberish }, - _questCreator: string, - _maxPlayers: BigNumberish, + _questParam: { + questCreator: string; + maxPlayers: BigNumberish; + rewardToken: string; + expireTime: BigNumberish; + aragonGovernAddress: string; + fundsRecoveryAddress: string; + isWhiteList: boolean; + }, overrides?: Overrides ): Promise { return super.deploy( _questTitle, _questDetailsRef, - _rewardToken, - _expireTime, - _aragonGovernAddress, - _fundsRecoveryAddress, _createDeposit, _playDeposit, - _questCreator, - _maxPlayers, + _questParam, overrides || {} ) as Promise; } getDeployTransaction( _questTitle: string, _questDetailsRef: BytesLike, - _rewardToken: string, - _expireTime: BigNumberish, - _aragonGovernAddress: string, - _fundsRecoveryAddress: string, _createDeposit: { token: string; amount: BigNumberish }, _playDeposit: { token: string; amount: BigNumberish }, - _questCreator: string, - _maxPlayers: BigNumberish, + _questParam: { + questCreator: string; + maxPlayers: BigNumberish; + rewardToken: string; + expireTime: BigNumberish; + aragonGovernAddress: string; + fundsRecoveryAddress: string; + isWhiteList: boolean; + }, overrides?: Overrides ): TransactionRequest { return super.getDeployTransaction( _questTitle, _questDetailsRef, - _rewardToken, - _expireTime, - _aragonGovernAddress, - _fundsRecoveryAddress, _createDeposit, _playDeposit, - _questCreator, - _maxPlayers, + _questParam, overrides || {} ); } @@ -91,30 +87,10 @@ const _abi = [ name: "_questDetailsRef", type: "bytes", }, - { - internalType: "contract IERC20", - name: "_rewardToken", - type: "address", - }, - { - internalType: "uint256", - name: "_expireTime", - type: "uint256", - }, - { - internalType: "address", - name: "_aragonGovernAddress", - type: "address", - }, - { - internalType: "address payable", - name: "_fundsRecoveryAddress", - type: "address", - }, { components: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -131,7 +107,7 @@ const _abi = [ { components: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -146,14 +122,46 @@ const _abi = [ type: "tuple", }, { - internalType: "address", - name: "_questCreator", - type: "address", - }, - { - internalType: "uint32", - name: "_maxPlayers", - type: "uint32", + components: [ + { + internalType: "address", + name: "questCreator", + type: "address", + }, + { + internalType: "uint32", + name: "maxPlayers", + type: "uint32", + }, + { + internalType: "contract IERC20Upgradeable", + name: "rewardToken", + type: "address", + }, + { + internalType: "uint256", + name: "expireTime", + type: "uint256", + }, + { + internalType: "address", + name: "aragonGovernAddress", + type: "address", + }, + { + internalType: "address payable", + name: "fundsRecoveryAddress", + type: "address", + }, + { + internalType: "bool", + name: "isWhiteList", + type: "bool", + }, + ], + internalType: "struct Models.QuestParam", + name: "_questParam", + type: "tuple", }, ], stateMutability: "nonpayable", @@ -222,6 +230,25 @@ const _abi = [ name: "QuestUnplayed", type: "event", }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address[]", + name: "whiteListPlayers", + type: "address[]", + }, + { + indexed: false, + internalType: "uint256", + name: "timestamp", + type: "uint256", + }, + ], + name: "QuestWhiteListChanged", + type: "event", + }, { inputs: [], name: "aragonGovernAddress", @@ -316,7 +343,7 @@ const _abi = [ name: "createDeposit", outputs: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -381,6 +408,19 @@ const _abi = [ stateMutability: "view", type: "function", }, + { + inputs: [], + name: "isWhiteList", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, { inputs: [], name: "maxPlayers", @@ -412,7 +452,7 @@ const _abi = [ name: "playDeposit", outputs: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "token", type: "address", }, @@ -476,7 +516,7 @@ const _abi = [ name: "rewardToken", outputs: [ { - internalType: "contract IERC20", + internalType: "contract IERC20Upgradeable", name: "", type: "address", }, @@ -484,6 +524,19 @@ const _abi = [ stateMutability: "view", type: "function", }, + { + inputs: [ + { + internalType: "address[]", + name: "_players", + type: "address[]", + }, + ], + name: "setWhiteList", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [ { @@ -500,4 +553,4 @@ const _abi = [ ]; const _bytecode = - "0x60806040523480156200001157600080fd5b50604051620022d5380380620022d58339810160408190526200003491620002b7565b8951620000499060019060208d019062000118565b5088516200005f9060029060208c019062000118565b50600380546001600160a01b03199081166001600160a01b039a8b16179091556004979097556005805488169689169690961790955560068054600080548916938a16939093179092558351600880548916918a169190911790556020938401516009558251600a80548916918a169190911790559190920151600b55600c805460ff19169055931693169290921763ffffffff60a01b1916600160a01b63ffffffff90931692909202919091179055506200044e9050565b8280546200012690620003e2565b90600052602060002090601f0160209004810192826200014a576000855562000195565b82601f106200016557805160ff191683800117855562000195565b8280016001018555821562000195579182015b828111156200019557825182559160200191906001019062000178565b50620001a3929150620001a7565b5090565b5b80821115620001a35760008155600101620001a8565b8051620001cb8162000435565b919050565b600082601f830112620001e1578081fd5b81516001600160401b03811115620001fd57620001fd6200041f565b602062000213601f8301601f19168201620003af565b828152858284870101111562000227578384fd5b835b838110156200024657858101830151828201840152820162000229565b838111156200025757848385840101525b5095945050505050565b60006040828403121562000273578081fd5b6200027f6040620003af565b905081516200028e8162000435565b808252506020820151602082015292915050565b805163ffffffff81168114620001cb57600080fd5b6000806000806000806000806000806101808b8d031215620002d7578586fd5b8a516001600160401b0380821115620002ee578788fd5b620002fc8e838f01620001d0565b9b5060208d015191508082111562000312578788fd5b50620003218d828e01620001d0565b9950506200033260408c01620001be565b975060608b015196506200034960808c01620001be565b95506200035960a08c01620001be565b94506200036a8c60c08d0162000261565b93506200037c8c6101008d0162000261565b92506200038d6101408c01620001be565b91506200039e6101608c01620002a2565b90509295989b9194979a5092959850565b604051601f8201601f191681016001600160401b0381118282101715620003da57620003da6200041f565b604052919050565b600281046001821680620003f757607f821691505b602082108114156200041957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200044b57600080fd5b50565b611e77806200045e6000396000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80638c53c9bd116100b2578063d03ffefb11610081578063e492814f11610066578063e492814f14610255578063f294cf3814610268578063f7c618c11461027057610136565b8063d03ffefb14610238578063e0c234231461024057610136565b80638c53c9bd146101e5578063a888c2cd146101fb578063b0a87ac11461021d578063b434151c1461022557610136565b8063579ca2c9116101095780637ceae310116100ee5780637ceae310146101b557806385c99e2b146101bd5780638b5b9ccc146101d057610136565b8063579ca2c9146101985780636c3a4cce146101a057610136565b8063151dfb061461013b578063310a1ee31461015057806348d6cb531461016e5780634c2412a214610183575b600080fd5b61014e610149366004611638565b610278565b005b610158610553565b6040516101659190611cae565b60405180910390f35b610176610559565b60405161016591906118f2565b61018b610562565b6040516101659190611cb7565b61014e610586565b6101a861074f565b60405161016591906117f9565b6101a861076b565b6101766101cb366004611638565b610787565b6101d86107bd565b6040516101659190611898565b6101ed61082c565b604051610165929190611872565b61020e610209366004611763565b61084e565b60405161016593929190611910565b6101a8610927565b61014e61023336600461166e565b610943565b6101ed610cc0565b610248610ce2565b60405161016591906118fd565b61014e610263366004611638565b610d70565b610248610fe1565b6101a8610fee565b3373ffffffffffffffffffffffffffffffffffffffff821614806102b3575060005473ffffffffffffffffffffffffffffffffffffffff1633145b6102f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60405180910390fd5b60006102fd8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1415610359576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e9906119df565b600d805461036990600190611d05565b815481106103a0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610400577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d805480610480577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b549181019190915261051690836110d2565b7fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb6071555541758242604051610547929190611872565b60405180910390a15050565b60045481565b600c5460ff1681565b60065474010000000000000000000000000000000000000000900463ffffffff1681565b6004544210156105c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a73565b600c5460ff16610634576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff9081168252600954602083015261060892166110d2565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319061068b9030906004016117f9565b60206040518083038186803b1580156106a357600080fd5b505afa1580156106b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106db919061177b565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff9182169116141561072257600d54600b5461071e9161071791611cc8565b829061110b565b9150505b60065460035461074c9173ffffffffffffffffffffffffffffffffffffffff918216911683611131565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60006107928261100a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d80548060200260200160405190810160405280929190818152602001828054801561082257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116107f7575b5050505050905090565b600a54600b5473ffffffffffffffffffffffffffffffffffffffff9091169082565b6007818154811061085e57600080fd5b906000526020600020906003020160009150905080600001805461088190611d48565b80601f01602080910402602001604051908101604052809291908181526020018280546108ad90611d48565b80156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60055473ffffffffffffffffffffffffffffffffffffffff163314610994576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611ae1565b83516109cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b86565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a0823190610a239030906004016117f9565b60206040518083038186803b158015610a3b57600080fd5b505afa158015610a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a73919061177b565b90508115610b095760085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610abc57600954600090610ab290839061110b565b9450610ac0915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b0957600d54600b54600091610b0491610afd9190611cc8565b859061110b565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415610b7f576000610b3b828561110b565b915050600860010154811015610b7d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611982565b505b8215610ba957600354610ba99073ffffffffffffffffffffffffffffffffffffffff168585611131565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880192610c279284920190611570565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b90610cb190879087908790611910565b60405180910390a15050505050565b60085460095473ffffffffffffffffffffffffffffffffffffffff9091169082565b60028054610cef90611d48565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1b90611d48565b8015610d685780601f10610d3d57610100808354040283529160200191610d68565b820191906000526020600020905b815481529060010190602001808311610d4b57829003601f168201915b505050505081565b3373ffffffffffffffffffffffffffffffffffffffff82161480610dab575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610de1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611c51565b60065474010000000000000000000000000000000000000000900463ffffffff161580610e305750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b610e66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611aaa565b6004544210610ea1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e99061194b565b6000610eac8261100a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610f07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bbd565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b546020820152610f3f9033306111d7565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790556040517f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a1906105479084904290611872565b60018054610cef90611d48565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b6000805b600d548110156110aa578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611069577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156110985790506107b8565b806110a281611d9c565b91505061100e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b60208201511561110757602082015182516111079173ffffffffffffffffffffffffffffffffffffffff909116908390611131565b5050565b600080838311156111215750600090508061112a565b50600190508183035b9250929050565b6111d28363a9059cbb60e01b8484604051602401611150929190611872565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526111eb565b505050565b6111e183836112a1565b6111d283826110d2565b600061124d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166113c09092919063ffffffff16565b8051909150156111d2578080602001905181019061126b9190611652565b6111d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611bf4565b6020820151156111075781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e90611303908590309060040161181a565b60206040518083038186803b15801561131b57600080fd5b505afa15801561132f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611353919061177b565b90508260200151811015611393576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b18565b602083015183516111d29173ffffffffffffffffffffffffffffffffffffffff90911690849030906113d9565b60606113cf8484600085611400565b90505b9392505050565b6113fa846323b872dd60e01b85858560405160240161115093929190611841565b50505050565b60608247101561143c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611a16565b61144585611501565b61147b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e990611b4f565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114a491906117dd565b60006040518083038185875af1925050503d80600081146114e1576040519150601f19603f3d011682016040523d82523d6000602084013e6114e6565b606091505b50915091506114f682828661151d565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6060831561152c5750816113d2565b82511561153c5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e991906118fd565b82805461157c90611d48565b90600052602060002090601f01602090048101928261159e57600085556115e4565b82601f106115b757805160ff19168380011785556115e4565b828001600101855582156115e4579182015b828111156115e45782518255916020019190600101906115c9565b506115f09291506115f4565b5090565b5b808211156115f057600081556001016115f5565b803573ffffffffffffffffffffffffffffffffffffffff811681146107b857600080fd5b80356107b881611e33565b600060208284031215611649578081fd5b6113d282611609565b600060208284031215611663578081fd5b81516113d281611e33565b60008060008060808587031215611683578283fd5b843567ffffffffffffffff8082111561169a578485fd5b818701915087601f8301126116ad578485fd5b8135818111156116bf576116bf611e04565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561170557611705611e04565b816040528281528a602084870101111561171d578788fd5b826020860160208301378760208483010152809850505050505061174360208601611609565b9250604085013591506117586060860161162d565b905092959194509250565b600060208284031215611774578081fd5b5035919050565b60006020828403121561178c578081fd5b5051919050565b600081518084526117ab816020860160208601611d1c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516117ef818460208701611d1c565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156118e657835173ffffffffffffffffffffffffffffffffffffffff16835292840192918401916001016118b4565b50909695505050505050565b901515815260200190565b6000602082526113d26020830184611793565b6000606082526119236060830186611793565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b60208082526014908201527f4552524f523a2051756573742065787069726564000000000000000000000000604082015260600190565b60208082526027908201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460408201527f20626f756e747900000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f4552524f523a20706c61796572206e6f7420696e206c69737400000000000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526012908201527f4552524f523a204e6f7420657870697265640000000000000000000000000000604082015260600190565b6020808252601a908201527f4552524f523a204d617820706c61796572732072656163686564000000000000604082015260600190565b60208082526018908201527f4552524f523a2053656e646572206e6f7420676f7665726e0000000000000000604082015260600190565b6020808252601d908201527f4552524f52203a204465706f7369742062616420616c6c6f77616e6365000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526012908201527f4552524f523a204e6f2065766964656e63650000000000000000000000000000604082015260600190565b6020808252601c908201527f4552524f523a20506c6179657220616c72656164792065786973747300000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560408201527f61746f7200000000000000000000000000000000000000000000000000000000606082015260800190565b90815260200190565b63ffffffff91909116815260200190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611d0057611d00611dd5565b500290565b600082821015611d1757611d17611dd5565b500390565b60005b83811015611d37578181015183820152602001611d1f565b838111156113fa5750506000910152565b600281046001821680611d5c57607f821691505b60208210811415611d96577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611dce57611dce611dd5565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b801515811461074c57600080fdfea2646970667358221220001ecc7e3a56a6e8ceba0a2f6f0020ef13bacde460faf1b1cca5699bfd12ab1764736f6c63430008010033"; + "0x60806040523480156200001157600080fd5b5060405162002a2e38038062002a2e833981016040819052620000349162000423565b8060c0015180156200005057506000816020015163ffffffff16115b15620000e35760405162461bcd60e51b815260206004820152605260248201527f4552524f523a2043616e27742063726561746520612077686974654c6973746560448201527f642071756573742077697468206d617820706c61796572732067726561746572606482015271207468616e20302028696e66696e6974792960701b608482015260a40160405180910390fd5b8451620000f8906001906020880190620001f1565b5083516200010e906002906020870190620001f1565b506040810151600380546001600160a01b03199081166001600160a01b03938416179091556060830151600455608083015160058054831691841691909117905560a083015160068054855160008054861691871691909117905587516008805486169187169190911790556020978801516009558651600a8054861691871691909117905595870151600b55600c805460ff191690559584015160c0909401519490911691161763ffffffff60a01b1916600160a01b63ffffffff909216919091021760ff60c01b1916600160c01b9115159190910217905550620005909050565b828054620001ff9062000524565b90600052602060002090601f0160209004810192826200022357600085556200026e565b82601f106200023e57805160ff19168380011785556200026e565b828001600101855582156200026e579182015b828111156200026e57825182559160200191906001019062000251565b506200027c92915062000280565b5090565b5b808211156200027c576000815560010162000281565b60006001600160401b03831115620002b357620002b362000561565b6020620002c9601f8501601f19168201620004f1565b9150838252848484011115620002de57600080fd5b60005b84811015620002fc57838101518382018301528101620002e1565b848111156200030e5760008286850101525b50509392505050565b8051620003248162000577565b919050565b805180151581146200032457600080fd5b6000604082840312156200034c578081fd5b620003586040620004f1565b90508151620003678162000577565b808252506020820151602082015292915050565b600060e082840312156200038d578081fd5b6200039960e0620004f1565b90508151620003a88162000577565b8152602082015163ffffffff81168114620003c257600080fd5b6020820152620003d56040830162000317565b604082015260608201516060820152620003f26080830162000317565b60808201526200040560a0830162000317565b60a08201526200041860c0830162000329565b60c082015292915050565b60008060008060006101a086880312156200043c578081fd5b85516001600160401b038082111562000453578283fd5b818801915088601f83011262000467578283fd5b620004788983516020850162000297565b965060208801519150808211156200048e578283fd5b508601601f81018813620004a0578182fd5b620004b18882516020840162000297565b945050620004c387604088016200033a565b9250620004d487608088016200033a565b9150620004e58760c088016200037b565b90509295509295909350565b604051601f8201601f191681016001600160401b03811182821017156200051c576200051c62000561565b604052919050565b6002810460018216806200053957607f821691505b602082108114156200055b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200058d57600080fd5b50565b61248e80620005a06000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c80638b5b9ccc116100cd578063d03ffefb11610081578063e492814f11610066578063e492814f146103ab578063f294cf38146103be578063f7c618c1146103c65761016c565b8063d03ffefb14610372578063e0c23423146103965761016c565b8063a888c2cd116100b2578063a888c2cd1461031d578063b0a87ac11461033f578063b434151c1461035f5761016c565b80638b5b9ccc146102b85780638c53c9bd146102cd5761016c565b8063579ca2c911610124578063775b9c1311610109578063775b9c13146102725780637ceae3101461028557806385c99e2b146102a55761016c565b8063579ca2c9146102255780636c3a4cce1461022d5761016c565b8063310a1ee311610155578063310a1ee3146101c457806348d6cb53146101db5780634c2412a2146101e85761016c565b8063151dfb06146101715780632f17b18214610186575b600080fd5b61018461017f366004611f3f565b6103e6565b005b6006546101af907801000000000000000000000000000000000000000000000000900460ff1681565b60405190151581526020015b60405180910390f35b6101cd60045481565b6040519081526020016101bb565b600c546101af9060ff1681565b6006546102109074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff90911681526020016101bb565b610184610807565b60005461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101bb565b610184610280366004611f60565b6109fb565b60065461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6101af6102b3366004611f3f565b610cc8565b6102c0610cfe565b6040516101bb91906121e9565b600a54600b546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016101bb565b61033061032b366004612103565b610d6d565b6040516101bb93929190612231565b60055461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b61018461036d36600461202a565b610e46565b6008546009546102f19173ffffffffffffffffffffffffffffffffffffffff169082565b61039e611274565b6040516101bb919061221e565b6101846103b9366004611f3f565b611302565b61039e61170d565b60035461024d9073ffffffffffffffffffffffffffffffffffffffff1681565b6006547801000000000000000000000000000000000000000000000000900460ff161561049a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2063616e277420756e706c617920612077686974656c6973746560448201527f642071756573740000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff821614806104d5575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610560576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b600061056b8261171a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156105f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552524f523a20706c61796572206e6f7420696e206c697374000000000000006044820152606401610491565b600d8054610607906001906122f8565b8154811061063e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600d805473ffffffffffffffffffffffffffffffffffffffff909216918390811061069e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d80548061071e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082815260209081902082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905590910190915560408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54918101919091526107b490836117e2565b6040805173ffffffffffffffffffffffffffffffffffffffff841681524260208201527fc4a67a0877d477de99d765a3d9f48abfbe6181dff4727d68c3cb60715555417591015b60405180910390a15050565b600454421015610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f74206578706972656400000000000000000000000000006044820152606401610491565b600c5460ff166108e5576000546040805180820190915260085473ffffffffffffffffffffffffffffffffffffffff908116825260095460208301526108b992166117e2565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561094f57600080fd5b505afa158015610963573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610987919061211b565b600a5460035491925073ffffffffffffffffffffffffffffffffffffffff918216911614156109ce57600d54600b546109ca916109c3916122bb565b829061181b565b9150505b6006546003546109f89173ffffffffffffffffffffffffffffffffffffffff918216911683611841565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610aa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f4f6e6c792063726561746f722063616e2063616c6c20746869732066756e637460448201527f696f6e00000000000000000000000000000000000000000000000000000000006064820152608401610491565b6006547801000000000000000000000000000000000000000000000000900460ff161515600114610b55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4552524f523a2043616e27742073657420746865207768697465206c6973742060448201527f746f2061206e6f6e2d77686974656c697374656420636f6e74726163740000006064820152608401610491565b6000805b82518163ffffffff161015610bf457610bb7838263ffffffff1681518110610baa577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015161171a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610be257600191505b80610bec816123c8565b915050610b59565b508015610c83576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552524f523a204f6e65206f72206d6f726520706c617965727320697320616c60448201527f726561647920696e2077686974656c69737400000000000000000000000000006064820152608401610491565b8151610c9690600d906020850190611dfd565b507fb1565d66d9899787abe67ac307850cf339a24f69de2bf7ffa4179e0eaeb939b082426040516107fb9291906121fc565b6000610cd38261171a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141590505b919050565b6060600d805480602002602001604051908101604052809291908181526020018280548015610d6357602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610d38575b5050505050905090565b60078181548110610d7d57600080fd5b9060005260206000209060030201600091509050806000018054610da09061233b565b80601f0160208091040260200160405190810160405280929190818152602001828054610dcc9061233b565b8015610e195780601f10610dee57610100808354040283529160200191610e19565b820191906000526020600020905b815481529060010190602001808311610dfc57829003601f168201915b505050506001830154600290930154919273ffffffffffffffffffffffffffffffffffffffff1691905083565b60055473ffffffffffffffffffffffffffffffffffffffff163314610ec7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552524f523a2053656e646572206e6f7420676f7665726e00000000000000006044820152606401610491565b8351610f2f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4552524f523a204e6f2065766964656e636500000000000000000000000000006044820152606401610491565b6003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b158015610f9957600080fd5b505afa158015610fad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd1919061211b565b905081156110675760085460035473ffffffffffffffffffffffffffffffffffffffff9081169116141561101a5760095460009061101090839061181b565b945061101e915050565b8092505b600a5460035473ffffffffffffffffffffffffffffffffffffffff9081169116141561106757600d54600b546000916110629161105b91906122bb565b859061181b565b945050505b60085460035473ffffffffffffffffffffffffffffffffffffffff90811691161415611133576000611099828561181b565b915050600860010154811015611131576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4552524f523a2053686f756c64206e6f742065786365656420616c6c6f77656460448201527f20626f756e7479000000000000000000000000000000000000000000000000006064820152608401610491565b505b821561115d5760035461115d9073ffffffffffffffffffffffffffffffffffffffff168585611841565b6040805160608101825286815273ffffffffffffffffffffffffffffffffffffffff86166020808301919091529181018590526007805460018101825560009190915281518051929360039092027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801926111db9284920190611e87565b5060208201516001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055604091820151600290910155517fa1c3b325aa2c115e4b244062eba2515bc5585ae5b41556be8fef399ae9fde11b9061126590879087908790612231565b60405180910390a15050505050565b600280546112819061233b565b80601f01602080910402602001604051908101604052809291908181526020018280546112ad9061233b565b80156112fa5780601f106112cf576101008083540402835291602001916112fa565b820191906000526020600020905b8154815290600101906020018083116112dd57829003601f168201915b505050505081565b6006547801000000000000000000000000000000000000000000000000900460ff16156113b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4552524f523a2043616e27742073656c6620726567697374657220616e64207060448201527f6c617920612077686974656c69737465642051756573740000000000000000006064820152608401610491565b3373ffffffffffffffffffffffffffffffffffffffff821614806113ec575060005473ffffffffffffffffffffffffffffffffffffffff1633145b611477576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552524f523a2053656e646572206e6f7420706c61796572206e6f722063726560448201527f61746f72000000000000000000000000000000000000000000000000000000006064820152608401610491565b60065474010000000000000000000000000000000000000000900463ffffffff1615806114c65750600654600d547401000000000000000000000000000000000000000090910463ffffffff16115b61152c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4552524f523a204d617820706c617965727320726561636865640000000000006044820152606401610491565b6004544210611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4552524f523a20517565737420657870697265640000000000000000000000006044820152606401610491565b60006115a28261171a565b9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461162d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552524f523a20506c6179657220616c726561647920657869737473000000006044820152606401610491565b60408051808201909152600a5473ffffffffffffffffffffffffffffffffffffffff168152600b54602082015261166590333061191a565b600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155604080519182524260208301527f35ec60f951b4abc8b287ab5148caf98524052482927d42e86a720cc71b8a76a191016107fb565b600180546112819061233b565b6000805b600d548110156117ba578273ffffffffffffffffffffffffffffffffffffffff16600d8281548110611779577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156117a8579050610cf9565b806117b28161238f565b91505061171e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92915050565b60208201511561181757602082015182516118179173ffffffffffffffffffffffffffffffffffffffff909116908390611841565b5050565b600080838311156118315750600090508061183a565b50600190508183035b9250929050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526119159084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261192e565b505050565b6119248383611a3d565b61191583826117e2565b6000611990826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611b8d9092919063ffffffff16565b90508051600014806119b15750808060200190518101906119b1919061200e565b611915576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610491565b6020820151156118175781516040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152306024830152600092169063dd62ed3e9060440160206040518083038186803b158015611ab857600080fd5b505afa158015611acc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af0919061211b565b90508260200151811015611b60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4552524f52203a204465706f7369742062616420616c6c6f77616e63650000006044820152606401610491565b602083015183516119159173ffffffffffffffffffffffffffffffffffffffff9091169084903090611ba4565b6060611b9c8484600085611c08565b949350505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611c029085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611893565b50505050565b606082471015611c9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610491565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611cc391906121cd565b60006040518083038185875af1925050503d8060008114611d00576040519150601f19603f3d011682016040523d82523d6000602084013e611d05565b606091505b5091509150611d1687838387611d21565b979650505050505050565b60608315611db4578251611dad5773ffffffffffffffffffffffffffffffffffffffff85163b611dad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610491565b5081611b9c565b611b9c8383815115611dc95781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610491919061221e565b828054828255906000526020600020908101928215611e77579160200282015b82811115611e7757825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611e1d565b50611e83929150611efb565b5090565b828054611e939061233b565b90600052602060002090601f016020900481019282611eb55760008555611e77565b82601f10611ece57805160ff1916838001178555611e77565b82800160010185558215611e77579182015b82811115611e77578251825591602001919060010190611ee0565b5b80821115611e835760008155600101611efc565b803573ffffffffffffffffffffffffffffffffffffffff81168114610cf957600080fd5b8035610cf98161244a565b600060208284031215611f50578081fd5b611f5982611f10565b9392505050565b60006020808385031215611f72578182fd5b823567ffffffffffffffff80821115611f89578384fd5b818501915085601f830112611f9c578384fd5b813581811115611fae57611fae61241b565b8381029150611fbe84830161226c565b8181528481019084860184860187018a1015611fd8578788fd5b8795505b8386101561200157611fed81611f10565b835260019590950194918601918601611fdc565b5098975050505050505050565b60006020828403121561201f578081fd5b8151611f598161244a565b6000806000806080858703121561203f578283fd5b843567ffffffffffffffff80821115612056578485fd5b818701915087601f830112612069578485fd5b813560208282111561207d5761207d61241b565b6120ad817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160161226c565b925081835289818386010111156120c2578687fd5b8181850182850137868183850101528297506120df818a01611f10565b965050505050604085013591506120f860608601611f34565b905092959194509250565b600060208284031215612114578081fd5b5035919050565b60006020828403121561212c578081fd5b5051919050565b6000815180845260208085019450808401835b8381101561217857815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101612146565b509495945050505050565b6000815180845261219b81602086016020860161230f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082516121df81846020870161230f565b9190910192915050565b600060208252611f596020830184612133565b60006040825261220f6040830185612133565b90508260208301529392505050565b600060208252611f596020830184612183565b6000606082526122446060830186612183565b73ffffffffffffffffffffffffffffffffffffffff9490941660208301525060400152919050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156122b3576122b361241b565b604052919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156122f3576122f36123ec565b500290565b60008282101561230a5761230a6123ec565b500390565b60005b8381101561232a578181015183820152602001612312565b83811115611c025750506000910152565b60028104600182168061234f57607f821691505b60208210811415612389577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156123c1576123c16123ec565b5060010190565b600063ffffffff808316818114156123e2576123e26123ec565b6001019392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b80151581146109f857600080fdfea26469706673582212201d95e7743bcb101068cc9a865b5573cbcd2079b13e70e82b4992d89773670e1c64736f6c63430008020033"; diff --git a/packages/hardhat/typechain/factories/TokenMock__factory.ts b/packages/hardhat/typechain/factories/TokenMock__factory.ts index a55b1b89..c156d424 100644 --- a/packages/hardhat/typechain/factories/TokenMock__factory.ts +++ b/packages/hardhat/typechain/factories/TokenMock__factory.ts @@ -353,4 +353,4 @@ const _abi = [ ]; const _bytecode = - "0x608060405260405162000fa038038062000fa08339810160408190526200002691620001b9565b8151829082906200003f90600390602085019062000060565b5080516200005590600490602084019062000060565b505050505062000273565b8280546200006e9062000220565b90600052602060002090601f016020900481019282620000925760008555620000dd565b82601f10620000ad57805160ff1916838001178555620000dd565b82800160010185558215620000dd579182015b82811115620000dd578251825591602001919060010190620000c0565b50620000eb929150620000ef565b5090565b5b80821115620000eb5760008155600101620000f0565b600082601f83011262000117578081fd5b81516001600160401b03808211156200013457620001346200025d565b604051601f8301601f19908116603f011681019082821181831017156200015f576200015f6200025d565b816040528381526020925086838588010111156200017b578485fd5b8491505b838210156200019e57858201830151818301840152908201906200017f565b83821115620001af57848385830101525b9695505050505050565b60008060408385031215620001cc578182fd5b82516001600160401b0380821115620001e3578384fd5b620001f18683870162000106565b9350602085015191508082111562000207578283fd5b50620002168582860162000106565b9150509250929050565b6002810460018216806200023557607f821691505b602082108114156200025757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b610d1d80620002836000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c806340c10f1911610081578063a457c2d71161005b578063a457c2d714610197578063a9059cbb146101aa578063dd62ed3e146101bd576100d4565b806340c10f191461016757806370a082311461017c57806395d89b411461018f576100d4565b806323b872dd116100b257806323b872dd1461012c578063313ce5671461013f5780633950935114610154576100d4565b806306fdde03146100d9578063095ea7b3146100f757806318160ddd14610117575b600080fd5b6100e16101d0565b6040516100ee9190610932565b60405180910390f35b61010a6101053660046108fe565b610262565b6040516100ee9190610927565b61011f610284565b6040516100ee9190610c3f565b61010a61013a3660046108c3565b61028a565b6101476102b8565b6040516100ee9190610c48565b61010a6101623660046108fe565b6102bd565b61017a6101753660046108fe565b6102e9565b005b61011f61018a366004610870565b6102f7565b6100e1610323565b61010a6101a53660046108fe565b610332565b61010a6101b83660046108fe565b61039d565b61011f6101cb366004610891565b6103b5565b6060600380546101df90610c93565b80601f016020809104026020016040519081016040528092919081815260200182805461020b90610c93565b80156102585780601f1061022d57610100808354040283529160200191610258565b820191906000526020600020905b81548152906001019060200180831161023b57829003601f168201915b5050505050905090565b60008061026d6103ed565b905061027a8185856103f1565b5060019392505050565b60025490565b6000806102956103ed565b90506102a2858285610500565b6102ad858585610582565b506001949350505050565b601290565b6000806102c86103ed565b905061027a8185856102da85896103b5565b6102e49190610c56565b6103f1565b6102f38282610742565b5050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020545b919050565b6060600480546101df90610c93565b60008061033d6103ed565b9050600061034b82866103b5565b905083811015610390576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038790610bab565b60405180910390fd5b6102ad82868684036103f1565b6000806103a86103ed565b905061027a818585610582565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b3390565b73ffffffffffffffffffffffffffffffffffffffff831661043e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038790610b4e565b73ffffffffffffffffffffffffffffffffffffffff821661048b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038790610a00565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104f3908590610c3f565b60405180910390a3505050565b600061050c84846103b5565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461057c578181101561056f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038790610a5d565b61057c84848484036103f1565b50505050565b73ffffffffffffffffffffffffffffffffffffffff83166105cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038790610af1565b73ffffffffffffffffffffffffffffffffffffffff821661061c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610387906109a3565b610627838383610847565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610687576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038790610a94565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152602081905260408082208585039055918516815290812080548492906106cb908490610c56565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161072f9190610c3f565b60405180910390a361057c848484610847565b73ffffffffffffffffffffffffffffffffffffffff821661078f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038790610c08565b61079b60008383610847565b80600260008282546107ad9190610c56565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600090815260208190526040812080548392906107e7908490610c56565b909155505060405173ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610837908590610c3f565b60405180910390a36102f3600083835b505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461031e57600080fd5b600060208284031215610881578081fd5b61088a8261084c565b9392505050565b600080604083850312156108a3578081fd5b6108ac8361084c565b91506108ba6020840161084c565b90509250929050565b6000806000606084860312156108d7578081fd5b6108e08461084c565b92506108ee6020850161084c565b9150604084013590509250925092565b60008060408385031215610910578182fd5b6109198361084c565b946020939093013593505050565b901515815260200190565b6000602080835283518082850152825b8181101561095e57858101830151858201604001528201610942565b8181111561096f5783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201527f6573730000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560408201527f7373000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601d908201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604082015260600190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260408201527f616c616e63650000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460408201527f6472657373000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460408201527f7265737300000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760408201527f207a65726f000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b60ff91909116815260200190565b60008219821115610c8e577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b500190565b600281046001821680610ca757607f821691505b60208210811415610ce1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea2646970667358221220a4b54a7a2f37c82415ec22d08b2dc27e1757a12d2bc3dd51bf2ca56dc3ca377a64736f6c63430008010033"; + "0x608060405260405162000ec738038062000ec78339810160408190526200002691620001b9565b8151829082906200003f90600390602085019062000060565b5080516200005590600490602084019062000060565b505050505062000273565b8280546200006e9062000220565b90600052602060002090601f016020900481019282620000925760008555620000dd565b82601f10620000ad57805160ff1916838001178555620000dd565b82800160010185558215620000dd579182015b82811115620000dd578251825591602001919060010190620000c0565b50620000eb929150620000ef565b5090565b5b80821115620000eb5760008155600101620000f0565b600082601f83011262000117578081fd5b81516001600160401b03808211156200013457620001346200025d565b604051601f8301601f19908116603f011681019082821181831017156200015f576200015f6200025d565b816040528381526020925086838588010111156200017b578485fd5b8491505b838210156200019e57858201830151818301840152908201906200017f565b83821115620001af57848385830101525b9695505050505050565b60008060408385031215620001cc578182fd5b82516001600160401b0380821115620001e3578384fd5b620001f18683870162000106565b9350602085015191508082111562000207578283fd5b50620002168582860162000106565b9150509250929050565b6002810460018216806200023557607f821691505b602082108114156200025757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b610c4480620002836000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c806340c10f1911610081578063a457c2d71161005b578063a457c2d714610191578063a9059cbb146101a4578063dd62ed3e146101b7576100d4565b806340c10f191461016157806370a082311461017657806395d89b4114610189576100d4565b806323b872dd116100b257806323b872dd1461012c578063313ce5671461013f578063395093511461014e576100d4565b806306fdde03146100d9578063095ea7b3146100f757806318160ddd1461011a575b600080fd5b6100e16101fd565b6040516100ee9190610b0c565b60405180910390f35b61010a610105366004610ae3565b61028f565b60405190151581526020016100ee565b6002545b6040519081526020016100ee565b61010a61013a366004610aa8565b6102a7565b604051601281526020016100ee565b61010a61015c366004610ae3565b6102cb565b61017461016f366004610ae3565b610317565b005b61011e610184366004610a55565b610325565b6100e1610351565b61010a61019f366004610ae3565b610360565b61010a6101b2366004610ae3565b610436565b61011e6101c5366004610a76565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60606003805461020c90610bba565b80601f016020809104026020016040519081016040528092919081815260200182805461023890610bba565b80156102855780601f1061025a57610100808354040283529160200191610285565b820191906000526020600020905b81548152906001019060200180831161026857829003601f168201915b5050505050905090565b60003361029d818585610444565b5060019392505050565b6000336102b58582856105f7565b6102c08585856106ce565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061029d9082908690610312908790610b7d565b610444565b610321828261093d565b5050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020545b919050565b60606004805461020c90610bba565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610429576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6102c08286868403610444565b60003361029d8185856106ce565b73ffffffffffffffffffffffffffffffffffffffff83166104e6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff8216610589576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146106c857818110156106bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610420565b6106c88484848403610444565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610771576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff8216610814576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156108ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610420565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36106c8565b73ffffffffffffffffffffffffffffffffffffffff82166109ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610420565b80600260008282546109cc9190610b7d565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610321565b803573ffffffffffffffffffffffffffffffffffffffff8116811461034c57600080fd5b600060208284031215610a66578081fd5b610a6f82610a31565b9392505050565b60008060408385031215610a88578081fd5b610a9183610a31565b9150610a9f60208401610a31565b90509250929050565b600080600060608486031215610abc578081fd5b610ac584610a31565b9250610ad360208501610a31565b9150604084013590509250925092565b60008060408385031215610af5578182fd5b610afe83610a31565b946020939093013593505050565b6000602080835283518082850152825b81811015610b3857858101830151858201604001528201610b1c565b81811115610b495783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60008219821115610bb5577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b500190565b600281046001821680610bce57607f821691505b60208210811415610c08577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea2646970667358221220641b0bae79b071168299277ea848fb84314d7fb43ff1c355649676e049400a1b64736f6c63430008020033"; diff --git a/packages/hardhat/typechain/index.ts b/packages/hardhat/typechain/index.ts index 6aaf1180..f9c9980e 100644 --- a/packages/hardhat/typechain/index.ts +++ b/packages/hardhat/typechain/index.ts @@ -1,9 +1,12 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -export type { Ownable } from "./Ownable"; +export type { OwnableUpgradeable } from "./OwnableUpgradeable"; +export type { Initializable } from "./Initializable"; +export type { IERC20PermitUpgradeable } from "./IERC20PermitUpgradeable"; +export type { IERC20Upgradeable } from "./IERC20Upgradeable"; +export type { ContextUpgradeable } from "./ContextUpgradeable"; export type { ERC20 } from "./ERC20"; -export type { IERC20Permit } from "./IERC20Permit"; export type { IERC20Metadata } from "./IERC20Metadata"; export type { IERC20 } from "./IERC20"; export type { IExecutable } from "./IExecutable"; @@ -14,9 +17,12 @@ export type { TokenMock } from "./TokenMock"; export type { Quest } from "./Quest"; export type { QuestFactory } from "./QuestFactory"; -export { Ownable__factory } from "./factories/Ownable__factory"; +export { OwnableUpgradeable__factory } from "./factories/OwnableUpgradeable__factory"; +export { Initializable__factory } from "./factories/Initializable__factory"; +export { IERC20PermitUpgradeable__factory } from "./factories/IERC20PermitUpgradeable__factory"; +export { IERC20Upgradeable__factory } from "./factories/IERC20Upgradeable__factory"; +export { ContextUpgradeable__factory } from "./factories/ContextUpgradeable__factory"; export { ERC20__factory } from "./factories/ERC20__factory"; -export { IERC20Permit__factory } from "./factories/IERC20Permit__factory"; export { IERC20Metadata__factory } from "./factories/IERC20Metadata__factory"; export { IERC20__factory } from "./factories/IERC20__factory"; export { IExecutable__factory } from "./factories/IExecutable__factory"; diff --git a/packages/react-app/src/components/field-input/address-field-input.tsx b/packages/react-app/src/components/field-input/address-field-input.tsx index 3ea0d1d3..2345eae7 100644 --- a/packages/react-app/src/components/field-input/address-field-input.tsx +++ b/packages/react-app/src/components/field-input/address-field-input.tsx @@ -101,6 +101,7 @@ export function AddressFieldInput({ adornment={} adornmentPosition={isEdit ? 'end' : 'start'} adornmentSettings={{ padding: 0, width: 36 }} + title={value} /> ) : ( ( + value + ? value.map((x) => ({ key: Math.random().toString(), value: x })) + : [{ key: Math.random().toString(), value: '' }], + ); + + const addPlayerToWhitelist = () => { + setValueState([...valueState, { key: Math.random().toString(), value: '' }]); + onChange(isFormik ? createEventWithValue() : valueState.map((x) => x.value)); + }; + + const removePlayerFromWhitelist = (indexToRemove: number) => { + setValueState([...valueState.filter((_, index) => index !== indexToRemove)]); + onChange(isFormik ? createEventWithValue() : valueState.map((x) => x.value)); + }; + + const handleChange = (v: string, i: number) => { + const newList = [...valueState]; + newList[i].value = v; + setValueState(newList); + if (isFormik) { + onChange(createEventWithValue()); + } else { + onChange(valueState.map((x) => x.value)); + } + }; + + const createEventWithValue = () => { + const ev = { + target: { + value: valueState.map((x) => x.value), + id, + }, + } as BaseSyntheticEvent; + return ev; + }; + + return ( + + {valueState.map((playerAddress, i) => ( + // eslint-disable-next-line react/no-array-index-key + + handleChange(e.target.value, i)} + onBlur={onBlur} + wide + /> + {isEdit && ( +