Skip to content

Commit dbd9bdf

Browse files
Rahul MagantiRahul Maganti
Rahul Maganti
authored and
Rahul Maganti
committedFeb 22, 2024
IManager: add natspec for manager interface
1 parent 20e9b5f commit dbd9bdf

File tree

2 files changed

+67
-3
lines changed

2 files changed

+67
-3
lines changed
 

‎evm/src/Manager.sol

-3
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,6 @@ contract Manager is
722722
return _getMessageAttestationsStorage()[digest].attestedEndpoints & uint64(1 << index) == 1;
723723
}
724724

725-
/// @dev Called by an Endpoint contract to deliver a verified attestation.
726-
/// This function enforces attestation threshold and replay logic for messages.
727-
/// Once all validations are complete, this function calls _executeMsg to execute the command specified by the message.
728725
function attestationReceived(
729726
uint16 sourceChainId,
730727
bytes32 sourceManagerAddress,

‎evm/src/interfaces/IManager.sol

+67
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,53 @@ import "../libraries/NormalizedAmount.sol";
55
import "../libraries/EndpointStructs.sol";
66

77
interface IManager {
8+
/// @notice payment for a transfer is too low.
9+
/// @param requiredPayment The required payment.
10+
/// @param providedPayment The provided payment.
811
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.
917
error TransferAmountHasDust(uint256 amount, uint256 dust);
18+
1019
error MessageNotApproved(bytes32 msgHash);
1120
error InvalidTargetChain(uint16 targetChain, uint16 thisChain);
1221
error ZeroAmount();
1322
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.
1426
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.
1531
error InvalidSibling(uint16 chainId, bytes32 siblingAddress);
1632
error InvalidSiblingChainIdZero();
33+
34+
/// @notice Sibling cannot be the zero address.
1735
error InvalidSiblingZeroAddress();
36+
37+
/// @notice The number of thresholds should not be zero.
1838
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.
1943
error ThresholdTooHigh(uint256 threshold, uint256 endpoints);
2044
error RetrievedIncorrectRegisteredEndpoints(uint256 retrieved, uint256 registered);
2145

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.
2255
function transfer(
2356
uint256 amount,
2457
uint16 recipientChain,
@@ -31,21 +64,44 @@ interface IManager {
3164

3265
function setSibling(uint16 siblingChainId, bytes32 siblingContract) external;
3366

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.
3472
function isMessageApproved(bytes32 digest) external view returns (bool);
3573

3674
function isMessageExecuted(bytes32 digest) external view returns (bool);
3775

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.
3882
function completeOutboundQueuedTransfer(uint64 queueSequence)
3983
external
4084
payable
4185
returns (uint64 msgSequence);
4286

87+
// @notice Complete an inbound queued transfer.
88+
// @param digest The digest of the message to complete.
4389
function completeInboundQueuedTransfer(bytes32 digest) external;
4490

91+
// @notice Set the outbound transfer limit for a given chain.
92+
// @param limit The new limit.
4593
function setOutboundLimit(uint256 limit) external;
4694

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.
4798
function setInboundLimit(uint256 limit, uint16 chainId) external;
4899

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.
49105
function quoteDeliveryPrice(
50106
uint16 recipientChain,
51107
EndpointStructs.EndpointInstruction[] memory endpointInstructions
@@ -55,11 +111,22 @@ interface IManager {
55111

56112
function token() external view returns (address);
57113

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.
58121
function attestationReceived(
59122
uint16 sourceChainId,
60123
bytes32 sourceManagerAddress,
61124
EndpointStructs.ManagerMessage memory payload
62125
) external;
63126

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.
64131
function upgrade(address newImplementation) external;
65132
}

0 commit comments

Comments
 (0)