Skip to content

Commit

Permalink
feat: add remote chain check in setRemoteSmartMToken
Browse files Browse the repository at this point in the history
  • Loading branch information
0xIryna committed Dec 2, 2024
1 parent 73d72bb commit 9176d84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Portal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ abstract contract Portal is NttManagerNoRateLimiting, IPortal {

/// @inheritdoc IPortal
function setRemoteSmartMToken(uint16 remoteChainId_, bytes32 smartMToken_) external onlyOwner {
if (remoteChainId_ == chainId) revert InvalidRemoteChain(remoteChainId_);

remoteSmartMToken[remoteChainId_] = smartMToken_;
emit RemoteSmartMTokenSet(remoteChainId_, smartMToken_);
}
Expand Down
4 changes: 4 additions & 0 deletions src/interfaces/IPortal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ interface IPortal {
/// isn't equal to EVM chainId set in the constructor.
error InvalidFork(uint256 evmChainId, uint256 blockChainId);

/// @notice Emitted in `setRemoteSmartMToken` when the remote chain id
/// is equal to the local one.
error InvalidRemoteChain(uint16 remoteChainId);

/* ============ View/Pure Functions ============ */

/// @notice The current index of the Portal's earning mechanism.
Expand Down

0 comments on commit 9176d84

Please sign in to comment.