From 11743db886d219ae0ec3c686e0ad7de49e64b100 Mon Sep 17 00:00:00 2001 From: Sujith Somraaj <35634175+sujithsomraaj@users.noreply.github.com> Date: Wed, 22 May 2024 20:57:35 +0530 Subject: [PATCH] chore: add support for token bridge attestation (#37) * chore: add support for token bridge attestation * chore: fix snapshot --- .gas-snapshot | 8 ++++---- src/wormhole/specialized-relayer/WormholeHelper.sol | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 43980fd..00e33fb 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -30,7 +30,7 @@ WormholeAutomaticRelayerHelperTest:testFancyWormhole() (gas: 223380) WormholeAutomaticRelayerHelperTest:testMultiDstWormhole() (gas: 344783) WormholeAutomaticRelayerHelperTest:testMultiDstWormholeWithAdditionalVAA() (gas: 374508) WormholeAutomaticRelayerHelperTest:testSimpleWormhole() (gas: 176992) -WormholeSpecializedRelayerHelperTest:testCustomOrderingWormhole() (gas: 598833) -WormholeSpecializedRelayerHelperTest:testFancyWormhole() (gas: 332004) -WormholeSpecializedRelayerHelperTest:testMultiDstWormhole() (gas: 635118) -WormholeSpecializedRelayerHelperTest:testSimpleWormhole() (gas: 334796) \ No newline at end of file +WormholeSpecializedRelayerHelperTest:testCustomOrderingWormhole() (gas: 598867) +WormholeSpecializedRelayerHelperTest:testFancyWormhole() (gas: 332021) +WormholeSpecializedRelayerHelperTest:testMultiDstWormhole() (gas: 635152) +WormholeSpecializedRelayerHelperTest:testSimpleWormhole() (gas: 334813) \ No newline at end of file diff --git a/src/wormhole/specialized-relayer/WormholeHelper.sol b/src/wormhole/specialized-relayer/WormholeHelper.sol index e23a6c0..9b6a9d8 100644 --- a/src/wormhole/specialized-relayer/WormholeHelper.sol +++ b/src/wormhole/specialized-relayer/WormholeHelper.sol @@ -10,6 +10,7 @@ import {TypeCasts} from "../../libraries/TypeCasts.sol"; interface IWormholeReceiver { function receiveMessage(bytes memory encodedMessage) external; + function createWrapped(bytes memory encodedVm) external returns (address token); } /// @title WormholeHelper @@ -168,7 +169,11 @@ contract WormholeHelper is Test { ); /// @dev delivers the message by passing the new guardian set to receiver - IWormholeReceiver(dstTarget).receiveMessage(encodedVAA); + try IWormholeReceiver(dstTarget).receiveMessage(encodedVAA) {} + catch { + /// TODO: implement enum for delivery types to support nft and token bridges + IWormholeReceiver(dstTarget).createWrapped(encodedVAA); + } } }