IAgentManager
Functions
openDispute
Allows Inbox to open a Dispute between a Guard and a Notary, if they are both not in Dispute already.
Will revert if any of these is true:
- Caller is not Inbox.
- Guard or Notary is already in Dispute.
function openDispute(uint32 guardIndex, uint32 notaryIndex) external;
Parameters
Name | Type | Description |
---|---|---|
guardIndex | uint32 | Index of the Guard in the Agent Merkle Tree |
notaryIndex | uint32 | Index of the Notary in the Agent Merkle Tree |
slashAgent
Allows Inbox to slash an agent, if their fraud was proven.
Will revert if any of these is true:
- Caller is not Inbox.
- Domain doesn't match the saved agent domain.
function slashAgent(uint32 domain, address agent, address prover) external;
Parameters
Name | Type | Description |
---|---|---|
domain | uint32 | Domain where the Agent is active |
agent | address | Address of the Agent |
prover | address | Address that initially provided fraud proof |
agentRoot
Returns the latest known root of the Agent Merkle Tree.
function agentRoot() external view returns (bytes32);
agentStatus
Returns (flag, domain, index) for a given agent. See Structures.sol for details.
Will return AgentFlag.Fraudulent for agents that have been proven to commit fraud, but their status is not updated to Slashed yet.
function agentStatus(address agent) external view returns (AgentStatus memory);
Parameters
Name | Type | Description |
---|---|---|
agent | address | Agent address |
Returns
Name | Type | Description |
---|---|---|
<none> | AgentStatus | Status for the given agent: (flag, domain, index). |
getAgent
Returns agent address and their current status for a given agent index.
Will return empty values if agent with given index doesn't exist.
function getAgent(uint256 index) external view returns (address agent, AgentStatus memory status);
Parameters
Name | Type | Description |
---|---|---|
index | uint256 | Agent index in the Agent Merkle Tree |
Returns
Name | Type | Description |
---|---|---|
agent | address | Agent address |
status | AgentStatus | Status for the given agent: (flag, domain, index) |
getDisputesAmount
Returns the number of opened Disputes.
This includes the Disputes that have been resolved already.
function getDisputesAmount() external view returns (uint256);
getDispute
Returns information about the dispute with the given index.
Will revert if dispute with given index hasn't been opened yet.
function getDispute(uint256 index)
external
view
returns (
address guard,
address notary,
address slashedAgent,
address fraudProver,
bytes memory reportPayload,
bytes memory reportSignature
);
Parameters
Name | Type | Description |
---|---|---|
index | uint256 | Dispute index |
Returns
Name | Type | Description |
---|---|---|
guard | address | Address of the Guard in the Dispute |
notary | address | Address of the Notary in the Dispute |
slashedAgent | address | Address of the Agent who was slashed when Dispute was resolved |
fraudProver | address | Address who provided fraud proof to resolve the Dispute |
reportPayload | bytes | Raw payload with report data that led to the Dispute |
reportSignature | bytes | Guard signature for the report payload |
disputeStatus
Returns the current Dispute status of a given agent. See Structures.sol for details.
Every returned value will be set to zero if agent was not slashed and is not in Dispute.
rival
and disputePtr
will be set to zero if the agent was slashed without being in Dispute.
function disputeStatus(address agent)
external
view
returns (DisputeFlag flag, address rival, address fraudProver, uint256 disputePtr);
Parameters
Name | Type | Description |
---|---|---|
agent | address | Agent address |
Returns
Name | Type | Description |
---|---|---|
flag | DisputeFlag | Flag describing the current Dispute status for the agent: None/Pending/Slashed |
rival | address | Address of the rival agent in the Dispute |
fraudProver | address | Address who provided fraud proof to resolve the Dispute |
disputePtr | uint256 | Index of the opened Dispute PLUS ONE. Zero if agent is not in Dispute. |