packages/contracts-core/contracts/interfaces/InterfaceDestination.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import {ChainGas, GasData} from "../libs/stack/GasData.sol";
interface InterfaceDestination {
/**
* @notice Attempts to pass a quarantined Agent Merkle Root to a local Light Manager.
* @dev Will do nothing, if root optimistic period is not over.
* @return rootPending Whether there is a pending agent merkle root left
*/
function passAgentRoot() external returns (bool rootPending);
/**
* @notice Accepts an attestation, which local `AgentManager` verified to have been signed
* by an active Notary for this chain.
* > Attestation is created whenever a Notary-signed snapshot is saved in Summit on Synapse Chain.
* - Saved Attestation could be later used to prove the inclusion of message in the Origin Merkle Tree.
* - Messages coming from chains included in the Attestation's snapshot could be proven.
* - Proof only exists for messages that were sent prior to when the Attestation's snapshot was taken.
* > Will revert if any of these is true:
* > - Called by anyone other than local `AgentManager`.
* > - Attestation payload is not properly formatted.
* > - Attestation signer is in Dispute.
* > - Attestation's snapshot root has been previously submitted.
* Note: agentRoot and snapGas have been verified by the local `AgentManager`.
* @param notaryIndex Index of Attestation Notary in Agent Merkle Tree
* @param sigIndex Index of stored Notary signature
* @param attPayload Raw payload with Attestation data
* @param agentRoot Agent Merkle Root from the Attestation
* @param snapGas Gas data for each chain in the Attestation's snapshot
* @return wasAccepted Whether the Attestation was accepted
*/
function acceptAttestation(
uint32 notaryIndex,
uint256 sigIndex,
bytes memory attPayload,
bytes32 agentRoot,
ChainGas[] memory snapGas
) external returns (bool wasAccepted);
// ═══════════════════════════════════════════════════ VIEWS ═══════════════════════════════════════════════════════
/**
* @notice Returns the total amount of Notaries attestations that have been accepted.
*/
function attestationsAmount() external view returns (uint256);
/**
* @notice Returns a Notary-signed attestation with a given index.
* > Index refers to the list of all attestations accepted by this contract.
* @dev Attestations are created on Synapse Chain whenever a Notary-signed snapshot is accepted by Summit.
* Will return an empty signature if this contract is deployed on Synapse Chain.
* @param index Attestation index
* @return attPayload Raw payload with Attestation data
* @return attSignature Notary signature for the reported attestation
*/
function getAttestation(uint256 index) external view returns (bytes memory attPayload, bytes memory attSignature);
/**
* @notice Returns the gas data for a given chain from the latest accepted attestation with that chain.
* @dev Will return empty values if there is no data for the domain,
* or if the notary who provided the data is in dispute.
* @param domain Domain for the chain
* @return gasData Gas data for the chain
* @return dataMaturity Gas data age in seconds
*/
function getGasData(uint32 domain) external view returns (GasData gasData, uint256 dataMaturity);
/**
* Returns status of Destination contract as far as snapshot/agent roots are concerned
* @return snapRootTime Timestamp when latest snapshot root was accepted
* @return agentRootTime Timestamp when latest agent root was accepted
* @return notaryIndex Index of Notary who signed the latest agent root
*/
function destStatus() external view returns (uint40 snapRootTime, uint40 agentRootTime, uint32 notaryIndex);
/**
* Returns Agent Merkle Root to be passed to LightManager once its optimistic period is over.
*/
function nextAgentRoot() external view returns (bytes32);
/**
* @notice Returns the nonce of the last attestation submitted by a Notary with a given agent index.
* @dev Will return zero if the Notary hasn't submitted any attestations yet.
*/
function lastAttestationNonce(uint32 notaryIndex) external view returns (uint32);
}