ERC-1497: Evidence Standard
See the original proposal of the standard here.
Smart contracts in this tutorial are not intended for production but educational purposes. Beware of using them on main network.
SimpleEscrow contract, we used a
string to store the agreement between the parties. The deployer could format that
string anyway they like, as
there are many ways to signal the information about the agreement.
Instead, having a standard would allow interoperability. That's why ERC-1497: Evidence Standard describes a standard approach for this. It has two categories of information: evidence and meta-evidence.
Evidence, as the name hints, is a piece of information to support a proposition. Meta-evidence is the information about the dispute itself: the agreement, parties involved, the thing that is to be decided, ruling options etc.
ERC-1497 introduces three new events: MetaEvidence, Evidence and Dispute.
event MetaEvidenceprovides the context of the dispute, the question the arbitrators have to answer, the human readable meanings of rulings and specific modes of display for evidence. We use
_metaEvidenceIDto uniquely identify a piece of meta-evidence. This is necessary when there are multiple meta-evidence use-cases.
_evidencecontains the URI for meta-evidence JSON file.
event Evidencelinks a piece of evidence with an arbitrator, sending party and dispute.
_evidencecontains the URI for evidence JSON file.
event Disputeis raised when a dispute is created to link the proper meta-evidence and evidence group to the dispute. The event includes a reference to the arbitrator, a unique identifier for the dispute itself, the identifier to look up the meta-evidence event log and the identifier of the evidence group that can be used to look up all evidence submitted in the grouping.
See the original proposal for standard evidence and meta-evidence JSON formats.
Let's return to
SimpleEscrow and refactor it to implement ERC-1497 interface. Recall
Now, first let's implement IEvidence:
And then, we will get rid of
string agreement. Instead we need
string _metaevidence that contains the URI to metaevidence JSON that is formatted according to the standard and we have to emit
We set the identifier of meta-evidence to constant zero, as there won't be multiple meta-evidence for this contract. Any constant number would do the job. Then we emit
MetaEvidence with the provided
_metaevidence. This string contains the URI from where the content of meta-evidence can be fetched.
Also, we need to emit
Dispute when we create a new dispute:
There will be only one dispute in this contract so we can use a constant zero for
Lastly, we need a function to let parties submit evidence:
Congratulations, now your arbitrable is ERC-1497 compatible!