// Source: contracts/interfaces/IInterchainGovernance.sol pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT // File contracts/interfaces/IAxelarGateway.sol /** * @title IAxelarGateway * @dev Interface for the Axelar Gateway that supports general message passing and contract call execution. */ interface IAxelarGateway { /** * @notice Emitted when a contract call is made through the gateway. * @dev Logs the attempt to call a contract on another chain. * @param sender The address of the sender who initiated the contract call. * @param destinationChain The name of the destination chain. * @param destinationContractAddress The address of the contract on the destination chain. * @param payloadHash The keccak256 hash of the sent payload data. * @param payload The payload data used for the contract call. */ event ContractCall( address indexed sender, string destinationChain, string destinationContractAddress, bytes32 indexed payloadHash, bytes payload ); /** * @notice Sends a contract call to another chain. * @dev Initiates a cross-chain contract call through the gateway to the specified destination chain and contract. * @param destinationChain The name of the destination chain. * @param contractAddress The address of the contract on the destination chain. * @param payload The payload data to be used in the contract call. */ function callContract( string calldata destinationChain, string calldata contractAddress, bytes calldata payload ) external; /** * @notice Checks if a contract call is approved. * @dev Determines whether a given contract call, identified by the commandId and payloadHash, is approved. * @param commandId The identifier of the command to check. * @param sourceChain The name of the source chain. * @param sourceAddress The address of the sender on the source chain. * @param contractAddress The address of the contract where the call will be executed. * @param payloadHash The keccak256 hash of the payload data. * @return True if the contract call is approved, false otherwise. */ function isContractCallApproved( bytes32 commandId, string calldata sourceChain, string calldata sourceAddress, address contractAddress, bytes32 payloadHash ) external view returns (bool); /** * @notice Validates and approves a contract call. * @dev Validates the given contract call information and marks it as approved if valid. * @param commandId The identifier of the command to validate. * @param sourceChain The name of the source chain. * @param sourceAddress The address of the sender on the source chain. * @param payloadHash The keccak256 hash of the payload data. * @return True if the contract call is validated and approved, false otherwise. */ function validateContractCall( bytes32 commandId, string calldata sourceChain, string calldata sourceAddress, bytes32 payloadHash ) external returns (bool); /** * @notice Checks if a command has been executed. * @dev Determines whether a command, identified by the commandId, has been executed. * @param commandId The identifier of the command to check. * @return True if the command has been executed, false otherwise. */ function isCommandExecuted(bytes32 commandId) external view returns (bool); } // File contracts/interfaces/IAxelarExecutable.sol /** * @title IAxelarExecutable * @dev Interface for a contract that is executable by Axelar Gateway's cross-chain message passing. * It defines a standard interface to execute commands sent from another chain. */ interface IAxelarExecutable { /** * @dev Thrown when a function is called with an invalid address. */ error InvalidAddress(); /** * @dev Thrown when the call is not approved by the Axelar Gateway. */ error NotApprovedByGateway(); /** * @notice Returns the address of the AxelarGateway contract. * @return The Axelar Gateway contract associated with this executable contract. */ function gateway() external view returns (IAxelarGateway); /** * @notice Executes the specified command sent from another chain. * @dev This function is called by the Axelar Gateway to carry out cross-chain commands. * Reverts if the call is not approved by the gateway or other checks fail. * @param commandId The identifier of the command to execute. * @param sourceChain The name of the source chain from where the command originated. * @param sourceAddress The address on the source chain that sent the command. * @param payload The payload of the command to be executed. This typically includes the function selector and encoded arguments. */ function execute( bytes32 commandId, string calldata sourceChain, string calldata sourceAddress, bytes calldata payload ) external; } // File contracts/interfaces/ICaller.sol interface ICaller { error InvalidContract(address target); error InsufficientBalance(); error ExecutionFailed(); } // File contracts/interfaces/ITimeLock.sol /** * @title ITimeLock * @dev Interface for a TimeLock that enables function execution after a certain time has passed. */ interface ITimeLock { error InvalidTimeLockHash(); error TimeLockAlreadyScheduled(); error TimeLockNotReady(); /** * @notice Returns a minimum time delay at which the TimeLock may be scheduled. * @return uint Minimum scheduling delay time (in secs) from the current block timestamp */ function minimumTimeLockDelay() external view returns (uint256); /** * @notice Returns the timestamp after which the TimeLock may be executed. * @param hash The hash of the timelock * @return uint The timestamp after which the timelock with the given hash can be executed */ function getTimeLock(bytes32 hash) external view returns (uint256); } // File contracts/interfaces/IInterchainGovernance.sol /** * @title IInterchainGovernance Interface * @notice This interface extends IAxelarExecutable for interchain governance mechanisms. */ interface IInterchainGovernance is IAxelarExecutable, ICaller, ITimeLock { error NotGovernance(); error NotSelf(); error InvalidCommand(); error InvalidTarget(); error TokenNotSupported(); event ProposalScheduled( bytes32 indexed proposalHash, address indexed target, bytes callData, uint256 value, uint256 indexed eta ); event ProposalCancelled( bytes32 indexed proposalHash, address indexed target, bytes callData, uint256 value, uint256 indexed eta ); event ProposalExecuted( bytes32 indexed proposalHash, address indexed target, bytes callData, uint256 value, uint256 indexed timestamp ); /** * @notice Returns the name of the governance chain. * @return string The name of the governance chain */ function governanceChain() external view returns (string memory); /** * @notice Returns the address of the governance address. * @return string The address of the governance address */ function governanceAddress() external view returns (string memory); /** * @notice Returns the hash of the governance chain. * @return bytes32 The hash of the governance chain */ function governanceChainHash() external view returns (bytes32); /** * @notice Returns the hash of the governance address. * @return bytes32 The hash of the governance address */ function governanceAddressHash() external view returns (bytes32); /** * @notice Returns the ETA of a proposal. * @param target The address of the contract targeted by the proposal * @param callData The call data to be sent to the target contract * @param nativeValue The amount of native tokens to be sent to the target contract * @return uint256 The ETA of the proposal */ function getProposalEta( address target, bytes calldata callData, uint256 nativeValue ) external view returns (uint256); /** * @notice Executes a governance proposal. * @param targetContract The address of the contract targeted by the proposal * @param callData The call data to be sent to the target contract * @param value The amount of ETH to be sent to the target contract */ function executeProposal( address targetContract, bytes calldata callData, uint256 value ) external payable; /** * @notice Withdraws native token from the contract * @param recipient The address to send the native token to * @param amount The amount of native token to send * @dev This function is only callable by the contract itself after passing according proposal */ function withdraw(address recipient, uint256 amount) external; }