@@ -154,6 +154,15 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
154
154
_;
155
155
}
156
156
157
+ modifier onlyPendingDispute (bytes32 _disputeID ) {
158
+ require (isDisputeCreated (_disputeID), "Dispute does not exist " );
159
+ require (
160
+ disputes[_disputeID].status == IDisputeManager.DisputeStatus.Pending,
161
+ "Dispute must be pending "
162
+ );
163
+ _;
164
+ }
165
+
157
166
// -- Functions --
158
167
159
168
/**
@@ -290,7 +299,7 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
290
299
* @param _disputeID True if dispute already exists
291
300
*/
292
301
function isDisputeCreated (bytes32 _disputeID ) public view override returns (bool ) {
293
- return disputes[_disputeID].fisherman != address ( 0 ) ;
302
+ return disputes[_disputeID].status != DisputeStatus.Null ;
294
303
}
295
304
296
305
/**
@@ -556,15 +565,6 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
556
565
return disputeID;
557
566
}
558
567
559
- modifier onlyPendingDispute (bytes32 _disputeID ) {
560
- require (isDisputeCreated (_disputeID), "Dispute does not exist " );
561
- require (
562
- disputes[_disputeID].status == IDisputeManager.DisputeStatus.Pending,
563
- "Dispute must be pending "
564
- );
565
- _;
566
- }
567
-
568
568
/**
569
569
* @dev The arbitrator accepts a dispute as being valid.
570
570
* This function will revert if the indexer is not slashable, whether because it does not have
@@ -647,16 +647,14 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
647
647
{
648
648
Dispute storage dispute = disputes[_disputeID];
649
649
650
- // store dispute status
651
- dispute.status = IDisputeManager.DisputeStatus.Drawn;
652
-
653
650
// Return deposit to the fisherman
654
651
TokenUtils.pushTokens (graphToken (), dispute.fisherman, dispute.deposit);
655
652
656
- // Resolve the conflicting dispute if any
657
- if (_isDisputeInConflict (dispute)) {
658
- drawDispute (dispute.relatedDisputeID);
659
- }
653
+ // resolve related dispute if any
654
+ _resolveDisputeInConflict (dispute);
655
+
656
+ // store dispute status
657
+ dispute.status = IDisputeManager.DisputeStatus.Drawn;
660
658
661
659
emit DisputeDrawn (_disputeID, dispute.indexer, dispute.fisherman, dispute.deposit);
662
660
}
@@ -693,15 +691,15 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
693
691
* @param _dispute Dispute
694
692
* @return True if resolved
695
693
*/
696
- // function _resolveDisputeInConflict(Dispute memory _dispute) private returns (bool) {
697
- // if (_isDisputeInConflict(_dispute)) {
698
- // bytes32 relatedDisputeID = _dispute.relatedDisputeID;
699
- // Dispute storage relatedDispute = disputes[relatedDisputeID];
700
- // delete disputes[relatedDisputeID] ;
701
- // return true;
702
- // }
703
- // return false;
704
- // }
694
+ function _resolveDisputeInConflict (Dispute memory _dispute ) private returns (bool ) {
695
+ if (_isDisputeInConflict (_dispute)) {
696
+ bytes32 relatedDisputeID = _dispute.relatedDisputeID;
697
+ Dispute storage relatedDispute = disputes[relatedDisputeID];
698
+ relatedDispute.status = IDisputeManager.DisputeStatus.Drawn ;
699
+ return true ;
700
+ }
701
+ return false ;
702
+ }
705
703
706
704
/**
707
705
* @dev Pull deposit from submitter account.
0 commit comments