IAgentManager

Git Source

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

NameTypeDescription
guardIndexuint32Index of the Guard in the Agent Merkle Tree
notaryIndexuint32Index 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

NameTypeDescription
domainuint32Domain where the Agent is active
agentaddressAddress of the Agent
proveraddressAddress 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

NameTypeDescription
agentaddressAgent address

Returns

NameTypeDescription
<none>AgentStatusStatus 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

NameTypeDescription
indexuint256Agent index in the Agent Merkle Tree

Returns

NameTypeDescription
agentaddressAgent address
statusAgentStatusStatus 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

NameTypeDescription
indexuint256Dispute index

Returns

NameTypeDescription
guardaddressAddress of the Guard in the Dispute
notaryaddressAddress of the Notary in the Dispute
slashedAgentaddressAddress of the Agent who was slashed when Dispute was resolved
fraudProveraddressAddress who provided fraud proof to resolve the Dispute
reportPayloadbytesRaw payload with report data that led to the Dispute
reportSignaturebytesGuard 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

NameTypeDescription
agentaddressAgent address

Returns

NameTypeDescription
flagDisputeFlagFlag describing the current Dispute status for the agent: None/Pending/Slashed
rivaladdressAddress of the rival agent in the Dispute
fraudProveraddressAddress who provided fraud proof to resolve the Dispute
disputePtruint256Index of the opened Dispute PLUS ONE. Zero if agent is not in Dispute.