@@ -5,20 +5,53 @@ import "../libraries/NormalizedAmount.sol";
5
5
import "../libraries/EndpointStructs.sol " ;
6
6
7
7
interface IManager {
8
+ /// @notice payment for a transfer is too low.
9
+ /// @param requiredPayment The required payment.
10
+ /// @param providedPayment The provided payment.
8
11
error DeliveryPaymentTooLow (uint256 requiredPayment , uint256 providedPayment );
12
+
13
+ //// @notice The transfer has some dust.
14
+ //// @dev This is a security measure to prevent users from losing funds.
15
+ //// This is the result of normalizing the amount and then denormalizing it.
16
+ //// @param amount The amount to transfer.
9
17
error TransferAmountHasDust (uint256 amount , uint256 dust );
18
+
10
19
error MessageNotApproved (bytes32 msgHash );
11
20
error InvalidTargetChain (uint16 targetChain , uint16 thisChain );
12
21
error ZeroAmount ();
13
22
error BurnAmountDifferentThanBalanceDiff (uint256 burnAmount , uint256 balanceDiff );
23
+
24
+ /// @notice The mode is invalid. It is neither in LOCKING or BURNING mode.
25
+ /// @param mode The mode.
14
26
error InvalidMode (uint8 mode );
27
+
28
+ /// @notice the sibling for the chain does not match the configuration.
29
+ /// @param chainId ChainId of the source chain.
30
+ /// @param siblingAddress Address of the sibling manager contract.
15
31
error InvalidSibling (uint16 chainId , bytes32 siblingAddress );
16
32
error InvalidSiblingChainIdZero ();
33
+
34
+ /// @notice Sibling cannot be the zero address.
17
35
error InvalidSiblingZeroAddress ();
36
+
37
+ /// @notice The number of thresholds should not be zero.
18
38
error ZeroThreshold ();
39
+
40
+ /// @notice The threshold for endpoint attestations is too high.
41
+ /// @param threshold The threshold.
42
+ /// @param endpoints The number of endpoints.
19
43
error ThresholdTooHigh (uint256 threshold , uint256 endpoints );
20
44
error RetrievedIncorrectRegisteredEndpoints (uint256 retrieved , uint256 registered );
21
45
46
+ // @notice transfer a given amount to a recipient on a given chain.
47
+ // @dev transfers are queued if the outbound limit is hit
48
+ // and must be completed by the client.
49
+ //
50
+ // @param amount The amount to transfer.
51
+ // @param recipientChain The chain to transfer to.
52
+ // @param recipient The recipient address.
53
+ // @param shouldQueue Whether the transfer should be queued if the outbound limit is hit.
54
+ // @param encodedInstructions Additional instructions to be forwarded to the recipient chain.
22
55
function transfer (
23
56
uint256 amount ,
24
57
uint16 recipientChain ,
@@ -31,21 +64,44 @@ interface IManager {
31
64
32
65
function setSibling (uint16 siblingChainId , bytes32 siblingContract ) external ;
33
66
67
+ /// @notice Check if a message has been approved. The message should have at least
68
+ /// the minimum threshold of attestations fron distinct endpoints.
69
+ ///
70
+ /// @param digest The digest of the message.
71
+ /// @return Whether the message has been approved.
34
72
function isMessageApproved (bytes32 digest ) external view returns (bool );
35
73
36
74
function isMessageExecuted (bytes32 digest ) external view returns (bool );
37
75
76
+ /// @notice Complete an outbound trasnfer that's been queued.
77
+ /// @dev This method is called by the client to complete an
78
+ /// outbound transfer that's been queued.
79
+ ///
80
+ /// @param queueSequence The sequence of the message in the queue.
81
+ /// @return msgSequence The sequence of the message.
38
82
function completeOutboundQueuedTransfer (uint64 queueSequence )
39
83
external
40
84
payable
41
85
returns (uint64 msgSequence );
42
86
87
+ // @notice Complete an inbound queued transfer.
88
+ // @param digest The digest of the message to complete.
43
89
function completeInboundQueuedTransfer (bytes32 digest ) external ;
44
90
91
+ // @notice Set the outbound transfer limit for a given chain.
92
+ // @param limit The new limit.
45
93
function setOutboundLimit (uint256 limit ) external ;
46
94
95
+ // @notice Set the inbound transfer limit for a given chain.
96
+ // @param limit The new limit.
97
+ // @param chainId The chain to set the limit for.
47
98
function setInboundLimit (uint256 limit , uint16 chainId ) external ;
48
99
100
+ // @notice Fetch the delivery price for a given recipient chain transfer.
101
+ // @param recipientChain The chain to transfer to.
102
+ // @param endpointInstructions An additional instruction the endpoint can forward to
103
+ // the recipient chain.
104
+ // @return The delivery prices associated with each endpoint.
49
105
function quoteDeliveryPrice (
50
106
uint16 recipientChain ,
51
107
EndpointStructs.EndpointInstruction[] memory endpointInstructions
@@ -55,11 +111,22 @@ interface IManager {
55
111
56
112
function token () external view returns (address );
57
113
114
+ /// @notice Called by an Endpoint contract to deliver a verified attestation.
115
+ /// @dev This function enforces attestation threshold and replay logic for messages.
116
+ /// Once all validations are complete, this function calls _executeMsg to execute
117
+ /// the command specified by the message.
118
+ /// @param sourceChainId The chain id of the sender.
119
+ /// @param sourceManagerAddress The address of the sender's manager contract.
120
+ /// @param payload The VAA payload.
58
121
function attestationReceived (
59
122
uint16 sourceChainId ,
60
123
bytes32 sourceManagerAddress ,
61
124
EndpointStructs.ManagerMessage memory payload
62
125
) external ;
63
126
127
+ /// @notice upgrade to a new manager implementation.
128
+ /// @dev This is upgraded via a proxy.
129
+ ///
130
+ /// @param newImplementation The address of the new implementation.
64
131
function upgrade (address newImplementation ) external ;
65
132
}
0 commit comments