Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interfaces for execution #2063

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IExecutionFees {
/// @notice Add the execution fee for a transaction. The attached value will be added to the
/// rewards for the executor completing the transaction.
/// Note: this could be used to store the execution fee for a new transaction, or to add more
/// funds to the execution fee of an existing transaction. Therefore this function is payable,
/// and does not implement any caller restrictions.
/// @dev Will revert if the executor is already recorded for the transaction.
/// @param dstChainId The chain id of the destination chain.
/// @param transactionId The id of the transaction to add the execution fee to.
function addExecutionFee(uint256 dstChainId, bytes32 transactionId) external payable;

/// @notice Record the executor (who completed the transaction) for a transaction,
/// and update the accumulated rewards for the executor.
/// @dev Could only be called by the Recorder.
/// @param dstChainId The chain id of the destination chain.
/// @param transactionId The id of the transaction to record the executor for.
/// @param executor The address of the executor who completed the transaction.
function recordExecutor(uint256 dstChainId, bytes32 transactionId, address executor) external;

/// @notice Allows the executor to claim their unclaimed rewards.
/// @dev Will revert if the executor has no unclaimed rewards.
function claimExecutionFees() external;

// ═══════════════════════════════════════════════════ VIEWS ═══════════════════════════════════════════════════════

/// @notice Get the accumulated rewards for an executor.
/// @param executor The address of the executor to get the rewards for.
function getAccumulatedRewards(address executor) external view returns (uint256 accumulated);

/// @notice Get the unclaimed rewards for an executor.
/// @param executor The address of the executor to get the rewards for.
function getUnclaimedRewards(address executor) external view returns (uint256 unclaimed);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IExecutor {
/// @notice Request the execution of an Interchain Transaction on a remote chain.
/// Note: the off-chain actor needs to fetch the transaction payload from the InterchainClient
/// event with the same transactionId, then execute the transaction on the remote chain:
/// `dstInterchainClient.executeTransaction(transactionPayload)`
/// Once the execution is confirmed on the source chain, the off-chain actor will be able
/// to claim `executionFee` in the ExecutionFees contract.
/// @dev Could only be called by `InterchainClient` contracts.
/// Will revert if the execution fee is not big enough.
/// @param dstChainId The chain id of the destination chain.
/// @param txPayloadSize The size of the transaction payload to use for the execution.
/// @param transactionId The id of the transaction to execute.
/// @param executionFee The fee paid for the execution.
/// @param options The options to use for the execution.
function requestExecution(
uint256 dstChainId,
uint256 txPayloadSize,
bytes32 transactionId,
uint256 executionFee,
bytes memory options
)
external;

/// @notice Get the execution fee for executing an Interchain Transaction on a remote chain.
/// @param dstChainId The chain id of the destination chain.
/// @param txPayloadSize The size of the transaction payload to use for the execution.
/// @param options The options to use for the execution.
function getExecutionFee(
uint256 dstChainId,
uint256 txPayloadSize,
bytes memory options
)
external
view
returns (uint256);
}
Loading