|
1 |
| -/* |
2 |
| - * Copyright (c) 2022, Circle Internet Financial Limited. |
3 |
| - * |
4 |
| - * Licensed under the Apache License, Version 2.0 (the "License"); |
5 |
| - * you may not use this file except in compliance with the License. |
6 |
| - * You may obtain a copy of the License at |
7 |
| - * |
8 |
| - * http://www.apache.org/licenses/LICENSE-2.0 |
9 |
| - * |
10 |
| - * Unless required by applicable law or agreed to in writing, software |
11 |
| - * distributed under the License is distributed on an "AS IS" BASIS, |
12 |
| - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 |
| - * See the License for the specific language governing permissions and |
14 |
| - * limitations under the License. |
15 |
| - */ |
| 1 | +// SPDX-License-Identifier: Apache 2 |
| 2 | +// Copyright (c) 2022, Circle Internet Financial Limited. |
| 3 | +// |
| 4 | +// stripped, flattened version of: |
| 5 | +// https://github.com/circlefin/evm-cctp-contracts/blob/master/src/MessageTransmitter.sol |
| 6 | + |
16 | 7 | pragma solidity ^0.8.0;
|
17 | 8 |
|
18 |
| -import "./IRelayer.sol"; |
19 |
| -import "./IReceiver.sol"; |
| 9 | +import {IOwnable2Step} from "./shared/IOwnable2Step.sol"; |
| 10 | +import {IPausable} from "./shared/IPausable.sol"; |
| 11 | + |
| 12 | +interface IAttestable { |
| 13 | + event AttesterEnabled(address indexed attester); |
| 14 | + event AttesterDisabled(address indexed attester); |
| 15 | + |
| 16 | + event SignatureThresholdUpdated(uint256 oldSignatureThreshold, uint256 newSignatureThreshold); |
| 17 | + event AttesterManagerUpdated( |
| 18 | + address indexed previousAttesterManager, |
| 19 | + address indexed newAttesterManager |
| 20 | + ); |
| 21 | + |
| 22 | + function attesterManager() external view returns (address); |
| 23 | + function isEnabledAttester(address attester) external view returns (bool); |
| 24 | + function getNumEnabledAttesters() external view returns (uint256); |
| 25 | + function getEnabledAttester(uint256 index) external view returns (address); |
| 26 | + |
| 27 | + function updateAttesterManager(address newAttesterManager) external; |
| 28 | + function setSignatureThreshold(uint256 newSignatureThreshold) external; |
| 29 | + function enableAttester(address attester) external; |
| 30 | + function disableAttester(address attester) external; |
| 31 | +} |
| 32 | + |
| 33 | +interface IMessageTransmitter is IAttestable, IPausable, IOwnable2Step { |
| 34 | + event MessageSent(bytes message); |
| 35 | + |
| 36 | + event MessageReceived( |
| 37 | + address indexed caller, |
| 38 | + uint32 sourceDomain, |
| 39 | + uint64 indexed nonce, |
| 40 | + bytes32 sender, |
| 41 | + bytes messageBody |
| 42 | + ); |
| 43 | + |
| 44 | + function localDomain() external view returns (uint32); |
| 45 | + function version() external view returns (uint32); |
| 46 | + function maxMessageBodySize() external view returns (uint256); |
| 47 | + function nextAvailableNonce() external view returns (uint64); |
| 48 | + function usedNonces(bytes32 nonce) external view returns (bool); |
| 49 | + |
| 50 | + function sendMessage( |
| 51 | + uint32 destinationDomain, |
| 52 | + bytes32 recipient, |
| 53 | + bytes calldata messageBody |
| 54 | + ) external returns (uint64); |
| 55 | + |
| 56 | + function sendMessageWithCaller( |
| 57 | + uint32 destinationDomain, |
| 58 | + bytes32 recipient, |
| 59 | + bytes32 destinationCaller, |
| 60 | + bytes calldata messageBody |
| 61 | + ) external returns (uint64); |
| 62 | + |
| 63 | + function replaceMessage( |
| 64 | + bytes calldata originalMessage, |
| 65 | + bytes calldata originalAttestation, |
| 66 | + bytes calldata newMessageBody, |
| 67 | + bytes32 newDestinationCaller |
| 68 | + ) external; |
20 | 69 |
|
21 |
| -/** |
22 |
| - * @title IMessageTransmitter |
23 |
| - * @notice Interface for message transmitters, which both relay and receive messages. |
24 |
| - */ |
25 |
| -interface IMessageTransmitter is IRelayer, IReceiver { |
| 70 | + function receiveMessage( |
| 71 | + bytes calldata message, |
| 72 | + bytes calldata attestation |
| 73 | + ) external returns (bool success); |
26 | 74 |
|
| 75 | + function setMaxMessageBodySize(uint256 newMaxMessageBodySize) external; |
27 | 76 | }
|
0 commit comments