Skip to content

Commit 076f44c

Browse files
committed
Manager -> NttManager
1 parent 0fb4ef5 commit 076f44c

40 files changed

+1029
-975
lines changed

evm/src/Manager.sol evm/src/NttManager.sol

+34-33
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ import "./libraries/external/ReentrancyGuardUpgradeable.sol";
1313
import "./libraries/TransceiverStructs.sol";
1414
import "./libraries/TransceiverHelpers.sol";
1515
import "./libraries/RateLimiter.sol";
16-
import "./interfaces/IManager.sol";
17-
import "./interfaces/IManagerEvents.sol";
16+
import "./interfaces/INttManager.sol";
17+
import "./interfaces/INttManagerEvents.sol";
1818
import "./interfaces/INTTToken.sol";
1919
import "./interfaces/ITransceiver.sol";
2020
import "./TransceiverRegistry.sol";
2121
import "./NttNormalizer.sol";
2222
import "./libraries/PausableOwnable.sol";
2323
import "./libraries/Implementation.sol";
2424

25-
contract Manager is
26-
IManager,
27-
IManagerEvents,
25+
contract NttManager is
26+
INttManager,
27+
INttManagerEvents,
2828
TransceiverRegistry,
2929
RateLimiter,
3030
NttNormalizer,
@@ -36,9 +36,9 @@ contract Manager is
3636
using SafeERC20 for IERC20;
3737

3838
error RefundFailed(uint256 refundAmount);
39-
error CannotRenounceManagerOwnership(address owner);
39+
error CannotRenounceNttManagerOwnership(address owner);
4040
error UnexpectedOwner(address expectedOwner, address owner);
41-
error TransceiverAlreadyAttestedToMessage(bytes32 managerMessageHash);
41+
error TransceiverAlreadyAttestedToMessage(bytes32 nttManagerMessageHash);
4242

4343
address public immutable token;
4444
address immutable deployer;
@@ -188,7 +188,7 @@ contract Manager is
188188
deployer = msg.sender;
189189
}
190190

