The Disputable
parent contract is a contract which enables its children to easily interact with Celeste. It does this by packaging common patterns into internal methods which can be used by your contracts.
Inheriting from Disputable
will allow you to easily create disputes and query their rulings while automatically syncing with Celeste's Manifest.
Constructor
constructor(address, address)
Parameters:
address _arbitrator
: address of the Celeste AragonCourt
instance. Not hard coded for test purposes. This allows the instance to be initialized with the address of the mock during testing
address _arbitratorManifest
: address of the Celeste CourtManifest
instance.
Emitted events:
The constructor does not emit any events.
General function
Initializes instance.
Properties
IArbitrator immutable public arbitrator
Celeste AragonCourt
instance as specified during initialization. Can be used if your contract wants to directly interact with Celeste.
IArbitratorManifest immutable public arbitratorManifest
Celeste ArbitratorManifest
instance as specified during initialization. Can be used if your contract wants to directly interact with Celests's representative manifest.
uint256 internal constant RULING_REFUSED = 2
uint256 internal constant RULING_AGAINST_ACTION = 3
uint256 internal constant RULING_FOR_ACTION = 4
Simple constants which give human readable names to the 3 possible rulings.
Methods
external submitEvidenceFor(uint256, bytes) -> ()
Parameters:
uint256 _disputeId
:
The dispute ID for which evidence is to be submitted
bytes calldata _evidence
:
Evidence to be evaluated by the jurors in the form of plain text.
Emitted Events:
This method does not directly emit any events but may indirectly trigger events in the DisputeManager. (view step 2. "Submitting Evidence" here for more info).
General function
Will submit evidence for the case. Will submit evidence on behalf of the defendant or challenger depending on the caller. Will revert if the caller not a participating party or is a representative for both or neither parties.
internal _prepareDisputeFee() -> (IERC20, uint256)
Return values:
IERC20 feeToken
:
ERC20 token in which the fee is denominated in
uint256 feeAmount
:
Amount of fee in feeToken
Emitted Events:
Doesn't directly emit any events besides an ERC20.Approval
event approving the necessary Celeste dispute fee receiver.
General function
Prepares the dispute fee for the creation of a dispute. Useful if you want to ensure necessary approval but want to fund the fee with some custom mechanism.
_prepareAndPullDisputeFeeFrom(address) -> ()
Parameters:
address _feePayer
:
address from which to pull the necessary dispute fee. Requires the address to have approved the disputable contract to spend the fee token.
Emitted Events:
Doesn't directly emit any events besides an ERC20.Approval
event approving the necessary Celeste dispute fee receiver and an ERC20.Transfer
event denoting the transfer of the fee from the feePayer
to the disputable contract.
General function
Pulls the necessary dispute fee from the specified address. If a call to this internal method does not revert it means that the fee requirements will be for the creation of a single dispute.
internal _getRulingOf(uint256) -> (uint256)
Parameters:
uint256 _disputeId
:
The disputeId for which the ruling is to be queried
Return values:
uint256 ruling
:
Ruling of dispute. Can be checked in a human readable way via the RULING_{...}
constants detailed above.
Emitted Events:
May indirectly trigger multiple events within the DisputeManager if a ruling is computed for the first time. No events are directly emitted from the disputable contract.
General function
Reverts if no ruling is available. Otherwise it retrieves the existing ruling or computes it if it's available but hasn't been directly computed yet.
internal _createDisputeAgainst(address, address, bytes) -> (uint256)
Parameters:
address _defendant
:
Defendant to be set for dispute. Only direct effect is limiting who can submit evidence for that dispute.
address _challenger
:
Challenger to be set for dispute. Only direct effect is limiting who can submit evidence for that dispute. Should generally be the msg.sender
Return values:
uint256 disputeId
:
Dispute ID of the newly created dispute.
Emitted events:
PartiesSet(uint256 indexed disputeId, address indexed defendant, address indexed challenger)
Emitted from the ArbitratorManifest
Other events are emitted from within the DisputeManager as the dispute is created.
General function
Transfers Celeste's dispute fee from the disputable contract to the necessary recipient, creates a dispute and updates the manifest.