Skip to content

Commit

Permalink
[REFAC] Contract Naming: 'Case' is now 'Incident'
Browse files Browse the repository at this point in the history
  • Loading branch information
toledoroy committed Jul 6, 2022
1 parent e4b47b9 commit 9775a93
Show file tree
Hide file tree
Showing 26 changed files with 323 additions and 323 deletions.
50 changes: 25 additions & 25 deletions .openzeppelin/unknown-31337.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,67 +23,67 @@
},
{
"address": "0x0165878A594ca255338adfa4d48449f69242Eb8F",
"txHash": "0x552589d98956ca7deabad6165000daf7c56cba339d3c7253191c9c47f4abf162",
"txHash": "0x5b77d505a5834da125d91b29bd4a525fd9c0a97b5b929203b8200cea25500782",
"kind": "uups"
},
{
"address": "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853",
"txHash": "0xf42b1e81cbd01faf6f52eda21fcc2b658df47406ab0000bd350fb379cf1d1492",
"txHash": "0xcb6c99de6776e2ef8e1e409d1776b1e9ef2ebf9961641380129af8197b4de105",
"kind": "uups"
},
{
"address": "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
"txHash": "0xb767a8b0175af1df85b371c5085b36a648ff0532359bd4b2db3549b8d822932f",
"txHash": "0x517a25572b2995575c324e8f152e7db76ce07246d7969599a822fb920da88f3a",
"kind": "uups"
},
{
"address": "0x9A676e781A523b5d0C0e43731313A708CB607508",
"txHash": "0x9880d7e6b4b89d75a6f3e228163cdac2b0bff1dbf9121ea5b6b461b8bccab624",
"txHash": "0xc20454a65f5189cd73938f0062e65d5ca2acb2ea5b207c4ce7e6aa37c24881b9",
"kind": "uups"
},
{
"address": "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE",
"txHash": "0x5e920f6a930bf0884c1aef2e731ebf7dbceb99a244750e9ed2e431f9caa56eaa",
"txHash": "0x4484a083a1da59f5916fbc2002d65b3cc30b774bf7951027532a39fbf01adc39",
"kind": "uups"
},
{
"address": "0x59b670e9fA9D0A427751Af201D676719a970857b",
"txHash": "0x9a92e0c70e487a6f93a209171ceb6c9549bc73d1b6c7b91cad688a173d14dcda",
"txHash": "0x73f44974204b7e5e98345b75ee7cd6f07199fd9f9f3569133caa924ab406bd0b",
"kind": "uups"
},
{
"address": "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1",
"txHash": "0x6d51ff65026a34d1f98ee78c71aa0465d9dc609343736c1c144c76d0733c261e",
"txHash": "0x926587892ebeff5d40d76ddd8838d3cdc7c2bf1ccf885dcef6fa01cd97ad6d97",
"kind": "uups"
},
{
"address": "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44",
"txHash": "0xbb54509d4080e30495dd49792c03745ff2b467561cada5af4f0c7b41143c23f3",
"txHash": "0xdd5065fa77df3ba36da42b5d16aabddcc86df0ce098343808496c7192538e9fd",
"kind": "uups"
},
{
"address": "0x7a2088a1bFc9d81c55368AE168C2C02570cB814F",
"txHash": "0x293073fadc8dcf3962e2a986d5db1fc233f6bccb70eb0d5df650667ed3ae4f2f",
"txHash": "0x752280147d40a1ab2d9e460c479d2126b7e108aee233930bac74c84b1509b068",
"kind": "uups"
},
{
"address": "0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690",
"txHash": "0x91d7d91eb467e01739b17efe8379df5f68c263259442634a4e3ebd4638c75705",
"txHash": "0x87604405d8269b28af154ad46c400f36f98d2feb853a4481b94571bad263f8e6",
"kind": "uups"
},
{
"address": "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9",
"txHash": "0x442d787c751f97f6e94cc6d1a91dd2cef51b3512b15a343d25273468d0be127a",
"txHash": "0x9126f4560c658911e772a8f07469f38cd83f41a3429b6140ea467db6375e6f79",
"kind": "uups"
},
{
"address": "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8",
"txHash": "0x4197f6cc6b081d6c6094af5f86a19be7e22996507455e4743cba1921751d9c73",
"txHash": "0x62d4dac41fa0837dbd50f8f975b050738db29223d0805c499b351f4422da2d69",
"kind": "uups"
},
{
"address": "0xf5059a5D33d5853360D16C683c16e67980206f36",
"txHash": "0x395e07250fb45012539a0667975d23ef96fb642ea129904e7ea63e77200923cd",
"txHash": "0xf9861dce7fc4f215074d95f832e2dfc793f7b82bbaf3fa06e439f29ece7b520f",
"kind": "uups"
}
],
Expand Down Expand Up @@ -257,7 +257,7 @@
},
"6f36acffacf0875d68f2e35bd5eece94dcdbb93e8968027f5509dd0ff0683445": {
"address": "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318",
"txHash": "0xa7996193ba5f7e5ce4c51e771707cf54883a94f550d40ace0013309fddd8b4bf",
"txHash": "0x7e37b9f26e617ea7fd1f69e628a6f5eddce0adb8e4710078865fc18d13f41b43",
"layout": {
"storage": [
{
Expand Down Expand Up @@ -313,7 +313,7 @@
"label": "_HUB",
"offset": 0,
"slot": "102",
"type": "t_contract(IHub)11790",
"type": "t_contract(IHub)11646",
"contract": "CommonYJUpgradable",
"src": "contracts\\abstract\\CommonYJUpgradable.sol:24"
},
Expand Down Expand Up @@ -459,7 +459,7 @@
"label": "bool",
"numberOfBytes": "1"
},
"t_contract(IHub)11790": {
"t_contract(IHub)11646": {
"label": "contract IHub",
"numberOfBytes": "20"
},
Expand Down Expand Up @@ -536,7 +536,7 @@
},
"85866cfbcd6aa52b7a968f09c930f5a3e26264deab91db21d0f924fd445a9145": {
"address": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
"txHash": "0xa7bcc91da13c6f5f4b649d4a6d22a8ea845b19f896bdcbae239e1cc6d330b7f1",
"txHash": "0x48577a3c332fae4ce1155cb2fb45ddd5efad8972502ee68255aa91dc33f8cb03",
"layout": {
"storage": [
{
Expand Down Expand Up @@ -592,7 +592,7 @@
"label": "_HUB",
"offset": 0,
"slot": "102",
"type": "t_contract(IHub)11790",
"type": "t_contract(IHub)11646",
"contract": "CommonYJUpgradable",
"src": "contracts\\abstract\\CommonYJUpgradable.sol:24"
},
Expand Down Expand Up @@ -730,7 +730,7 @@
"label": "bytes32",
"numberOfBytes": "32"
},
"t_contract(IHub)11790": {
"t_contract(IHub)11646": {
"label": "contract IHub",
"numberOfBytes": "20"
},
Expand Down Expand Up @@ -823,9 +823,9 @@
}
}
},
"84054f26443cea84ea1fc2bd0536869790b2df018ebab2807e763e15a92c875c": {
"d98e88c9661bc0f8cfaf42451c118d542ed32855f1af377b1028563c52fbf0dc": {
"address": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
"txHash": "0xa9e8679393d3fa43ba6c68118942b726b275c0b277ed11c85b3bd8d904a46ac4",
"txHash": "0x4a396eb326a7e05d0460ce67f93c4753b95a7155192990f772605c1fc1748bb0",
"layout": {
"storage": [
{
Expand Down Expand Up @@ -910,7 +910,7 @@
"src": "@openzeppelin\\contracts-upgradeable\\utils\\introspection\\ERC165Upgradeable.sol:41"
},
{
"label": "beaconCase",
"label": "beaconIncident",
"offset": 0,
"slot": "253",
"type": "t_address",
Expand All @@ -929,7 +929,7 @@
"label": "_CONFIG",
"offset": 0,
"slot": "255",
"type": "t_contract(IConfig)11202",
"type": "t_contract(IConfig)11058",
"contract": "HubUpgradable",
"src": "contracts\\HubUpgradable.sol:67"
},
Expand All @@ -942,7 +942,7 @@
"src": "contracts\\HubUpgradable.sol:69"
},
{
"label": "_cases",
"label": "_incidents",
"offset": 0,
"slot": "257",
"type": "t_mapping(t_address,t_address)",
Expand All @@ -967,7 +967,7 @@
"label": "bool",
"numberOfBytes": "1"
},
"t_contract(IConfig)11202": {
"t_contract(IConfig)11058": {
"label": "contract IConfig",
"numberOfBytes": "20"
},
Expand Down
2 changes: 1 addition & 1 deletion archive/ActionRepo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import "./abstract/ERC1155GUID.sol";
* @title History Retention
* @dev Event Repository -- Retains Unique Events and Their Apperance Throught History
* 2D - Compound GUID + Additional Data & URI
* [TBD] 3D - Individual Instances of Action (Incidents) as NFTs + Event Details (Time, Case no., etc')
* [TBD] 3D - Individual Instances of Action (Incidents) as NFTs + Event Details (Time, Incident no., etc')
*/
contract ActionRepo is IActionRepo, CommonYJ, ERC1155GUID {

Expand Down
2 changes: 1 addition & 1 deletion archive/ERC1155Roles.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import "./ERC1155GUID.sol";
/**
* @title Sub-Groups with Role NFTs
* @dev ERC1155 using GUID as Role
* To Extend Cases & Jutisdictions
* To Extend Incidents & Jutisdictions
* - Hold Roles
* - Assign Roles
* ----
Expand Down
2 changes: 1 addition & 1 deletion archive/ERC1155RolesUpgradable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import "./ERC1155GUIDUpgradable.sol";
/**
* @title Sub-Groups with Role NFTs
* @dev ERC1155 using GUID as Role
* To Extend Cases & Jutisdictions
* To Extend Incidents & Jutisdictions
* - [TODO] Hold Roles
* - [TODO] Assign Roles
* ----
Expand Down
70 changes: 35 additions & 35 deletions archive/Game.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./interfaces/IGame.sol";
import "./interfaces/IRules.sol";
import "./interfaces/ICase.sol";
import "./interfaces/IIncident.sol";
// import "./libraries/DataTypes.sol";
import "./abstract/ERC1155Roles.sol";
import "./abstract/ContractBase.sol";
Expand All @@ -29,7 +29,7 @@ import "./abstract/Posts.sol";
* - One for each
* - All members are the same
* - Rules
* - Creates new Cases
* - Creates new Incidents
* - Contract URI
* - [TODO] Validation: Make Sure Account has an Avatar NFT
* - [TODO] Token URIs for Roles
Expand All @@ -53,7 +53,7 @@ contract Game is

using Counters for Counters.Counter;
// Counters.Counter internal _tokenIds; //Track Last Token ID
Counters.Counter internal _caseIds; //Track Last Case ID
Counters.Counter internal _incidentIds; //Track Last Incident ID

// Contract name
string public name;
Expand All @@ -63,8 +63,8 @@ contract Game is
// string internal _contract_uri;

// mapping(string => uint256) internal _roles; //NFTs as Roles
// mapping(uint256 => address) internal _cases; // Mapping for Case Contracts //DEPRECATED - No need for Case IDs, Use Hash
mapping(address => bool) internal _active; // Mapping for Case Contracts
// mapping(uint256 => address) internal _incidents; // Mapping for Incident Contracts //DEPRECATED - No need for Incident IDs, Use Hash
mapping(address => bool) internal _active; // Mapping for Incident Contracts

// mapping(uint256 => string) internal _rulesURI; // Mapping Metadata URIs for Individual Role
// mapping(uint256 => string) internal _uri;
Expand Down Expand Up @@ -92,26 +92,26 @@ contract Game is
_roleAssign(tx.origin, "admin");
}

//** Case Functions
//** Incident Functions

/// Make a new Case & File it
function caseMakeOpen(
/// Make a new Incident & File it
function incidentMakeOpen(
string calldata name_,
DataTypes.RuleRef[] calldata addRules,
DataTypes.InputRole[] calldata assignRoles,
PostInput[] calldata posts
// ) public returns (uint256, address) {
) public returns (address) {
//Make Case
address caseContract = caseMake(name_, addRules, assignRoles, posts);
//File Case
ICase(caseContract).stageFile();
//Make Incident
address incidentContract = incidentMake(name_, addRules, assignRoles, posts);
//File Incident
IIncident(incidentContract).stageFile();
//Return
return caseContract;
return incidentContract;
}

/// Make a new Case
function caseMake(
/// Make a new Incident
function incidentMake(
string calldata name_,
DataTypes.RuleRef[] calldata addRules,
DataTypes.InputRole[] calldata assignRoles,
Expand All @@ -121,42 +121,42 @@ contract Game is
// roleHas(_msgSender(), "admin")
// roleHas(_msgSender(), "member")

//Assign Case ID
_caseIds.increment(); //Start with 1
uint256 caseId = _caseIds.current();
//Create new Case
address caseContract = _HUB.caseMake(name_, addRules, assignRoles);
//Assign Incident ID
_incidentIds.increment(); //Start with 1
uint256 incidentId = _incidentIds.current();
//Create new Incident
address incidentContract = _HUB.incidentMake(name_, addRules, assignRoles);
//Remember Address
// _cases[caseId] = caseContract;
_active[caseContract] = true;
//New Case Created Event
emit CaseCreated(caseId, caseContract);
// _incidents[incidentId] = incidentContract;
_active[incidentContract] = true;
//New Incident Created Event
emit IncidentCreated(incidentId, incidentContract);
//Posts
for (uint256 i = 0; i < posts.length; ++i) {
ICase(caseContract).post(posts[i].entRole, posts[i].tokenId, posts[i].uri);
IIncident(incidentContract).post(posts[i].entRole, posts[i].tokenId, posts[i].uri);
}
return caseContract;
return incidentContract;
}

/// Disable Case
function caseDisable(address caseContract) public override onlyOwner {
/// Disable Incident
function incidentDisable(address incidentContract) public override onlyOwner {
//Validate
require(_active[caseContract], "Case Not Active");
_active[caseContract] = false;
require(_active[incidentContract], "Incident Not Active");
_active[incidentContract] = false;
}

/// Check if Case is Owned by This Contract (& Active)
function caseHas(address caseContract) public view override returns (bool){
return _active[caseContract];
/// Check if Incident is Owned by This Contract (& Active)
function incidentHas(address incidentContract) public view override returns (bool){
return _active[incidentContract];
}

//** Custom Rating Functions

/// Add Reputation (Positive or Negative)
// function repAdd(address contractAddr, uint256 tokenId, string calldata domain, DataTypes.Rating rating, uint8 amount) external override {
function repAdd(address contractAddr, uint256 tokenId, string calldata domain, bool rating, uint8 amount) external override {
//Validate - Called by Child Case
require(caseHas(_msgSender()), "NOT A VALID CASE");
//Validate - Called by Child Incident
require(incidentHas(_msgSender()), "NOT A VALID CASE");
//Run
_repAdd(contractAddr, tokenId, domain, rating, amount);
//Update Hub
Expand Down
Loading

0 comments on commit 9775a93

Please sign in to comment.