Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(IMetaevidence): remove evidence #511

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ contract DisputeKitClassic is BaseDisputeKit, IEvidence {
* @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);
emit Evidence(_evidenceGroupID, msg.sender, _evidence);
}

// ************************************* //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence {
* @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);
emit Evidence(_evidenceGroupID, msg.sender, _evidence);
}

// ************************************* //
Expand Down
10 changes: 8 additions & 2 deletions contracts/src/evidence/EvidenceModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@
pragma solidity ^0.8;

// TODO: standard interfaces should be placed in a separated repo (?)
import "./IEvidence.sol";
import "../arbitration/IArbitrator.sol";

contract EvidenceModule is IEvidence {
contract EvidenceModule {
IArbitrator public arbitrator;

event Evidence(
IArbitrator indexed _arbitrator,
uint256 indexed _evidenceGroupID,
address indexed _party,
string _evidence
);

constructor(IArbitrator _arbitrator) {
arbitrator = _arbitrator;
}
Expand Down
9 changes: 1 addition & 8 deletions contracts/src/evidence/IEvidence.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@ pragma solidity ^0.8.0;
import "../arbitration/IArbitrator.sol";

/** @title IEvidence
* ERC-1497: Evidence Standard
*/
interface IEvidence {
/**
* @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.
* @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to.
* @param _party The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party.
* @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'
*/
event Evidence(
IArbitrator indexed _arbitrator,
uint256 indexed _evidenceGroupID,
address indexed _party,
string _evidence
);
event Evidence(uint256 indexed _evidenceGroupID, address indexed _party, string _evidence);
}
7 changes: 3 additions & 4 deletions contracts/src/evidence/IMetaEvidence.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
pragma solidity ^0.8.0;

import "../arbitration/IArbitrator.sol";
import "./IEvidence.sol";

/** @title IEvidence
* ERC-1497: Evidence Standard
/** @title IMetaEvidence
* ERC-1497: Evidence Standard excluding evidence emission as it will be handled by the arbitrator.
*/
interface IMetaEvidence is IEvidence {
interface IMetaEvidence {
/**
* @dev To be emitted when meta-evidence is submitted.
* @param _metaEvidenceID Unique identifier of meta-evidence.
Expand Down
36 changes: 22 additions & 14 deletions contracts/src/evidence/ModeratedEvidenceModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ contract ModeratedEvidenceModule is IArbitrable, IMetaEvidence {

/* Events */

/**
* @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.
* @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to.
* @param _party The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party.
* @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'
*/
event Evidence(
IArbitrator indexed _arbitrator,
uint256 indexed _evidenceGroupID,
address indexed _party,
string _evidence
);

/** @dev Indicate that a party has to pay a fee or would otherwise be considered as losing.
* @param _evidenceID The ID of the evidence being moderated.
* @param _currentWinner The party who is currently winning.
Expand Down Expand Up @@ -314,11 +328,10 @@ contract ModeratedEvidenceModule is IArbitrable, IMetaEvidence {
* @return taken The amount of ETH taken.
* @return remainder The amount of ETH left from the contribution.
*/
function calculateContribution(uint256 _available, uint256 _requiredAmount)
internal
pure
returns (uint256 taken, uint256 remainder)
{
function calculateContribution(
uint256 _available,
uint256 _requiredAmount
) internal pure returns (uint256 taken, uint256 remainder) {
if (_requiredAmount > _available) return (_available, 0); // Take whatever is available, return 0 as leftover ETH.

remainder = _available - _requiredAmount;
Expand Down Expand Up @@ -420,15 +433,10 @@ contract ModeratedEvidenceModule is IArbitrable, IMetaEvidence {
* @param _moderationID The ID of the moderation occurence.
* @return paidFees currentWinner feeRewards The moderation information.
*/
function getModerationInfo(bytes32 _evidenceID, uint256 _moderationID)
external
view
returns (
uint256[3] memory paidFees,
Party currentWinner,
uint256 feeRewards
)
{
function getModerationInfo(
bytes32 _evidenceID,
uint256 _moderationID
) external view returns (uint256[3] memory paidFees, Party currentWinner, uint256 feeRewards) {
EvidenceData storage evidenceData = evidences[_evidenceID];
Moderation storage moderation = evidenceData.moderations[_moderationID];
return (moderation.paidFees, moderation.currentWinner, moderation.feeRewards);
Expand Down