ArbitrableExample

Git Source

Inherits: IArbitrableV2

State Variables

governor

address public immutable governor;

arbitrator

IArbitratorV2 public arbitrator;

disputeTemplates

uint256 public disputeTemplates;

weth

ERC20 public immutable weth;

externalIDtoLocalID

mapping(uint256 => uint256) public externalIDtoLocalID;

disputes

DisputeStruct[] public disputes;

Functions

constructor

Constructor

constructor(IArbitratorV2 _arbitrator, string memory _templateData, ERC20 _weth);

Parameters

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

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(
    uint256 _templateId,
    string calldata _action,
    bytes calldata _arbitratorExtraData,
    uint256 _feeInWeth
) external payable returns (uint256 disputeID);

Parameters

NameTypeDescription
_templateIduint256The identifier of the dispute template. Should not be used with _templateUri.
_actionstringThe action that requires arbitration.
_arbitratorExtraDatabytesExtra data for the arbitrator.
_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.

changeDisputeTemplate

function changeDisputeTemplate(string memory _templateData) external;

changeArbitrator

function changeArbitrator(IArbitratorV2 _arbitrator) external;

Events

Action

event Action(string indexed _action);

Structs

DisputeStruct

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