Skip to content

Commit

Permalink
QuestFactory proxy subgraph and quest WhiteList
Browse files Browse the repository at this point in the history
  • Loading branch information
Corantin committed Aug 8, 2023
1 parent 3657bcd commit 864520e
Show file tree
Hide file tree
Showing 22 changed files with 2,823 additions and 286 deletions.
127 changes: 127 additions & 0 deletions packages/hardhat/.openzeppelin/goerli.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"address": "0xbfFEce7c884a488921F52Fb4dd0b0c61B77C9104",
"txHash": "0x79ea242422293cb66ecc3f08d3f929760ba90dbb1c272a3eacd9bb4c74a337c3",
"kind": "transparent"
},
{
"address": "0x05301D6787430d26bb0D6430Bd98a59B955a27D0",
"txHash": "0xcea8f557f3c834b08b05f85965ad21d2fec5717be730ae5a0fddf016c0b7d5d7",
"kind": "transparent"
}
],
"impls": {
Expand Down Expand Up @@ -270,6 +275,128 @@
}
}
}
},
"5e9ff64d2f8c29ea479b86854efdb27d8660c24701351b95a6f3997727ae61d1": {
"address": "0x01cf8920D51B579b10e1d8CeaB2afc25708d8C15",
"txHash": "0x93edc2c4e9818257200d9919bca42993174c7f15c2b1419525a935f38d6e5d2c",
"layout": {
"solcVersion": "0.8.2",
"storage": [
{
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "t_uint8",
"contract": "Initializable",
"src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:63",
"retypedFrom": "bool"
},
{
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "t_bool",
"contract": "Initializable",
"src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:68"
},
{
"label": "__gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage",
"contract": "ContextUpgradeable",
"src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:36"
},
{
"label": "_owner",
"offset": 0,
"slot": "51",
"type": "t_address",
"contract": "OwnableUpgradeable",
"src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:22"
},
{
"label": "__gap",
"offset": 0,
"slot": "52",
"type": "t_array(t_uint256)49_storage",
"contract": "OwnableUpgradeable",
"src": "@openzeppelin\\contracts-upgradeable\\access\\OwnableUpgradeable.sol:94"
},
{
"label": "aragonGovernAddress",
"offset": 0,
"slot": "101",
"type": "t_address",
"contract": "QuestFactory",
"src": "contracts\\QuestFactory.sol:15"
},
{
"label": "createDeposit",
"offset": 0,
"slot": "102",
"type": "t_struct(Deposit)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"
}
}
}
}
}
}
12 changes: 10 additions & 2 deletions packages/hardhat/contracts/Quest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ 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 WhiteListChanged(address[] whiteListPlayers, uint256 timestamp);
event QuestWhiteListChanged(address[] whiteListPlayers, uint256 timestamp);
modifier OnlyCreator() {
require(
msg.sender == questCreator,
Expand Down Expand Up @@ -199,13 +199,21 @@ 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"
);
playerList = _players;
emit WhiteListChanged(_players, block.timestamp);
emit QuestWhiteListChanged(_players, block.timestamp);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/hardhat/deployments/goerli/Quest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "0xC561b3ed53Ec7cF6ed6047F410D8Aa0dA90fB69A",
"address": "0x76E25d5bEBbaA5618Ab45E61918aDC45c8725C09",
"abi": [
{
"inputs": [
Expand Down Expand Up @@ -172,7 +172,7 @@
"type": "uint256"
}
],
"name": "WhiteListChanged",
"name": "QuestWhiteListChanged",
"type": "event"
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat/deployments/goerli/QuestFactory.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "0xbfFEce7c884a488921F52Fb4dd0b0c61B77C9104",
"address": "0x05301D6787430d26bb0D6430Bd98a59B955a27D0",
"abi": [
{
"inputs": [],
Expand Down
Loading

0 comments on commit 864520e

Please sign in to comment.