|
| 1 | +// SPDX-License-Identifier: MIT |
| 2 | +// Analog's Contracts (last updated v0.1.0) (src/interfaces/IGateway.sol) |
| 3 | + |
| 4 | +pragma solidity >=0.8.0; |
| 5 | + |
| 6 | +/** |
| 7 | + * @dev Required interface of an Gateway compliant contract |
| 8 | + */ |
| 9 | +interface IGateway { |
| 10 | + /** |
| 11 | + * @dev New GMP submitted by calling the `submitMessage` method. |
| 12 | + * @param id EIP-712 hash of the `GmpPayload`, which is it's unique identifier |
| 13 | + * @param source sender account, with an extra flag indicating if it is a contract or an EOA |
| 14 | + * @param destinationAddress the target address on the destination chain. |
| 15 | + * @param destinationNetwork the target chain where the contract call will be made. |
| 16 | + * @param gasLimit the gas limit available for the contract call |
| 17 | + * @param gasCost the gas limit available for the contract call |
| 18 | + * @param nonce Sequence number per sender, used to guarantee each message is unique. |
| 19 | + * @param data message data with no specified format |
| 20 | + */ |
| 21 | + event GmpCreated( |
| 22 | + bytes32 indexed id, |
| 23 | + bytes32 indexed source, |
| 24 | + address indexed destinationAddress, |
| 25 | + uint16 destinationNetwork, |
| 26 | + uint64 gasLimit, |
| 27 | + uint64 gasCost, |
| 28 | + uint64 nonce, |
| 29 | + bytes data |
| 30 | + ); |
| 31 | + |
| 32 | + function networkId() external view returns (uint16); |
| 33 | + |
| 34 | + /** |
| 35 | + * @notice Estimate the gas cost of execute a GMP message. |
| 36 | + * @dev This function is called on the destination chain before calling the gateway to execute a source contract. |
| 37 | + * @param networkid The target chain where the contract call will be made |
| 38 | + * @param messageSize Message size |
| 39 | + * @param messageSize Message gas limit |
| 40 | + */ |
| 41 | + function estimateMessageCost(uint16 networkid, uint16 messageSize, uint64 gasLimit) |
| 42 | + external |
| 43 | + view |
| 44 | + returns (uint256); |
| 45 | + |
| 46 | + /** |
| 47 | + * @dev Send message from chain A to chain B |
| 48 | + * @param destinationAddress the target address on the destination chain |
| 49 | + * @param destinationNetwork the target chain where the contract call will be made |
| 50 | + * @param executionGasLimit the gas limit available for the contract call |
| 51 | + * @param data message data with no specified format |
| 52 | + */ |
| 53 | + function submitMessage( |
| 54 | + address destinationAddress, |
| 55 | + uint16 destinationNetwork, |
| 56 | + uint64 executionGasLimit, |
| 57 | + bytes calldata data |
| 58 | + ) external payable returns (bytes32); |
| 59 | +} |
0 commit comments