@@ -7,16 +7,22 @@ import "../libraries/TransceiverStructs.sol";
7
7
import "./INttManagerState.sol " ;
8
8
9
9
interface INttManager is INttManagerState {
10
+ /// @notice The mode is either LOCKING or BURNING. In LOCKING mode, the NttManager locks the
11
+ /// tokens of the sender and mints an equivalent amount on the target chain. In BURNING
12
+ /// mode, the NttManager burns the tokens of the sender and mints an equivalent amount
13
+ /// on the target chain.LOCKING mode preserves the total supply of the tokens.
10
14
enum Mode {
11
15
LOCKING,
12
16
BURNING
13
17
}
14
18
15
- // @dev Information about attestations for a given message.
19
+ /// @notice Information about attestations for a given message.
20
+ /// @dev The fields are as follows:
21
+ /// - executed: whether the message has been executed.
22
+ /// - attested: bitmap of transceivers that have attested to this message.
23
+ /// (NOTE: might contain disabled transceivers)
16
24
struct AttestationInfo {
17
- // whether this message has been executed
18
25
bool executed;
19
- // bitmap of transceivers that have attested to this message (NOTE: might contain disabled transceivers)
20
26
uint64 attestedTransceivers;
21
27
}
22
28
@@ -34,27 +40,56 @@ interface INttManager is INttManagerState {
34
40
error DeliveryPaymentTooLow (uint256 requiredPayment , uint256 providedPayment );
35
41
36
42
//// @notice The transfer has some dust.
37
- //// @dev This is a security measure to prevent users from losing funds.
38
- //// This is the result of trimming the amount and then untrimming it.
43
+ //// @dev This is a security measure to prevent users from losing funds.
44
+ //// This is the result of trimming the amount and then untrimming it.
39
45
//// @param amount The amount to transfer.
40
46
error TransferAmountHasDust (uint256 amount , uint256 dust );
41
47
42
48
/// @notice The mode is invalid. It is neither in LOCKING or BURNING mode.
43
49
/// @param mode The mode.
44
50
error InvalidMode (uint8 mode );
45
51
52
+ /// @notice Error when the refund to the sender fails.
53
+ /// @dev Selector 0x2ca23714.
54
+ /// @param refundAmount The refund amount.
46
55
error RefundFailed (uint256 refundAmount );
56
+
57
+ /// @notice Error when the tranceiver already attested to the message.
58
+ /// To ensure the client does not continue to initiate calls to the attestationReceived function.
59
+ /// @dev Selector 0x2113894.
60
+ /// @param nttManagerMessageHash The hash of the message.
47
61
error TransceiverAlreadyAttestedToMessage (bytes32 nttManagerMessageHash );
62
+
63
+ /// @notice Error when the message is not approved.
64
+ /// @dev Selector 0x451c4fb0.
65
+ /// @param msgHash The hash of the message.
48
66
error MessageNotApproved (bytes32 msgHash );
67
+
68
+ /// @notice Error when trying to execute a message on an unintended target chain.
69
+ /// @dev Selector 0x3dcb204a.
70
+ /// @param targetChain The target chain.
71
+ /// @param thisChain The current chain.
49
72
error InvalidTargetChain (uint16 targetChain , uint16 thisChain );
73
+
74
+ /// @notice Error when the transfer amount is zero.
75
+ /// @dev Selector 0x9993626a.
50
76
error ZeroAmount ();
77
+
78
+ /// @notice Error when the recipient is invalid.
79
+ /// @dev Selector 0x9c8d2cd2.
51
80
error InvalidRecipient ();
81
+
82
+ /// @notice Error when the amount burned is different than the balance difference,
83
+ /// since NTT does not support burn fees.
84
+ /// @dev Selector 0x02156a8f.
85
+ /// @param burnAmount The amount burned.
86
+ /// @param balanceDiff The balance after burning.
52
87
error BurnAmountDifferentThanBalanceDiff (uint256 burnAmount , uint256 balanceDiff );
53
88
54
89
/// @notice Transfer a given amount to a recipient on a given chain. This function is called
55
- /// by the user to send the token cross-chain. This function will either lock or burn the
56
- /// sender's tokens. Finally, this function will call into registered `Endpoint` contracts
57
- /// to send a message with the incrementing sequence number and the token transfer payload.
90
+ /// by the user to send the token cross-chain. This function will either lock or burn the
91
+ /// sender's tokens. Finally, this function will call into registered `Endpoint` contracts
92
+ /// to send a message with the incrementing sequence number and the token transfer payload.
58
93
/// @param amount The amount to transfer.
59
94
/// @param recipientChain The chain ID for the destination.
60
95
/// @param recipient The recipient address.
@@ -65,9 +100,9 @@ interface INttManager is INttManagerState {
65
100
) external payable returns (uint64 msgId );
66
101
67
102
/// @notice Transfer a given amount to a recipient on a given chain. This function is called
68
- /// by the user to send the token cross-chain. This function will either lock or burn the
69
- /// sender's tokens. Finally, this function will call into registered `Endpoint` contracts
70
- /// to send a message with the incrementing sequence number and the token transfer payload.
103
+ /// by the user to send the token cross-chain. This function will either lock or burn the
104
+ /// sender's tokens. Finally, this function will call into registered `Endpoint` contracts
105
+ /// to send a message with the incrementing sequence number and the token transfer payload.
71
106
/// @dev Transfers are queued if the outbound limit is hit and must be completed by the client.
72
107
/// @param amount The amount to transfer.
73
108
/// @param recipientChain The chain ID for the destination.
@@ -106,8 +141,8 @@ interface INttManager is INttManagerState {
106
141
107
142
/// @notice Called by an Endpoint contract to deliver a verified attestation.
108
143
/// @dev This function enforces attestation threshold and replay logic for messages. Once all
109
- /// validations are complete, this function calls `executeMsg` to execute the command specified
110
- /// by the message.
144
+ /// validations are complete, this function calls `executeMsg` to execute the command specified
145
+ /// by the message.
111
146
/// @param sourceChainId The chain id of the sender.
112
147
/// @param sourceNttManagerAddress The address of the sender's nttManager contract.
113
148
/// @param payload The VAA payload.
@@ -117,11 +152,11 @@ interface INttManager is INttManagerState {
117
152
TransceiverStructs.NttManagerMessage memory payload
118
153
) external ;
119
154
120
- /// @notice Called after a message has been sufficiently verified to execute the command in the message.
121
- /// This function will decode the payload as an NttManagerMessage to extract the sequence, msgType,
122
- /// and other parameters.
155
+ /// @notice Called after a message has been sufficiently verified to execute
156
+ /// the command in the message. This function will decode the payload
157
+ /// as an NttManagerMessage to extract the sequence, msgType, and other parameters.
123
158
/// @dev This function is exposed as a fallback for when an `Transceiver` is deregistered
124
- /// when a message is in flight.
159
+ /// when a message is in flight.
125
160
/// @param sourceChainId The chain id of the sender.
126
161
/// @param sourceNttManagerAddress The address of the sender's nttManager contract.
127
162
/// @param message The message to execute.
0 commit comments