Skip to content

Commit

Permalink
feat: constrain hyperlane destination id
Browse files Browse the repository at this point in the history
  • Loading branch information
junkim012 committed Oct 23, 2024
1 parent 770c52e commit 30390af
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/helper/WarpRouteWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@ interface WarpRoute {
contract WarpRouteWrapper {
using SafeTransferLib for ERC20;

error InvalidDestination();

BoringVault public boringVault;
TellerWithMultiAssetSupport public teller;
WarpRoute public warpRoute;
uint32 public destination;

constructor(TellerWithMultiAssetSupport _teller, WarpRoute _warpRoute) {
constructor(TellerWithMultiAssetSupport _teller, WarpRoute _warpRoute, uint32 _destination) {
teller = _teller;
warpRoute = _warpRoute;
destination = _destination;

boringVault = _teller.vault();

// Infinite approvals to the warpRoute okay because this contract will
Expand All @@ -52,6 +57,8 @@ contract WarpRouteWrapper {
external
returns (uint256 sharesMinted, bytes32 messageId)
{
if (_destination != destination) revert InvalidDestination();

depositAsset.safeTransferFrom(msg.sender, address(this), depositAmount);

if (depositAsset.allowance(address(this), address(boringVault)) < depositAmount) {
Expand Down

0 comments on commit 30390af

Please sign in to comment.