Skip to content

Commit 2a0fd86

Browse files
committed
evm: Make initialiser payable to allow WH transceiver registration
1 parent 080c909 commit 2a0fd86

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

evm/src/NttManager/NttManager.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
5858
if (msg.sender != deployer) {
5959
revert UnexpectedDeployer(deployer, msg.sender);
6060
}
61+
if (msg.value != 0) {
62+
revert UnexpectedMsgValue();
63+
}
6164
__PausedOwnable_init(msg.sender, msg.sender);
6265
__ReentrancyGuard_init();
6366
_setOutboundLimit(TrimmedAmountLib.max(tokenDecimals()));

evm/src/Transceiver/WormholeTransceiver/WormholeTransceiverState.sol

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ abstract contract WormholeTransceiverState is IWormholeTransceiverState, Transce
8080
tokenAddress: toWormholeFormat(nttManagerToken),
8181
tokenDecimals: INttManager(nttManager).tokenDecimals()
8282
});
83-
wormhole.publishMessage(0, TransceiverStructs.encodeTransceiverInit(init), consistencyLevel);
83+
wormhole.publishMessage{value: msg.value}(
84+
0, TransceiverStructs.encodeTransceiverInit(init), consistencyLevel
85+
);
8486
}
8587

8688
function _checkImmutables() internal view override {
@@ -195,7 +197,7 @@ abstract contract WormholeTransceiverState is IWormholeTransceiverState, Transce
195197
// =============== Admin ===============================================================
196198

197199
/// @inheritdoc IWormholeTransceiverState
198-
function setWormholePeer(uint16 peerChainId, bytes32 peerContract) external onlyOwner {
200+
function setWormholePeer(uint16 peerChainId, bytes32 peerContract) external payable onlyOwner {
199201
if (peerChainId == 0) {
200202
revert InvalidWormholeChainIdZero();
201203
}
@@ -221,7 +223,7 @@ abstract contract WormholeTransceiverState is IWormholeTransceiverState, Transce
221223
transceiverChainId: peerChainId,
222224
transceiverAddress: peerContract
223225
});
224-
wormhole.publishMessage(
226+
wormhole.publishMessage{value: msg.value}(
225227
0, TransceiverStructs.encodeTransceiverRegistration(registration), consistencyLevel
226228
);
227229

evm/src/interfaces/INttManager.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ interface INttManager is IManagerBase {
123123
/// @param sender The original sender that initiated the transfer that was queued.
124124
error CancellerNotSender(address canceller, address sender);
125125

126+
/// @notice An unexpected msg.value was passed with the call
127+
/// @dev Selector 0xbd28e889.
128+
error UnexpectedMsgValue();
129+
126130
/// @notice Transfer a given amount to a recipient on a given chain. This function is called
127131
/// by the user to send the token cross-chain. This function will either lock or burn the
128132
/// sender's tokens. Finally, this function will call into registered `Endpoint` contracts

evm/src/interfaces/IWormholeTransceiverState.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ interface IWormholeTransceiverState {
9494
/// @dev This function is only callable by the `owner`.
9595
/// @param chainId The Wormhole chain ID of the peer to set.
9696
/// @param peerContract The address of the peer contract on the given chain.
97-
function setWormholePeer(uint16 chainId, bytes32 peerContract) external;
97+
function setWormholePeer(uint16 chainId, bytes32 peerContract) external payable;
9898

9999
/// @notice Set whether the chain is EVM compatible.
100100
/// @dev This function is only callable by the `owner`.

evm/src/libraries/Implementation.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ abstract contract Implementation is Initializable, ERC1967Upgrade {
5858
}
5959
}
6060

61-
function initialize() external onlyDelegateCall initializer {
61+
function initialize() external payable onlyDelegateCall initializer {
6262
_initialize();
6363
}
6464

0 commit comments

Comments
 (0)