archon.arbitrator¶
This package provides the functionality to interact with Arbitrator contracts.
An Arbitrator
contract makes rulings on disputes.
Tip
See ERC 792. for more information on Arbitrator
contracts.
DisputeStatus¶
The dispute status enum used to map a DisputeStatus
int to plain text status.
The enum is defined in the Arbitrator
contract as follows:
enum DisputeStatus {Waiting, Appealable, Solved}
Example¶
archon.arbitrator.DisputeStatus[1]
> 'Appealable'
getArbitrationCost()¶
archon.arbitrator.getArbitrationCost(contractAddress, extraData='0x0');
Get the arbitration cost based from extraData
.
Note
The format of extraData will depend on the implementation of the Arbitrator.
Parameters¶
contractAddress
-String
: The address of the arbitrator contract.extraData
-String
: Hex string representing some bytes used by arbitrator for customization of dispute resolution.
Returns¶
Promise.<String>
- Promise resolves to the cost of arbitration (in WEI)
Example¶
archon.arbitrator.getArbitrationCost(
'0x211f01e59b425253c0a0e9a7bf612605b42ce82c'
).then(data => {
console.log(data)
})
> "150000000000000000"
getAppealCost()¶
archon.arbitrator.getAppealCost(contractAddress, disputeID, extraData='0x0');
Get the cost of an appeal for a specific dispute base on extraData
.
Note
The format of extraData will depend on the implementation of the Arbitrator.
Parameters¶
contractAddress
-String
: The address of the arbitrator contract.disputeID
-Number
: The unique identifier of the dispute.extraData
-String
: Hex string representing some bytes used by arbitrator for customization of dispute resolution.
Returns¶
Promise.<String>
- Promise resolves to the cost of appeal (in WEI)
Example¶
archon.arbitrator.getAppealCost(
'0x211f01e59b425253c0a0e9a7bf612605b42ce82c'
).then(data => {
console.log(data)
})
> "150000000000000000"
getCurrentRuling()¶
archon.arbitrator.getCurrentRuling(contractAddress, disputeID);
Get the current ruling of a dispute.
Parameters¶
contractAddress
-String
: The address of the arbitrator contract.disputeID
-Number
: The unique identifier of the dispute.
Returns¶
Promise.<String>
- Promise resolves to the current ruling of the dispute.
Example¶
archon.arbitrator.getCurrentRuling(
'0x211f01e59b425253c0a0e9a7bf612605b42ce82c',
15
).then(data => {
console.log(data)
})
> "2"
getDisputeStatus()¶
archon.arbitrator.getDisputeStatus(contractAddress, disputeID);
Get the status of the dispute.
Tip
Use archon.arbitrator.DisputeStatus to get a plain text status.
Parameters¶
contractAddress
-String
: The address of the arbitrator contract.disputeID
-Number
: The unique identifier of the dispute.
Returns¶
Promise.<String>
- Promise resolves to the status of a dispute as a number string.
Example¶
archon.arbitrator.getDisputeStatus(
'0x211f01e59b425253c0a0e9a7bf612605b42ce82c',
15
).then(data => {
console.log(data)
})
> "0"
getDisputeCreation()¶
archon.arbitrator.getDisputeCreation(contractAddress, disputeID, options={})
Fetch the dispute creation event log and return data about the dispute creation.
Parameters¶
contractAddress
-String
: The address of the arbitrator contract.disputeID
-Number
: The unique identifier of the dispute.options
-Object
: Optional parameters.
The options parameter can include:
Key | Type | Description |
---|---|---|
fromBlock | int | The block where we start searching for event logs. |
toBlock | int | The block where we will stop searching for event logs. |
filters | object | Additional filters for event logs. |
Returns¶
Promise.<Object>
- Promise resolves to an object with data from the dispute creation log.
{
createdAt: <Number>, // epoch timestamp in seconds
arbitrableContract: <String>,
blockNumber: <Number>,
transactionHash: <String>
}
Example¶
archon.arbitrator.getDisputeCreation(
'0x211f01e59b425253c0a0e9a7bf612605b42ce82c',
15
).then(data => {
console.log(data)
})
> {
createdAt: 1539000000,
arbitrableContract: "0x91697c78d48e9c83b71727ddd41ccdc95bb2f012",
blockNumber: 6459000,
transactionHash: "0x340fdc6e32ef24eb14f9ccbd2ec614a8d0c7121e8d53f574529008f468481990"
}
getAppealDecision()¶
archon.arbitrator.getAppealDecision(contractAddress, disputeID, appealNumber, options={})
Fetch the appeal decision event log and return data about the appeal.
Parameters¶
contractAddress
-String
: The address of the arbitrator contract.disputeID
-Number
: The unique identifier of the dispute.appealNumber
-Number
: The appeal number. Must be >= 1options
-Object
: Optional parameters.
The options parameter can include:
Key | Type | Description |
---|---|---|
fromBlock | int | The block where we start searching for event logs. |
toBlock | int | The block where we will stop searching for event logs. |
filters | object | Additional filters for event logs. |
Returns¶
Promise.<Object>
- Promise resolves to an object with data from the appeal decision log.
{
appealedAt: <Number>, // epoch timestamp in seconds
arbitrableContract: <String>,
blockNumber: <Number>,
transactionHash: <String>
}
Example¶
archon.arbitrator.getAppealDecision(
'0x211f01e59b425253c0a0e9a7bf612605b42ce82c',
15,
1
).then(data => {
console.log(data)
})
> {
appealedAt: 1539025733,
arbitrableContract: "0x91697c78d48e9c83b71727ddd41ccdc95bb2f012",
blockNumber: 6459276,
transactionHash: "0x340fdc6e32ef24eb14f9ccbd2ec614a8d0c7121e8d53f574529008f468481990"
}