Skip to content

Commit dd86484

Browse files
Rahul MagantiRahul Maganti
Rahul Maganti
authored and
Rahul Maganti
committed
add natspec to transceiver
1 parent 7c01427 commit dd86484

File tree

2 files changed

+45
-13
lines changed

2 files changed

+45
-13
lines changed

evm/src/Endpoint.sol

+11-12
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,12 @@ abstract contract Endpoint is
7777
}
7878

7979
/// =============== TRANSCEIVING LOGIC ===============================================
80-
/**
81-
* @dev send a message to another chain.
82-
* @param recipientChain The chain id of the recipient.
83-
* @param instruction An additional Instruction provided by the Endpoint to be
84-
* executed on the recipient chain.
85-
* @param managerMessage A message to be sent to the manager on the recipient chain.
86-
*/
80+
81+
/// @dev send a message to another chain.
82+
/// @param recipientChain The chain id of the recipient.
83+
/// @param instruction An additional Instruction provided by the Endpoint to be
84+
/// executed on the recipient chain.
85+
/// @param managerMessage A message to be sent to the manager on the recipient chain.
8786
function sendMessage(
8887
uint16 recipientChain,
8988
EndpointStructs.EndpointInstruction memory instruction,
@@ -109,11 +108,11 @@ abstract contract Endpoint is
109108
bytes memory managerMessage
110109
) internal virtual;
111110

112-
// @dev This method is called by the BridgeManager contract to send a cross-chain message.
113-
// Forwards the VAA payload to the endpoint manager contract.
114-
// @param sourceChainId The chain id of the sender.
115-
// @param sourceManagerAddress The address of the sender's manager contract.
116-
// @param payload The VAA payload.
111+
/// @dev This method is called by the BridgeManager contract to send a cross-chain message.
112+
/// Forwards the VAA payload to the endpoint manager contract.
113+
/// @param sourceChainId The chain id of the sender.
114+
/// @param sourceManagerAddress The address of the sender's manager contract.
115+
/// @param payload The VAA payload.
117116
function _deliverToManager(
118117
uint16 sourceChainId,
119118
bytes32 sourceManagerAddress,

evm/src/interfaces/IEndpoint.sol

+34-1
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,59 @@ pragma solidity >=0.8.8 <0.9.0;
44
import "../libraries/EndpointStructs.sol";
55

66
interface IEndpoint {
7+
/// @notice Error code for when the caller is not the manager.
8+
/// @dev Selector 0x3b2495f1.
9+
/// @param caller The caller's address.
710
error CallerNotManager(address caller);
8-
error CannotRenounceEndpointOwnership(address currentOwner);
11+
12+
/// @notice Error code when ownership of the endpoint cannot be transferred.
13+
/// @dev Selector 0x7ab04e14.
14+
/// @param currentOwner The current owner of the endpoint and the maaager.
15+
/// @param newOwner The updated owner of the endpoint and the manager.
916
error CannotTransferEndpointOwnership(address currentOwner, address newOwner);
17+
18+
/// @notice Error code emitted when the recipient manager address for the transfer
19+
/// does not match the manager address encoded in the paylood sent over the wire.
20+
/// @dev Selector 0x3a680c9a.
21+
/// @param recipientManagerAddress The provided recipientManagerAddress
22+
/// at the time of delivery.
23+
/// @param expectedRecipientManagerAddress The recipient manager address encoded
24+
/// in the payload sent over the wire.
1025
error UnexpectedRecipientManagerAddress(
1126
bytes32 recipientManagerAddress, bytes32 expectedRecipientManagerAddress
1227
);
1328

29+
/// @notice Method to provide a quote for the delivery price.
30+
/// @dev This method is called by the manager to get a quote for the delivery price.
31+
/// @param recipientChain The chain id of the recipient.
32+
/// @param instruction An additional Instruction provided by the Endpoint.
33+
/// @return The price of the delivery.
1434
function quoteDeliveryPrice(
1535
uint16 recipientChain,
1636
EndpointStructs.EndpointInstruction memory instruction
1737
) external view returns (uint256);
1838

39+
/// @notice Send a message to the recipient chain.
40+
/// @dev This method is called by the manager to send a message to the recipient chain.
41+
/// @param recipientChain The chain id of the recipient.
42+
/// @param instruction An additional Instruction provided by the Endpoint.
43+
/// @param managerMessage A message to be sent to the manager on the recipient chain.
44+
/// @param recipientManagerAddress The address of the recipient manager.
1945
function sendMessage(
2046
uint16 recipientChain,
2147
EndpointStructs.EndpointInstruction memory instruction,
2248
bytes memory managerMessage,
2349
bytes32 recipientManagerAddress
2450
) external payable;
2551

52+
/// @notice upgrade the endpoint to a new implementation.
53+
/// @dev This is upgraded via a proxy.
54+
/// @param newImplementation The address of the new implementation.
2655
function upgrade(address newImplementation) external;
2756

57+
/// @notice transfer the ownership of the endpoint to a new address
58+
/// @dev The manager should be able to update endpoint ownership.
59+
/// The owner of the manager should be the same as the owner of the endpoint.
60+
/// @param newOwner The address of the new owner.
2861
function transferEndpointOwnership(address newOwner) external;
2962
}

0 commit comments

Comments
 (0)