Skip to content

Commit e12d98c

Browse files
feat: added disputeStatus mapping and enum
1 parent 7ab82b9 commit e12d98c

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

contracts/disputes/DisputeManager.sol

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
482482
DisputeType.QueryDispute
483483
);
484484

485+
// store the dispute status
486+
disputeStatus[disputeID] = IDisputeManager.DisputeStatus.Pending;
487+
485488
emit QueryDisputeCreated(
486489
disputeID,
487490
indexer,
@@ -549,6 +552,9 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
549552
DisputeType.IndexingDispute
550553
);
551554

555+
// store dispute status
556+
disputeStatus[disputeID] = IDisputeManager.DisputeStatus.Pending;
557+
552558
emit IndexingDisputeCreated(disputeID, alloc.indexer, _fisherman, _deposit, _allocationID);
553559

554560
return disputeID;
@@ -563,7 +569,10 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
563569
* @param _disputeID ID of the dispute to be accepted
564570
*/
565571
function acceptDispute(bytes32 _disputeID) external override onlyArbitrator {
566-
Dispute memory dispute = disputes[_disputeID];
572+
Dispute memory dispute = _resolveDispute(_disputeID);
573+
574+
// store dispute status
575+
disputeStatus[_disputeID] = IDisputeManager.DisputeStatus.Accepted;
567576

568577
// Slash
569578
(, uint256 tokensToReward) = _slashIndexer(
@@ -594,6 +603,9 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
594603
function rejectDispute(bytes32 _disputeID) external override onlyArbitrator {
595604
Dispute memory dispute = _resolveDispute(_disputeID);
596605

606+
// store dispute status
607+
disputeStatus[_disputeID] = IDisputeManager.DisputeStatus.Rejected;
608+
597609
// Handle conflicting dispute if any
598610
require(
599611
!_isDisputeInConflict(dispute),
@@ -614,6 +626,9 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
614626
function drawDispute(bytes32 _disputeID) external override onlyArbitrator {
615627
Dispute memory dispute = _resolveDispute(_disputeID);
616628

629+
// store dispute status
630+
disputeStatus[_disputeID] = IDisputeManager.DisputeStatus.Drawn;
631+
617632
// Return deposit to the fisherman
618633
TokenUtils.pushTokens(graphToken(), dispute.fisherman, dispute.deposit);
619634

contracts/disputes/DisputeManagerStorage.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ contract DisputeManagerV1Storage is Managed {
3131
// Disputes created : disputeID => Dispute
3232
// disputeID - check creation functions to see how disputeID is built
3333
mapping(bytes32 => IDisputeManager.Dispute) public disputes;
34+
35+
// Dispute status : disputeID => DisputeStatus
36+
// disputeID - check creation functions to see how disputeID is built
37+
mapping(bytes32 => IDisputeManager.DisputeStatus) public disputeStatus;
3438
}

contracts/disputes/IDisputeManager.sol

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ interface IDisputeManager {
1212
QueryDispute
1313
}
1414

15+
enum DisputeStatus {
16+
Accepted,
17+
Rejected,
18+
Drawn,
19+
Pending
20+
}
21+
1522
// Disputes contain info necessary for the Arbitrator to verify and resolve
1623
struct Dispute {
1724
address indexer;

0 commit comments

Comments
 (0)