ArbitrableExample

Git Source

Inherits: IArbitrableV2

State Variables

governor

address public immutable governor;

arbitrator

IArbitratorV2 public arbitrator;

disputeTemplates

uint256 public disputeTemplates;

arbitratorExtraData

bytes public arbitratorExtraData;

weth

IERC20 public immutable weth;

externalIDtoLocalID

mapping(uint256 => uint256) public externalIDtoLocalID;

disputes

DisputeStruct[] public disputes;

Functions

constructor

Constructor

constructor(IArbitratorV2 _arbitrator, string memory _templateData, bytes memory _arbitratorExtraData, IERC20 _weth);

Parameters

NameTypeDescription
_arbitratorIArbitratorV2The arbitrator to rule on created disputes.
_templateDatastringThe dispute template data.
_arbitratorExtraDatabytes
_wethIERC20The WETH token.

changeDisputeTemplate

function changeDisputeTemplate(string memory _templateData) external;

changeArbitrator

function changeArbitrator(IArbitratorV2 _arbitrator) external;

changeArbitratorExtraData

function changeArbitratorExtraData(bytes calldata _arbitratorExtraData) external;

createDispute

Calls createDispute function of the specified arbitrator to create a dispute. Note that we don’t need to check that msg.value is enough to pay arbitration fees as it’s the responsibility of the arbitrator contract.

function createDispute(string calldata _action) external payable returns (uint256 disputeID);

Parameters

NameTypeDescription
_actionstringThe action that requires arbitration.

Returns

NameTypeDescription
disputeIDuint256Dispute id (on arbitrator side) of the dispute created.

createDispute

Calls createDispute function of the specified arbitrator to create a dispute. Note that we don’t need to check that msg.value is enough to pay arbitration fees as it’s the responsibility of the arbitrator contract.

function createDispute(string calldata _action, uint256 _feeInWeth) external payable returns (uint256 disputeID);

Parameters

NameTypeDescription
_actionstringThe action that requires arbitration.
_feeInWethuint256Amount of fees in WETH for the arbitrator.

Returns

NameTypeDescription
disputeIDuint256Dispute id (on arbitrator side) of the dispute created.

rule

To be called by the arbitrator of the dispute, to declare the winning ruling.

function rule(uint256 _externalDisputeID, uint256 _ruling) external override;

Parameters

NameTypeDescription
_externalDisputeIDuint256ID of the dispute in arbitrator contract.
_rulinguint256The ruling choice of the arbitration.

Events

Action

event Action(string indexed _action);

Structs

DisputeStruct

struct DisputeStruct {
    bool isRuled;
    uint256 ruling;
    uint256 numberOfRulingOptions;
}