191-
function __Manager_init() internal onlyInitializing {
191+
function __NttManager_init() internal onlyInitializing {
192192
// check if the owner is the deployer of this contract
193193
if (msg.sender != deployer) {
194194
revert UnexpectedOwner(deployer, msg.sender);
@@ -198,7 +198,7 @@ contract Manager is
198198
}
199199

200200
function _initialize() internal virtual override {
201-
__Manager_init();
201+
__NttManager_init();
202202
_checkThresholdInvariants();
203203
_checkTransceiversInvariants();
204204
}
@@ -213,7 +213,7 @@ contract Manager is
213213
_upgrade(newImplementation);
214214
}
215215

216-
/// @dev Transfer ownership of the Manager contract and all Transceiver contracts to a new owner.
216+
/// @dev Transfer ownership of the NttManager contract and all Transceiver contracts to a new owner.
217217
function transferOwnership(address newOwner) public override onlyOwner {
218218
super.transferOwnership(newOwner);
219219
// loop through all the registered transceivers and set the new owner of each transceiver to the newOwner
@@ -253,18 +253,18 @@ contract Manager is
253253
uint256[] memory priceQuotes,
254254
TransceiverStructs.TransceiverInstruction[] memory transceiverInstructions,
255255
address[] memory enabledTransceivers,
256-
bytes memory managerMessage
256+
bytes memory nttManagerMessage
257257
) internal {
258258
uint256 numEnabledTransceivers = enabledTransceivers.length;
259259
mapping(address => TransceiverInfo) storage transceiverInfos = _getTransceiverInfosStorage();
260260
// call into transceiver contracts to send the message
261261
for (uint256 i = 0; i < numEnabledTransceivers; i++) {
262262
address transceiverAddr = enabledTransceivers[i];
263-
// send it to the recipient manager based on the chain
263+
// send it to the recipient nttManager based on the chain
264264
ITransceiver(transceiverAddr).sendMessage{value: priceQuotes[i]}(
265265
recipientChain,
266266
transceiverInstructions[transceiverInfos[transceiverAddr].index],
267-
managerMessage,
267+
nttManagerMessage,
268268
getSibling(recipientChain)
269269
);
270270
}
@@ -554,16 +554,16 @@ contract Manager is
554554
amount, toWormholeFormat(token), recipient, recipientChain
555555
);
556556

557-
// construct the ManagerMessage payload
558-
bytes memory encodedManagerPayload = TransceiverStructs.encodeManagerMessage(
559-
TransceiverStructs.ManagerMessage(
557+
// construct the NttManagerMessage payload
558+
bytes memory encodedNttManagerPayload = TransceiverStructs.encodeNttManagerMessage(
559+
TransceiverStructs.NttManagerMessage(
560560
seq, toWormholeFormat(sender), TransceiverStructs.encodeNativeTokenTransfer(ntt)
561561
)
562562
);
563563

564564
// send the message
565565
_sendMessageToTransceivers(
566-
recipientChain, priceQuotes, instructions, enabledTransceivers, encodedManagerPayload
566+
recipientChain, priceQuotes, instructions, enabledTransceivers, encodedNttManagerPayload
567567
);
568568

569569
emit TransferSent(recipient, _nttDenormalize(amount), recipientChain, seq);
@@ -594,16 +594,16 @@ contract Manager is
594594
}
595595

596596
/// @dev Called after a message has been sufficiently verified to execute the command in the message.
597-
/// This function will decode the payload as an ManagerMessage to extract the sequence, msgType, and other parameters.
597+
/// This function will decode the payload as an NttManagerMessage to extract the sequence, msgType, and other parameters.
598598
function executeMsg(
599599
uint16 sourceChainId,
600-
bytes32 sourceManagerAddress,
601-
TransceiverStructs.ManagerMessage memory message
600+
bytes32 sourceNttManagerAddress,
601+
TransceiverStructs.NttManagerMessage memory message
602602
) public {
603603
// verify chain has not forked
604604
checkFork(evmChainId);
605605

606-
bytes32 digest = TransceiverStructs.managerMessageDigest(sourceChainId, message);
606+
bytes32 digest = TransceiverStructs.nttManagerMessageDigest(sourceChainId, message);
607607

608608
if (!isMessageApproved(digest)) {
609609
revert MessageNotApproved(digest);
@@ -614,7 +614,7 @@ contract Manager is
614614
// end execution early to mitigate the possibility of race conditions from transceivers
615615
// attempting to deliver the same message when (threshold < number of transceiver messages)
616616
// notify client (off-chain process) so they don't attempt redundant msg delivery
617-
emit MessageAlreadyExecuted(sourceManagerAddress, digest);
617+
emit MessageAlreadyExecuted(sourceNttManagerAddress, digest);
618618
return;
619619
}
620620

@@ -719,7 +719,7 @@ contract Manager is
719719
}
720720

721721
/// @notice this sets the corresponding sibling.
722-
/// @dev The manager that executes the message sets the source manager as the sibling.
722+
/// @dev The nttManager that executes the message sets the source nttManager as the sibling.
723723
function setSibling(uint16 siblingChainId, bytes32 siblingContract) public onlyOwner {
724724
if (siblingChainId == 0) {
725725
revert InvalidSiblingChainIdZero();
@@ -742,28 +742,29 @@ contract Manager is
742742

743743
function attestationReceived(
744744
uint16 sourceChainId,
745-
bytes32 sourceManagerAddress,
746-
TransceiverStructs.ManagerMessage memory payload
745+
bytes32 sourceNttManagerAddress,
746+
TransceiverStructs.NttManagerMessage memory payload
747747
) external onlyTransceiver {
748-
_verifySibling(sourceChainId, sourceManagerAddress);
748+
_verifySibling(sourceChainId, sourceNttManagerAddress);
749749

750-
bytes32 managerMessageHash = TransceiverStructs.managerMessageDigest(sourceChainId, payload);
750+
bytes32 nttManagerMessageHash =
751+
TransceiverStructs.nttManagerMessageDigest(sourceChainId, payload);
751752

752753
// set the attested flag for this transceiver.
753754
// NOTE: Attestation is idempotent (bitwise or 1), but we revert
754755
// anyway to ensure that the client does not continue to initiate calls
755756
// to receive the same message through the same transceiver.
756757
if (
757758
transceiverAttestedToMessage(
758-
managerMessageHash, _getTransceiverInfosStorage()[msg.sender].index
759+
nttManagerMessageHash, _getTransceiverInfosStorage()[msg.sender].index
759760
)
760761
) {
761-
revert TransceiverAlreadyAttestedToMessage(managerMessageHash);
762+
revert TransceiverAlreadyAttestedToMessage(nttManagerMessageHash);
762763
}
763-
_setTransceiverAttestedToMessage(managerMessageHash, msg.sender);
764+
_setTransceiverAttestedToMessage(nttManagerMessageHash, msg.sender);
764765

765-
if (isMessageApproved(managerMessageHash)) {
766-
executeMsg(sourceChainId, sourceManagerAddress, payload);
766+
if (isMessageApproved(nttManagerMessageHash)) {
767+
executeMsg(sourceChainId, sourceNttManagerAddress, payload);
767768
}
768769
}
769770

@@ -772,7 +773,7 @@ contract Manager is
772773
return countSetBits(_getMessageAttestations(digest));
773774
}
774775

775-
function tokenDecimals() public view override(IManager, RateLimiter) returns (uint8) {
776+
function tokenDecimals() public view override(INttManager, RateLimiter) returns (uint8) {
776777
return tokenDecimals_;
777778
}
778779

evm/src/Transceiver.sol

+40-40
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pragma solidity >=0.8.8 <0.9.0;
33

44
import "./libraries/TransceiverStructs.sol";
55
import "./libraries/PausableOwnable.sol";
6-
import "./interfaces/IManager.sol";
6+
import "./interfaces/INttManager.sol";
77
import "./interfaces/ITransceiver.sol";
88
import "./libraries/external/ReentrancyGuardUpgradeable.sol";
99
import "./libraries/Implementation.sol";
@@ -15,21 +15,21 @@ abstract contract Transceiver is
1515
ReentrancyGuardUpgradeable,
1616
Implementation
1717
{
18-
/// @dev updating bridgeManager requires a new Transceiver deployment.
18+
/// @dev updating bridgeNttManager requires a new Transceiver deployment.
1919
/// Projects should implement their own governance to remove the old Transceiver contract address and then add the new one.
20-
address public immutable manager;
21-
address public immutable managerToken;
20+
address public immutable nttManager;
21+
address public immutable nttManagerToken;
2222

23-
constructor(address _manager) {
24-
manager = _manager;
25-
managerToken = IManager(manager).token();
23+
constructor(address _nttManager) {
24+
nttManager = _nttManager;
25+
nttManagerToken = INttManager(nttManager).token();
2626
}
2727

2828
/// =============== MODIFIERS ===============================================
2929

30-
modifier onlyManager() {
31-
if (msg.sender != manager) {
32-
revert CallerNotManager(msg.sender);
30+
modifier onlyNttManager() {
31+
if (msg.sender != nttManager) {
32+
revert CallerNotNttManager(msg.sender);
3333
}
3434
_;
3535
}
@@ -38,13 +38,13 @@ abstract contract Transceiver is
3838

3939
function _initialize() internal virtual override {
4040
__ReentrancyGuard_init();
41-
// owner of the transceiver is set to the owner of the manager
42-
__PausedOwnable_init(msg.sender, getManagerOwner());
41+
// owner of the transceiver is set to the owner of the nttManager
42+
__PausedOwnable_init(msg.sender, getNttManagerOwner());
4343
}
4444

4545
/// @dev transfer the ownership of the transceiver to a new address
46-
/// the manager should be able to update transceiver ownership.
47-
function transferTransceiverOwnership(address newOwner) external onlyManager {
46+
/// the nttManager should be able to update transceiver ownership.
47+
function transferTransceiverOwnership(address newOwner) external onlyNttManager {
4848
_transferOwnership(newOwner);
4949
}
5050

@@ -59,21 +59,21 @@ abstract contract Transceiver is
5959

6060
function _migrate() internal virtual override {}
6161

62-
/// @dev This method checks that the the referecnes to the manager and its corresponding function are correct
62+
/// @dev This method checks that the the referecnes to the nttManager and its corresponding function are correct
6363
/// When new immutable variables are added, this function should be updated.
6464
function _checkImmutables() internal view override {
65-
assert(this.manager() == manager);
66-
assert(this.managerToken() == managerToken);
65+
assert(this.nttManager() == nttManager);
66+
assert(this.nttManagerToken() == nttManagerToken);
6767
}
6868

6969
/// =============== GETTERS & SETTERS ===============================================
7070

71-
function getManagerOwner() public view returns (address) {
72-
return IOwnableUpgradeable(manager).owner();
71+
function getNttManagerOwner() public view returns (address) {
72+
return IOwnableUpgradeable(nttManager).owner();
7373
}
7474

75-
function getManagerToken() public view virtual returns (address) {
76-
return managerToken;
75+
function getNttManagerToken() public view virtual returns (address) {
76+
return nttManagerToken;
7777
}
7878

7979
/// =============== TRANSCEIVING LOGIC ===============================================
@@ -82,50 +82,50 @@ abstract contract Transceiver is
8282
* @param recipientChain The chain id of the recipient.
8383
* @param instruction An additional Instruction provided by the Transceiver to be
8484
* executed on the recipient chain.
85-
* @param managerMessage A message to be sent to the manager on the recipient chain.
85+
* @param nttManagerMessage A message to be sent to the nttManager on the recipient chain.
8686
*/
8787
function sendMessage(
8888
uint16 recipientChain,
8989
TransceiverStructs.TransceiverInstruction memory instruction,
90-
bytes memory managerMessage,
91-
bytes32 recipientManagerAddress
92-
) external payable nonReentrant onlyManager {
90+
bytes memory nttManagerMessage,
91+
bytes32 recipientNttManagerAddress
92+
) external payable nonReentrant onlyNttManager {
9393
_sendMessage(
9494
recipientChain,
9595
msg.value,
9696
msg.sender,
97-
recipientManagerAddress,
97+
recipientNttManagerAddress,
9898
instruction,
99-
managerMessage
99+
nttManagerMessage
100100
);
101101
}
102102

103103
function _sendMessage(
104104
uint16 recipientChain,
105105
uint256 deliveryPayment,
106106
address caller,
107-
bytes32 recipientManagerAddress,
107+
bytes32 recipientNttManagerAddress,
108108
TransceiverStructs.TransceiverInstruction memory transceiverInstruction,
109-
bytes memory managerMessage
109+
bytes memory nttManagerMessage
110110
) internal virtual;
111111

112-
// @dev This method is called by the BridgeManager contract to send a cross-chain message.
113-
// Forwards the VAA payload to the transceiver manager contract.
112+
// @dev This method is called by the BridgeNttManager contract to send a cross-chain message.
113+
// Forwards the VAA payload to the transceiver nttManager contract.
114114
// @param sourceChainId The chain id of the sender.
115-
// @param sourceManagerAddress The address of the sender's manager contract.
115+
// @param sourceNttManagerAddress The address of the sender's nttManager contract.
116116
// @param payload The VAA payload.
117-
function _deliverToManager(
117+
function _deliverToNttManager(
118118
uint16 sourceChainId,
119-
bytes32 sourceManagerAddress,
120-
bytes32 recipientManagerAddress,
121-
TransceiverStructs.ManagerMessage memory payload
119+
bytes32 sourceNttManagerAddress,
120+
bytes32 recipientNttManagerAddress,
121+
TransceiverStructs.NttManagerMessage memory payload
122122
) internal virtual {
123-
if (recipientManagerAddress != toWormholeFormat(manager)) {
124-
revert UnexpectedRecipientManagerAddress(
125-
toWormholeFormat(manager), recipientManagerAddress
123+
if (recipientNttManagerAddress != toWormholeFormat(nttManager)) {
124+
revert UnexpectedRecipientNttManagerAddress(
125+
toWormholeFormat(nttManager), recipientNttManagerAddress
126126
);
127127
}
128-
IManager(manager).attestationReceived(sourceChainId, sourceManagerAddress, payload);
128+
INttManager(nttManager).attestationReceived(sourceChainId, sourceNttManagerAddress, payload);
129129
}
130130

131131
function quoteDeliveryPrice(

evm/src/TransceiverRegistry.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ abstract contract TransceiverRegistry {
215215

216216
/// ============== INVARIANTS =============================================
217217

218-
/// @dev Check that the transceiver manager is in a valid state.
218+
/// @dev Check that the transceiver nttManager is in a valid state.
219219
/// Checking these invariants is somewhat costly, but we only need to do it
220220
/// when modifying the transceivers, which happens infrequently.
221221
function _checkTransceiversInvariants() internal view {

0 commit comments

Comments
 (0)