This repository has been archived by the owner on Jun 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
622 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export const STATUS = { | ||
NO_DISPUTE: 0, | ||
WAITING_PARTY_A: 1, | ||
WAITING_PARTY_B: 2, | ||
WAITING_SELLER: 1, | ||
WAITING_BUYER: 2, | ||
DISPUTE_CREATED: 3, | ||
RESOLVED: 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import AbstractContract from '../AbstractContract' | ||
|
||
/** | ||
* Arbitrable Abstract Contarct API. This wraps an arbitrable contract. It provides | ||
* interaction with both the off chain store as well as the arbitrable instance. All | ||
* arbitrable methods from the supplied contract implementation can be called from this | ||
* object. | ||
*/ | ||
class ArbitrableContract extends AbstractContract { | ||
/** | ||
* Submit evidence. FIXME should we determine the hash for the user? | ||
* @param {string} account - ETH address of user. | ||
* @param {string} arbitrableTransactionId - Id of the arbitrable transaction. | ||
* @param {string} name - Name of evidence. | ||
* @param {string} description - Description of evidence. | ||
* @param {string} url - A link to an evidence using its URI. | ||
* @param {string} hash - A hash of the evidence at the URI. No hash if content is dynamic | ||
* @returns {string} - txHash Hash transaction. | ||
*/ | ||
submitEvidence = async ( | ||
account, | ||
arbitrableTransactionId, | ||
name, | ||
description, | ||
url, | ||
hash | ||
) => { | ||
const contractAddress = this._contractImplementation.contractAddress | ||
|
||
// get the index of the new evidence | ||
const evidenceIndex = await this._StoreProvider.addEvidenceContract( | ||
contractAddress, | ||
arbitrableTransactionId, | ||
account, | ||
name, | ||
description, | ||
url, | ||
hash | ||
) | ||
|
||
// construct the unique URI | ||
const evidenceUri = this._StoreProvider.getEvidenceUri( | ||
account, | ||
contractAddress, | ||
arbitrableTransactionId, | ||
evidenceIndex | ||
) | ||
|
||
const txHash = await this._contractImplementation.submitEvidence( | ||
account, | ||
arbitrableTransactionId, | ||
evidenceUri | ||
) | ||
|
||
return txHash | ||
} | ||
} | ||
|
||
export default ArbitrableContract |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.