diff --git a/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol b/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol index 6a767cecc..43e666c04 100644 --- a/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol +++ b/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol @@ -12,6 +12,7 @@ pragma solidity ^0.8; import "./BaseDisputeKit.sol"; import "../../rng/RNG.sol"; +import "../../evidence/IEvidence.sol"; /** * @title DisputeKitClassic @@ -23,7 +24,7 @@ import "../../rng/RNG.sol"; * TODO: * - phase management: Generating->Drawing->Resolving->Generating in coordination with KlerosCore to freeze staking. */ -contract DisputeKitClassic is BaseDisputeKit { +contract DisputeKitClassic is BaseDisputeKit, IEvidence { // ************************************* // // * Structs * // // ************************************* // @@ -384,6 +385,14 @@ contract DisputeKitClassic is BaseDisputeKit { } } + /** @dev Submits evidence. + * @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to. It's the submitter responsability to submit the right evidence group ID. + * @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'. + */ + function submitEvidence(uint256 _evidenceGroupID, string calldata _evidence) external { + emit Evidence(core, _evidenceGroupID, msg.sender, _evidence); + } + // ************************************* // // * Public Views * // // ************************************* // diff --git a/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol b/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol index 709d73043..e4907fb82 100644 --- a/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol +++ b/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol @@ -11,8 +11,8 @@ pragma solidity ^0.8; import "./BaseDisputeKit.sol"; - import "../../rng/RNG.sol"; +import "../../evidence/IEvidence.sol"; interface IProofOfHumanity { /** @dev Return true if the submission is registered and not expired. @@ -30,7 +30,7 @@ interface IProofOfHumanity { * - an incentive system: equal split between coherent votes, * - an appeal system: fund 2 choices only, vote on any choice. */ -contract DisputeKitSybilResistant is BaseDisputeKit { +contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { // ************************************* // // * Structs * // // ************************************* // @@ -396,6 +396,14 @@ contract DisputeKitSybilResistant is BaseDisputeKit { } } + /** @dev Submits evidence. + * @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to. It's the submitter responsability to submit the right evidence group ID. + * @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'. + */ + function submitEvidence(uint256 _evidenceGroupID, string calldata _evidence) external { + emit Evidence(core, _evidenceGroupID, msg.sender, _evidence); + } + // ************************************* // // * Public Views * // // ************************************* // diff --git a/contracts/src/evidence/EvidenceModule.sol b/contracts/src/evidence/EvidenceModule.sol index e8fd820f7..358405065 100644 --- a/contracts/src/evidence/EvidenceModule.sol +++ b/contracts/src/evidence/EvidenceModule.sol @@ -20,15 +20,17 @@ import "./IEvidence.sol"; import "../arbitration/IArbitrator.sol"; contract EvidenceModule is IEvidence { - IArbitrator private constant NULL_ARBITRATOR = IArbitrator(address(0x0)); + IArbitrator public arbitrator; - constructor() {} + constructor(IArbitrator _arbitrator) { + arbitrator = _arbitrator; + } /** @dev Submits evidence. * @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to. It's the submitter responsability to submit the right evidence group ID. * @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'. */ function submitEvidence(uint256 _evidenceGroupID, string calldata _evidence) external { - emit Evidence(NULL_ARBITRATOR, _evidenceGroupID, msg.sender, _evidence); + emit Evidence(arbitrator, _evidenceGroupID, msg.sender, _evidence); } } diff --git a/contracts/src/evidence/IEvidence.sol b/contracts/src/evidence/IEvidence.sol index 9ccfe8900..72f4caf36 100644 --- a/contracts/src/evidence/IEvidence.sol +++ b/contracts/src/evidence/IEvidence.sol @@ -6,13 +6,6 @@ import "../arbitration/IArbitrator.sol"; * ERC-1497: Evidence Standard */ interface IEvidence { - /** - * @dev To be emitted when meta-evidence is submitted. - * @param _metaEvidenceID Unique identifier of meta-evidence. - * @param _evidence IPFS path to metaevidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/metaevidence.json' - */ - event MetaEvidence(uint256 indexed _metaEvidenceID, string _evidence); - /** * @dev To be raised when evidence is submitted. Should point to the resource (evidences are not to be stored on chain due to gas considerations). * @param _arbitrator The arbitrator of the contract. @@ -26,18 +19,4 @@ interface IEvidence { address indexed _party, string _evidence ); - - /** - * @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID. - * @param _arbitrator The arbitrator of the contract. - * @param _disputeID ID of the dispute in the Arbitrator contract. - * @param _metaEvidenceID Unique identifier of meta-evidence. - * @param _evidenceGroupID Unique identifier of the evidence group that is linked to this dispute. - */ - event Dispute( - IArbitrator indexed _arbitrator, - uint256 indexed _disputeID, - uint256 _metaEvidenceID, - uint256 _evidenceGroupID - ); } diff --git a/contracts/src/evidence/IMetaEvidence.sol b/contracts/src/evidence/IMetaEvidence.sol new file mode 100644 index 000000000..5c4137804 --- /dev/null +++ b/contracts/src/evidence/IMetaEvidence.sol @@ -0,0 +1,30 @@ +pragma solidity ^0.8.0; + +import "../arbitration/IArbitrator.sol"; +import "./IEvidence.sol"; + +/** @title IEvidence + * ERC-1497: Evidence Standard + */ +interface IMetaEvidence is IEvidence { + /** + * @dev To be emitted when meta-evidence is submitted. + * @param _metaEvidenceID Unique identifier of meta-evidence. + * @param _evidence IPFS path to metaevidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/metaevidence.json' + */ + event MetaEvidence(uint256 indexed _metaEvidenceID, string _evidence); + + /** + * @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID. + * @param _arbitrator The arbitrator of the contract. + * @param _disputeID ID of the dispute in the Arbitrator contract. + * @param _metaEvidenceID Unique identifier of meta-evidence. + * @param _evidenceGroupID Unique identifier of the evidence group that is linked to this dispute. + */ + event Dispute( + IArbitrator indexed _arbitrator, + uint256 indexed _disputeID, + uint256 _metaEvidenceID, + uint256 _evidenceGroupID + ); +} diff --git a/contracts/src/evidence/ModeratedEvidenceModule.sol b/contracts/src/evidence/ModeratedEvidenceModule.sol index f87d927e9..0340b9c23 100644 --- a/contracts/src/evidence/ModeratedEvidenceModule.sol +++ b/contracts/src/evidence/ModeratedEvidenceModule.sol @@ -18,10 +18,10 @@ pragma solidity ^0.8; // TODO: standard interfaces should be placed in a separated repo (?) import "../arbitration/IArbitrable.sol"; import "../arbitration/IArbitrator.sol"; -import "./IEvidence.sol"; +import "./IMetaEvidence.sol"; import "../libraries/CappedMath.sol"; -contract ModeratedEvidenceModule is IArbitrable, IEvidence { +contract ModeratedEvidenceModule is IArbitrable, IMetaEvidence { using CappedMath for uint256; uint256 public constant AMOUNT_OF_CHOICES = 2; diff --git a/contracts/src/gateway/interfaces/IHomeGateway.sol b/contracts/src/gateway/interfaces/IHomeGateway.sol index 581db61bd..99eae4d6e 100644 --- a/contracts/src/gateway/interfaces/IHomeGateway.sol +++ b/contracts/src/gateway/interfaces/IHomeGateway.sol @@ -3,9 +3,9 @@ pragma solidity ^0.8.0; import "../../arbitration/IArbitrable.sol"; -import "../../evidence/IEvidence.sol"; +import "../../evidence/IMetaEvidence.sol"; -interface IHomeGateway is IArbitrable, IEvidence { +interface IHomeGateway is IArbitrable, IMetaEvidence { function chainID() external view returns (uint256); function relayCreateDispute(