From e2e82c524f978769e7368c07c64c89c421172858 Mon Sep 17 00:00:00 2001 From: Guido De Vita Date: Thu, 12 Mar 2026 18:43:25 +0000 Subject: [PATCH 1/2] feat(evm): upgrade wormhole-solidity-sdk to v1.1.0 with gas optimizations Migrate from wormhole-solidity-sdk v0.1.0 to v1.1.0. Replace parseAndVerifyVM with client-side CoreBridgeLib.decodeAndVerifyVaaCd, switch receiveMessage to calldata, use VaaLib.calcVaaDoubleHashCd for replay protection, inline nttManagerMessageDigest, add constant-time countSetBits popcount, cache transceiver index in attestation, and replace ConfigMakers with SDK's CustomConsistencyLib. receiveMessage gas: avg -21.6%, median -18.1%, max -12.0%. Deployment size: -14.1%. Bump NttManager and WormholeTransceiver to v2.1.0 with TS SDK bindings. --- evm/echidna/FuzzNttManager.sol | 2 +- evm/foundry.lock | 2 +- evm/foundry.toml | 4 +- evm/lib/wormhole-solidity-sdk | 2 +- evm/remappings.txt | 2 + evm/script/DeployWormholeNtt.s.sol | 7 +- evm/script/helpers/DeployWormholeNttBase.sol | 4 +- evm/script/helpers/ParseNttConfig.sol | 19 +- evm/src/NttManager/ManagerBase.sol | 27 +- evm/src/NttManager/NttManager.sol | 12 +- evm/src/Transceiver/Transceiver.sol | 6 +- .../WormholeTransceiver.sol | 73 +- .../WormholeTransceiverState.sol | 22 +- evm/src/interfaces/IWormholeTransceiver.sol | 2 +- evm/src/libraries/ConfigMakers.sol | 4 +- evm/src/libraries/TransceiverHelpers.sol | 14 +- evm/src/libraries/TransceiverStructs.sol | 83 +- evm/src/wormhole/Governance.sol | 67 +- evm/test/DeploymentScripts.t.sol | 21 +- evm/test/IntegrationAdditionalTransfer.t.sol | 58 +- evm/test/IntegrationCustomConsistency.t.sol | 44 +- evm/test/IntegrationStandalone.t.sol | 109 +- evm/test/IntegrationWithoutRateLimiting.t.sol | 109 +- evm/test/NttManager.t.sol | 168 +- evm/test/NttManagerNoRateLimiting.t.sol | 154 +- evm/test/RateLimit.t.sol | 96 +- evm/test/Upgrades.t.sol | 70 +- evm/test/libraries/IntegrationHelpers.sol | 41 +- evm/test/libraries/NttManagerHelpers.sol | 6 +- evm/test/libraries/TransceiverHelpers.sol | 9 +- .../mocks/MockNttManagerAdditionalPayload.sol | 3 +- evm/test/wormhole/Governance.t.sol | 50 +- evm/ts/src/bindings.ts | 2 + .../src/ethers-contracts/2_1_0/NttManager.ts | 1792 +++++++++++++++ .../2_1_0/WormholeTransceiver.ts | 994 ++++++++ evm/ts/src/ethers-contracts/2_1_0/common.ts | 131 ++ .../2_1_0/factories/NttManager__factory.ts | 2038 +++++++++++++++++ .../factories/WormholeTransceiver__factory.ts | 1173 ++++++++++ .../ethers-contracts/2_1_0/factories/index.ts | 5 + evm/ts/src/ethers-contracts/2_1_0/index.ts | 8 + evm/ts/src/ethers-contracts/index.ts | 12 +- 41 files changed, 6784 insertions(+), 661 deletions(-) create mode 100644 evm/remappings.txt create mode 100644 evm/ts/src/ethers-contracts/2_1_0/NttManager.ts create mode 100644 evm/ts/src/ethers-contracts/2_1_0/WormholeTransceiver.ts create mode 100644 evm/ts/src/ethers-contracts/2_1_0/common.ts create mode 100644 evm/ts/src/ethers-contracts/2_1_0/factories/NttManager__factory.ts create mode 100644 evm/ts/src/ethers-contracts/2_1_0/factories/WormholeTransceiver__factory.ts create mode 100644 evm/ts/src/ethers-contracts/2_1_0/factories/index.ts create mode 100644 evm/ts/src/ethers-contracts/2_1_0/index.ts diff --git a/evm/echidna/FuzzNttManager.sol b/evm/echidna/FuzzNttManager.sol index d3c90de56..a8eebae6a 100644 --- a/evm/echidna/FuzzNttManager.sol +++ b/evm/echidna/FuzzNttManager.sol @@ -14,7 +14,7 @@ import "./helpers/FuzzingHelpers.sol"; import "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol"; import "solidity-bytes-utils/BytesLib.sol"; import "../test/mocks/DummyTransceiver.sol"; -import "wormhole-solidity-sdk/Utils.sol"; +import "wormhole-sdk/Utils.sol"; contract FuzzNttManager is FuzzingHelpers { uint64[] queuedOutboundTransfersArray; diff --git a/evm/foundry.lock b/evm/foundry.lock index d4efa0b2e..8dc4c5a5b 100644 --- a/evm/foundry.lock +++ b/evm/foundry.lock @@ -9,6 +9,6 @@ "rev": "e0115c4d231910df47ce3b60625ce562fe4af985" }, "lib/wormhole-solidity-sdk": { - "rev": "b9e129e65d34827d92fceeed8c87d3ecdfc801d0" + "rev": "d80e0f6cd16f281f3f9df435e98e823b4212b2ad" } } \ No newline at end of file diff --git a/evm/foundry.toml b/evm/foundry.toml index a3ce8cbad..af3e03e29 100644 --- a/evm/foundry.toml +++ b/evm/foundry.toml @@ -1,8 +1,8 @@ [profile.default] -solc_version = "0.8.19" +solc_version = "0.8.24" optimizer = true optimizer_runs = 200 -via_ir = false +via_ir = true evm_version = "london" src = "src" out = "out" diff --git a/evm/lib/wormhole-solidity-sdk b/evm/lib/wormhole-solidity-sdk index b9e129e65..d80e0f6cd 160000 --- a/evm/lib/wormhole-solidity-sdk +++ b/evm/lib/wormhole-solidity-sdk @@ -1 +1 @@ -Subproject commit b9e129e65d34827d92fceeed8c87d3ecdfc801d0 +Subproject commit d80e0f6cd16f281f3f9df435e98e823b4212b2ad diff --git a/evm/remappings.txt b/evm/remappings.txt new file mode 100644 index 000000000..c5284c24e --- /dev/null +++ b/evm/remappings.txt @@ -0,0 +1,2 @@ +wormhole-solidity-sdk/=lib/wormhole-solidity-sdk/src/ +wormhole-sdk/=lib/wormhole-solidity-sdk/src/ diff --git a/evm/script/DeployWormholeNtt.s.sol b/evm/script/DeployWormholeNtt.s.sol index 7cf3e64d1..052330059 100644 --- a/evm/script/DeployWormholeNtt.s.sol +++ b/evm/script/DeployWormholeNtt.s.sol @@ -9,14 +9,11 @@ import {INttManager} from "../src/interfaces/INttManager.sol"; import {IWormholeTransceiver} from "../src/interfaces/IWormholeTransceiver.sol"; import "../src/interfaces/IManagerBase.sol"; import "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; import {NttManager} from "../src/NttManager/NttManager.sol"; import {NttManagerNoRateLimiting} from "../src/NttManager/NttManagerNoRateLimiting.sol"; import {NttManagerWethUnwrap} from "../src/NttManager/NttManagerWethUnwrap.sol"; -interface IWormhole { - function chainId() external view returns (uint16); -} - contract DeployWormholeNtt is Script, DeployWormholeNttBase { function run() public { vm.startBroadcast(); @@ -32,7 +29,7 @@ contract DeployWormholeNtt is Script, DeployWormholeNttBase { modeUint == 0 ? IManagerBase.Mode.LOCKING : IManagerBase.Mode.BURNING; string memory managerVariant = vm.envOr("MANAGER_VARIANT", string("standard")); - IWormhole wh = IWormhole(wormhole); + ICoreBridge wh = ICoreBridge(wormhole); // sanity check decimals (bool success, bytes memory queriedDecimals) = diff --git a/evm/script/helpers/DeployWormholeNttBase.sol b/evm/script/helpers/DeployWormholeNttBase.sol index d1eaf81f1..552d40721 100644 --- a/evm/script/helpers/DeployWormholeNttBase.sol +++ b/evm/script/helpers/DeployWormholeNttBase.sol @@ -14,7 +14,7 @@ import { WormholeTransceiver } from "../../src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol"; import {ERC1967Proxy} from "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol"; -import {IWormhole} from "wormhole-solidity-sdk/interfaces/IWormhole.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; contract DeployWormholeNttBase is ParseNttConfig { /// @notice Parameters for deploying NTT contracts @@ -106,7 +106,7 @@ contract DeployWormholeNttBase is ParseNttConfig { WormholeTransceiver transceiverProxy = WormholeTransceiver(address(new ERC1967Proxy(address(implementation), ""))); - IWormhole wh = IWormhole(params.wormholeCoreBridge); + ICoreBridge wh = ICoreBridge(params.wormholeCoreBridge); uint256 messageFee = wh.messageFee(); // wh transceiver sends a WH_TRANSCEIVER_INIT_PREFIX message transceiverProxy.initialize{value: messageFee}(); diff --git a/evm/script/helpers/ParseNttConfig.sol b/evm/script/helpers/ParseNttConfig.sol index 78739f10e..c57aebb80 100644 --- a/evm/script/helpers/ParseNttConfig.sol +++ b/evm/script/helpers/ParseNttConfig.sol @@ -6,6 +6,7 @@ import {stdJson} from "forge-std/StdJson.sol"; import "../../src/interfaces/INttManager.sol"; import "../../src/interfaces/IWormholeTransceiver.sol"; +import {toUniversalAddress, fromUniversalAddress} from "wormhole-sdk/Utils.sol"; contract ParseNttConfig is Script { using stdJson for string; @@ -25,24 +26,6 @@ contract ParseNttConfig is Script { mapping(uint16 => bool) duplicateChainIds; - function toUniversalAddress( - address evmAddr - ) internal pure returns (bytes32 converted) { - assembly ("memory-safe") { - converted := and(0xffffffffffffffffffffffffffffffffffffffff, evmAddr) - } - } - - function fromUniversalAddress( - bytes32 universalAddr - ) internal pure returns (address converted) { - require(bytes12(universalAddr) == 0, "Address overflow"); - - assembly ("memory-safe") { - converted := universalAddr - } - } - function _parseAndValidateConfigFile( uint16 wormholeChainId ) diff --git a/evm/src/NttManager/ManagerBase.sol b/evm/src/NttManager/ManagerBase.sol index 52a00107f..f8919247f 100644 --- a/evm/src/NttManager/ManagerBase.sol +++ b/evm/src/NttManager/ManagerBase.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: Apache 2 pragma solidity >=0.8.8 <0.9.0; -import "wormhole-solidity-sdk/Utils.sol"; -import "wormhole-solidity-sdk/libraries/BytesParsing.sol"; +import "wormhole-sdk/Utils.sol"; +import "wormhole-sdk/libraries/BytesParsing.sol"; import "../libraries/external/OwnableUpgradeable.sol"; import "../libraries/external/ReentrancyGuardUpgradeable.sol"; @@ -146,16 +146,20 @@ abstract contract ManagerBase is bytes32 nttManagerMessageHash = TransceiverStructs.nttManagerMessageDigest(sourceChainId, payload); + // Cache the transceiver index to avoid redundant storage reads. + uint8 index = _getTransceiverInfosStorage()[msg.sender].index; + // set the attested flag for this transceiver. // NOTE: Attestation is idempotent (bitwise or 1), but we revert // anyway to ensure that the client does not continue to initiate calls // to receive the same message through the same transceiver. - if (transceiverAttestedToMessage( - nttManagerMessageHash, _getTransceiverInfosStorage()[msg.sender].index - )) { + if (transceiverAttestedToMessage(nttManagerMessageHash, index)) { revert TransceiverAlreadyAttestedToMessage(nttManagerMessageHash); } - _setTransceiverAttestedToMessage(nttManagerMessageHash, msg.sender); + _setTransceiverAttestedToMessage(nttManagerMessageHash, index); + + // msg.sender is the transceiver address (guaranteed by onlyTransceiver modifier) + emit MessageAttestedTo(nttManagerMessageHash, msg.sender, index); return nttManagerMessageHash; } @@ -430,17 +434,6 @@ abstract contract ManagerBase is _getMessageAttestationsStorage()[digest].attestedTransceivers |= uint64(1 << index); } - function _setTransceiverAttestedToMessage( - bytes32 digest, - address transceiver - ) internal { - _setTransceiverAttestedToMessage(digest, _getTransceiverInfosStorage()[transceiver].index); - - emit MessageAttestedTo( - digest, transceiver, _getTransceiverInfosStorage()[transceiver].index - ); - } - /// @dev Returns the bitmap of attestations from enabled transceivers for a given message. function _getMessageAttestations( bytes32 digest diff --git a/evm/src/NttManager/NttManager.sol b/evm/src/NttManager/NttManager.sol index 46276f3e1..d828a81a8 100644 --- a/evm/src/NttManager/NttManager.sol +++ b/evm/src/NttManager/NttManager.sol @@ -4,8 +4,8 @@ pragma solidity >=0.8.8 <0.9.0; import "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; import "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; import "openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Burnable.sol"; -import "wormhole-solidity-sdk/Utils.sol"; -import "wormhole-solidity-sdk/libraries/BytesParsing.sol"; +import "wormhole-sdk/Utils.sol"; +import "wormhole-sdk/libraries/BytesParsing.sol"; import "../libraries/RateLimiter.sol"; @@ -41,7 +41,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase { using TrimmedAmountLib for uint256; using TrimmedAmountLib for TrimmedAmount; - string public constant NTT_MANAGER_VERSION = "2.0.0"; + string public constant NTT_MANAGER_VERSION = "2.1.0"; // =============== Setup ================================================================= @@ -245,7 +245,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase { TrimmedAmount nativeTransferAmount = (nativeTokenTransfer.amount.untrim(toDecimals)).trim(toDecimals, toDecimals); - address transferRecipient = fromWormholeFormat(nativeTokenTransfer.to); + address transferRecipient = fromUniversalAddress(nativeTokenTransfer.to); bool enqueued = _enqueueOrConsumeInboundRateLimit( digest, sourceChainId, nativeTransferAmount, transferRecipient @@ -551,7 +551,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase { bytes memory encodedNttManagerPayload = TransceiverStructs.encodeNttManagerMessage( TransceiverStructs.NttManagerMessage( bytes32(uint256(seq)), - toWormholeFormat(sender), + toUniversalAddress(sender), TransceiverStructs.encodeNativeTokenTransfer(ntt) ) ); @@ -609,7 +609,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase { bytes32 // refundAddress ) internal virtual returns (TransceiverStructs.NativeTokenTransfer memory) { return TransceiverStructs.NativeTokenTransfer( - amount, toWormholeFormat(token), recipient, recipientChain, "" + amount, toUniversalAddress(token), recipient, recipientChain, "" ); } diff --git a/evm/src/Transceiver/Transceiver.sol b/evm/src/Transceiver/Transceiver.sol index d0dfa2f7f..cb9ec79a4 100644 --- a/evm/src/Transceiver/Transceiver.sol +++ b/evm/src/Transceiver/Transceiver.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache 2 pragma solidity >=0.8.8 <0.9.0; -import "wormhole-solidity-sdk/Utils.sol"; +import "wormhole-sdk/Utils.sol"; import "../libraries/TransceiverStructs.sol"; import "../libraries/PausableOwnable.sol"; @@ -148,9 +148,9 @@ abstract contract Transceiver is bytes32 recipientNttManagerAddress, TransceiverStructs.NttManagerMessage memory payload ) internal virtual { - if (recipientNttManagerAddress != toWormholeFormat(nttManager)) { + if (recipientNttManagerAddress != toUniversalAddress(nttManager)) { revert UnexpectedRecipientNttManagerAddress( - toWormholeFormat(nttManager), recipientNttManagerAddress + toUniversalAddress(nttManager), recipientNttManagerAddress ); } INttManager(nttManager).attestationReceived(sourceChainId, sourceNttManagerAddress, payload); diff --git a/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol b/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol index dbc00b579..9371da145 100644 --- a/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol +++ b/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol @@ -1,16 +1,15 @@ // SPDX-License-Identifier: Apache 2 pragma solidity >=0.8.8 <0.9.0; -import "wormhole-solidity-sdk/libraries/BytesParsing.sol"; -import "wormhole-solidity-sdk/interfaces/IWormhole.sol"; - +import "wormhole-sdk/libraries/BytesParsing.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; +import {CoreBridgeLib} from "wormhole-sdk/libraries/CoreBridge.sol"; +import {VaaLib} from "wormhole-sdk/libraries/VaaLib.sol"; import "../../libraries/TransceiverHelpers.sol"; import "../../libraries/TransceiverStructs.sol"; -import "../../libraries/ConfigMakers.sol"; import "../../interfaces/IWormholeTransceiver.sol"; import "../../interfaces/INttManager.sol"; -import "../../interfaces/ICustomConsistencyLevel.sol"; import "./WormholeTransceiverState.sol"; @@ -29,7 +28,7 @@ import "./WormholeTransceiverState.sol"; contract WormholeTransceiver is IWormholeTransceiver, WormholeTransceiverState { using BytesParsing for bytes; - string public constant WORMHOLE_TRANSCEIVER_VERSION = "2.0.0"; + string public constant WORMHOLE_TRANSCEIVER_VERSION = "2.1.0"; constructor( address nttManager, @@ -57,11 +56,9 @@ contract WormholeTransceiver is IWormholeTransceiver, WormholeTransceiverState { /// @inheritdoc IWormholeTransceiver function receiveMessage( - bytes memory encodedMessage + bytes calldata encodedMessage ) external { - uint16 sourceChainId; - bytes memory payload; - (sourceChainId, payload) = _verifyMessage(encodedMessage); + (uint16 sourceChainId, bytes calldata payload) = _verifyMessage(encodedMessage); // parse the encoded Transceiver payload TransceiverStructs.TransceiverMessage memory parsedTransceiverMessage; @@ -90,8 +87,8 @@ contract WormholeTransceiver is IWormholeTransceiver, WormholeTransceiverState { } uint256 offset = 0; - (instruction.shouldSkipRelayerSend, offset) = encoded.asBoolUnchecked(offset); - encoded.checkLength(offset); + (instruction.shouldSkipRelayerSend, offset) = encoded.asBoolMemUnchecked(offset); + BytesParsing.checkLength(encoded.length, offset); } /// @inheritdoc IWormholeTransceiver @@ -124,7 +121,7 @@ contract WormholeTransceiver is IWormholeTransceiver, WormholeTransceiverState { bytes memory encodedTransceiverPayload ) = TransceiverStructs.buildAndEncodeTransceiverMessage( WH_TRANSCEIVER_PAYLOAD_PREFIX, - toWormholeFormat(caller), + toUniversalAddress(caller), recipientNttManagerAddress, nttManagerMessage, new bytes(0) @@ -141,38 +138,36 @@ contract WormholeTransceiver is IWormholeTransceiver, WormholeTransceiverState { } function _verifyMessage( - bytes memory encodedMessage - ) internal returns (uint16, bytes memory) { - // verify VAA against Wormhole Core Bridge contract - (IWormhole.VM memory vm, bool valid, string memory reason) = - wormhole.parseAndVerifyVM(encodedMessage); - - // ensure that the VAA is valid - if (!valid) { - revert InvalidVaa(reason); - } + bytes calldata encodedMessage + ) internal returns (uint16, bytes calldata) { + checkFork(wormholeTransceiver_evmChainId); + + // Verify VAA using client-side verification (gas-optimized vs CoreBridge external call). + // The calldata variant avoids copying the entire VAA into memory. + ( + ,, + uint16 emitterChainId, + bytes32 emitterAddress, + uint64 sequence,, + bytes calldata payload + ) = CoreBridgeLib.decodeAndVerifyVaaCd(address(wormhole), encodedMessage); // ensure that the message came from a registered peer contract - if (!_verifyBridgeVM(vm)) { - revert InvalidWormholePeer(vm.emitterChainId, vm.emitterAddress); + if (getWormholePeer(emitterChainId) != emitterAddress) { + revert InvalidWormholePeer(emitterChainId, emitterAddress); } - // save the VAA hash in storage to protect against replay attacks. - if (isVAAConsumed(vm.hash)) { - revert TransferAlreadyCompleted(vm.hash); + // Replay protection using the same double-keccak digest as the old CoreBridge + // parseAndVerifyVM (backward compatible across upgrades). Computed directly from + // calldata using the SDK's optimized keccak utilities (no abi.encodePacked allocation). + bytes32 vaaDigest = VaaLib.calcVaaDoubleHashCd(encodedMessage); + if (isVAAConsumed(vaaDigest)) { + revert TransferAlreadyCompleted(vaaDigest); } - _setVAAConsumed(vm.hash); - - // emit `ReceivedMessage` event - emit ReceivedMessage(vm.hash, vm.emitterChainId, vm.emitterAddress, vm.sequence); + _setVAAConsumed(vaaDigest); - return (vm.emitterChainId, vm.payload); - } + emit ReceivedMessage(vaaDigest, emitterChainId, emitterAddress, sequence); - function _verifyBridgeVM( - IWormhole.VM memory vm - ) internal view returns (bool) { - checkFork(wormholeTransceiver_evmChainId); - return getWormholePeer(vm.emitterChainId) == vm.emitterAddress; + return (emitterChainId, payload); } } diff --git a/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiverState.sol b/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiverState.sol index ecfe3fd52..0075e50bf 100644 --- a/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiverState.sol +++ b/evm/src/Transceiver/WormholeTransceiver/WormholeTransceiverState.sol @@ -1,17 +1,15 @@ // SPDX-License-Identifier: Apache 2 pragma solidity >=0.8.8 <0.9.0; -import "wormhole-solidity-sdk/libraries/BytesParsing.sol"; -import "wormhole-solidity-sdk/interfaces/IWormhole.sol"; - +import "wormhole-sdk/libraries/BytesParsing.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; import "../../libraries/TransceiverHelpers.sol"; import "../../libraries/TransceiverStructs.sol"; -import "../../libraries/ConfigMakers.sol"; +import {CustomConsistencyLib} from "wormhole-sdk/libraries/CustomConsistency.sol"; import "../../interfaces/IWormholeTransceiver.sol"; import "../../interfaces/IWormholeTransceiverState.sol"; import "../../interfaces/INttManager.sol"; -import "../../interfaces/ICustomConsistencyLevel.sol"; import "../Transceiver.sol"; @@ -23,7 +21,7 @@ abstract contract WormholeTransceiverState is IWormholeTransceiverState, Transce uint8 public immutable customConsistencyLevel; uint16 public immutable additionalBlocks; address public immutable customConsistencyLevelAddress; - IWormhole public immutable wormhole; + ICoreBridge public immutable wormhole; /// @dev We don't check this in `_checkImmutables` since it's set at construction /// through `block.chainid`. uint256 immutable wormholeTransceiver_evmChainId; @@ -56,7 +54,7 @@ abstract contract WormholeTransceiverState is IWormholeTransceiverState, Transce uint16 _additionalBlocks, address _customConsistencyLevelAddress ) Transceiver(nttManager) { - wormhole = IWormhole(wormholeCoreBridge); + wormhole = ICoreBridge(wormholeCoreBridge); wormholeTransceiver_evmChainId = block.chainid; consistencyLevel = _consistencyLevel; customConsistencyLevel = _customConsistencyLevel; @@ -76,16 +74,16 @@ abstract contract WormholeTransceiverState is IWormholeTransceiverState, Transce function _initializeTransceiver() internal { TransceiverStructs.TransceiverInit memory init = TransceiverStructs.TransceiverInit({ transceiverIdentifier: WH_TRANSCEIVER_INIT_PREFIX, - nttManagerAddress: toWormholeFormat(nttManager), + nttManagerAddress: toUniversalAddress(nttManager), nttManagerMode: INttManager(nttManager).getMode(), - tokenAddress: toWormholeFormat(nttManagerToken), + tokenAddress: toUniversalAddress(nttManagerToken), tokenDecimals: INttManager(nttManager).tokenDecimals() }); if (consistencyLevel == CONSISTENCY_LEVEL_CUSTOM) { - bytes32 config = - ConfigMakers.makeAdditionalBlocksConfig(customConsistencyLevel, additionalBlocks); - ICustomConsistencyLevel(customConsistencyLevelAddress).configure(config); + CustomConsistencyLib.setAdditionalBlocksConfig( + customConsistencyLevelAddress, customConsistencyLevel, additionalBlocks + ); } wormhole.publishMessage{value: msg.value}( diff --git a/evm/src/interfaces/IWormholeTransceiver.sol b/evm/src/interfaces/IWormholeTransceiver.sol index e0abe5d7d..38faf220c 100644 --- a/evm/src/interfaces/IWormholeTransceiver.sol +++ b/evm/src/interfaces/IWormholeTransceiver.sol @@ -48,7 +48,7 @@ interface IWormholeTransceiver is IWormholeTransceiverState { /// to the transceiver NttManager contract. /// @param encodedMessage The attested message. function receiveMessage( - bytes memory encodedMessage + bytes calldata encodedMessage ) external; /// @notice Parses the encoded instruction and returns the instruction struct. diff --git a/evm/src/libraries/ConfigMakers.sol b/evm/src/libraries/ConfigMakers.sol index 46c0a70a8..e7de91e6a 100644 --- a/evm/src/libraries/ConfigMakers.sol +++ b/evm/src/libraries/ConfigMakers.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache 2 pragma solidity ^0.8.0; -import "wormhole-solidity-sdk/libraries/BytesParsing.sol"; +import "wormhole-sdk/libraries/BytesParsing.sol"; library ConfigMakers { using BytesParsing for bytes; @@ -19,6 +19,6 @@ library ConfigMakers { bytes28 padding; bytes memory encoded = abi.encodePacked(TYPE_ADDITIONAL_BLOCKS, consistencyLevel, blocksToWait, padding); - (config,) = encoded.asBytes32Unchecked(0); + (config,) = encoded.asBytes32MemUnchecked(0); } } diff --git a/evm/src/libraries/TransceiverHelpers.sol b/evm/src/libraries/TransceiverHelpers.sol index 7a4908814..7ff401718 100644 --- a/evm/src/libraries/TransceiverHelpers.sol +++ b/evm/src/libraries/TransceiverHelpers.sol @@ -24,14 +24,14 @@ function min( return a < b ? a : b; } -// @dev Count the number of set bits in a uint64 +// @dev Count the number of set bits in a uint64 using parallel bit counting. function countSetBits( uint64 x -) pure returns (uint8 count) { - while (x != 0) { - x &= x - 1; - count++; +) pure returns (uint8) { + unchecked { + x = x - ((x >> 1) & 0x5555555555555555); + x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333); + x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f; + return uint8((x * 0x0101010101010101) >> 56); } - - return count; } diff --git a/evm/src/libraries/TransceiverStructs.sol b/evm/src/libraries/TransceiverStructs.sol index 3ffb4157c..61c8ad08b 100644 --- a/evm/src/libraries/TransceiverStructs.sol +++ b/evm/src/libraries/TransceiverStructs.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache 2 pragma solidity >=0.8.8 <0.9.0; -import "wormhole-solidity-sdk/libraries/BytesParsing.sol"; +import "wormhole-sdk/libraries/BytesParsing.sol"; import "./TrimmedAmount.sol"; library TransceiverStructs { @@ -59,7 +59,9 @@ library TransceiverStructs { uint16 sourceChainId, NttManagerMessage memory m ) public pure returns (bytes32) { - return _nttManagerMessageDigest(sourceChainId, encodeNttManagerMessage(m)); + return keccak256( + abi.encodePacked(sourceChainId, m.id, m.sender, uint16(m.payload.length), m.payload) + ); } function _nttManagerMessageDigest( @@ -86,12 +88,12 @@ library TransceiverStructs { bytes memory encoded ) public pure returns (NttManagerMessage memory nttManagerMessage) { uint256 offset = 0; - (nttManagerMessage.id, offset) = encoded.asBytes32Unchecked(offset); - (nttManagerMessage.sender, offset) = encoded.asBytes32Unchecked(offset); + (nttManagerMessage.id, offset) = encoded.asBytes32MemUnchecked(offset); + (nttManagerMessage.sender, offset) = encoded.asBytes32MemUnchecked(offset); uint256 payloadLength; - (payloadLength, offset) = encoded.asUint16Unchecked(offset); - (nttManagerMessage.payload, offset) = encoded.sliceUnchecked(offset, payloadLength); - encoded.checkLength(offset); + (payloadLength, offset) = encoded.asUint16MemUnchecked(offset); + (nttManagerMessage.payload, offset) = encoded.sliceMemUnchecked(offset, payloadLength); + BytesParsing.checkLength(encoded.length, offset); } /// @dev Native Token Transfer payload. @@ -158,7 +160,7 @@ library TransceiverStructs { ) public pure returns (NativeTokenTransfer memory nativeTokenTransfer) { uint256 offset = 0; bytes4 prefix; - (prefix, offset) = encoded.asBytes4Unchecked(offset); + (prefix, offset) = encoded.asBytes4MemUnchecked(offset); if (prefix != NTT_PREFIX) { revert IncorrectPrefix(prefix); } @@ -166,23 +168,23 @@ library TransceiverStructs { // The `amount` and `decimals` fields are parsed in reverse order compared to how they are declared in the // `TrimmedAmount` struct. This is consistent with the Rust NTT implementation. uint8 numDecimals; - (numDecimals, offset) = encoded.asUint8Unchecked(offset); + (numDecimals, offset) = encoded.asUint8MemUnchecked(offset); uint64 amount; - (amount, offset) = encoded.asUint64Unchecked(offset); + (amount, offset) = encoded.asUint64MemUnchecked(offset); nativeTokenTransfer.amount = packTrimmedAmount(amount, numDecimals); - (nativeTokenTransfer.sourceToken, offset) = encoded.asBytes32Unchecked(offset); - (nativeTokenTransfer.to, offset) = encoded.asBytes32Unchecked(offset); - (nativeTokenTransfer.toChain, offset) = encoded.asUint16Unchecked(offset); + (nativeTokenTransfer.sourceToken, offset) = encoded.asBytes32MemUnchecked(offset); + (nativeTokenTransfer.to, offset) = encoded.asBytes32MemUnchecked(offset); + (nativeTokenTransfer.toChain, offset) = encoded.asUint16MemUnchecked(offset); // The additional payload may be omitted, but if it is included, it is prefixed by a u16 for its length. // If there are at least 2 bytes remaining, attempt to parse the additional payload. if (encoded.length >= offset + 2) { uint256 payloadLength; - (payloadLength, offset) = encoded.asUint16Unchecked(offset); + (payloadLength, offset) = encoded.asUint16MemUnchecked(offset); (nativeTokenTransfer.additionalPayload, offset) = - encoded.sliceUnchecked(offset, payloadLength); + encoded.sliceMemUnchecked(offset, payloadLength); } - encoded.checkLength(offset); + BytesParsing.checkLength(encoded.length, offset); } /// @dev Message emitted by Transceiver implementations. @@ -266,25 +268,26 @@ library TransceiverStructs { uint256 offset = 0; bytes4 prefix; - (prefix, offset) = encoded.asBytes4Unchecked(offset); + (prefix, offset) = encoded.asBytes4MemUnchecked(offset); if (prefix != expectedPrefix) { revert IncorrectPrefix(prefix); } - (transceiverMessage.sourceNttManagerAddress, offset) = encoded.asBytes32Unchecked(offset); - (transceiverMessage.recipientNttManagerAddress, offset) = encoded.asBytes32Unchecked(offset); + (transceiverMessage.sourceNttManagerAddress, offset) = encoded.asBytes32MemUnchecked(offset); + (transceiverMessage.recipientNttManagerAddress, offset) = + encoded.asBytes32MemUnchecked(offset); uint16 nttManagerPayloadLength; - (nttManagerPayloadLength, offset) = encoded.asUint16Unchecked(offset); + (nttManagerPayloadLength, offset) = encoded.asUint16MemUnchecked(offset); (transceiverMessage.nttManagerPayload, offset) = - encoded.sliceUnchecked(offset, nttManagerPayloadLength); + encoded.sliceMemUnchecked(offset, nttManagerPayloadLength); uint16 transceiverPayloadLength; - (transceiverPayloadLength, offset) = encoded.asUint16Unchecked(offset); + (transceiverPayloadLength, offset) = encoded.asUint16MemUnchecked(offset); (transceiverMessage.transceiverPayload, offset) = - encoded.sliceUnchecked(offset, transceiverPayloadLength); + encoded.sliceMemUnchecked(offset, transceiverPayloadLength); // Check if the entire byte array has been processed - encoded.checkLength(offset); + BytesParsing.checkLength(encoded.length, offset); } /// @dev Parses the payload of an Transceiver message and returns @@ -331,10 +334,10 @@ library TransceiverStructs { bytes memory encoded, uint256 offset ) public pure returns (TransceiverInstruction memory instruction, uint256 nextOffset) { - (instruction.index, nextOffset) = encoded.asUint8Unchecked(offset); + (instruction.index, nextOffset) = encoded.asUint8MemUnchecked(offset); uint8 instructionLength; - (instructionLength, nextOffset) = encoded.asUint8Unchecked(nextOffset); - (instruction.payload, nextOffset) = encoded.sliceUnchecked(nextOffset, instructionLength); + (instructionLength, nextOffset) = encoded.asUint8MemUnchecked(nextOffset); + (instruction.payload, nextOffset) = encoded.sliceMemUnchecked(nextOffset, instructionLength); } function parseTransceiverInstructionChecked( @@ -342,7 +345,7 @@ library TransceiverStructs { ) public pure returns (TransceiverInstruction memory instruction) { uint256 offset = 0; (instruction, offset) = parseTransceiverInstructionUnchecked(encoded, offset); - encoded.checkLength(offset); + BytesParsing.checkLength(encoded.length, offset); } /// @dev Encode an array of multiple variable-length transceiver-specific instructions. @@ -371,7 +374,7 @@ library TransceiverStructs { ) public pure returns (TransceiverInstruction[] memory) { uint256 offset = 0; uint256 instructionsLength; - (instructionsLength, offset) = encoded.asUint8Unchecked(offset); + (instructionsLength, offset) = encoded.asUint8MemUnchecked(offset); // We allocate an array with the length of the number of registered transceivers // This gives us the flexibility to not have to pass instructions for transceivers that @@ -401,7 +404,7 @@ library TransceiverStructs { instructions[instructionIndex] = instruction; } - encoded.checkLength(offset); + BytesParsing.checkLength(encoded.length, offset); return instructions; } @@ -430,12 +433,12 @@ library TransceiverStructs { bytes memory encoded ) public pure returns (TransceiverInit memory init) { uint256 offset = 0; - (init.transceiverIdentifier, offset) = encoded.asBytes4Unchecked(offset); - (init.nttManagerAddress, offset) = encoded.asBytes32Unchecked(offset); - (init.nttManagerMode, offset) = encoded.asUint8Unchecked(offset); - (init.tokenAddress, offset) = encoded.asBytes32Unchecked(offset); - (init.tokenDecimals, offset) = encoded.asUint8Unchecked(offset); - encoded.checkLength(offset); + (init.transceiverIdentifier, offset) = encoded.asBytes4MemUnchecked(offset); + (init.nttManagerAddress, offset) = encoded.asBytes32MemUnchecked(offset); + (init.nttManagerMode, offset) = encoded.asUint8MemUnchecked(offset); + (init.tokenAddress, offset) = encoded.asBytes32MemUnchecked(offset); + (init.tokenDecimals, offset) = encoded.asUint8MemUnchecked(offset); + BytesParsing.checkLength(encoded.length, offset); } struct TransceiverRegistration { @@ -458,9 +461,9 @@ library TransceiverStructs { bytes memory encoded ) public pure returns (TransceiverRegistration memory registration) { uint256 offset = 0; - (registration.transceiverIdentifier, offset) = encoded.asBytes4Unchecked(offset); - (registration.transceiverChainId, offset) = encoded.asUint16Unchecked(offset); - (registration.transceiverAddress, offset) = encoded.asBytes32Unchecked(offset); - encoded.checkLength(offset); + (registration.transceiverIdentifier, offset) = encoded.asBytes4MemUnchecked(offset); + (registration.transceiverChainId, offset) = encoded.asUint16MemUnchecked(offset); + (registration.transceiverAddress, offset) = encoded.asBytes32MemUnchecked(offset); + BytesParsing.checkLength(encoded.length, offset); } } diff --git a/evm/src/wormhole/Governance.sol b/evm/src/wormhole/Governance.sol index fb6b166df..fb52bf090 100644 --- a/evm/src/wormhole/Governance.sol +++ b/evm/src/wormhole/Governance.sol @@ -1,8 +1,19 @@ // SPDX-License-Identifier: Apache 2 pragma solidity >=0.8.8 <0.9.0; -import "wormhole-solidity-sdk/interfaces/IWormhole.sol"; -import "wormhole-solidity-sdk/libraries/BytesParsing.sol"; +import "wormhole-sdk/libraries/BytesParsing.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; +import {CoreBridgeLib} from "wormhole-sdk/libraries/CoreBridge.sol"; +import {VaaLib} from "wormhole-sdk/libraries/VaaLib.sol"; + +/// @dev Extended interface for governance-specific methods not in ICoreBridge +interface ICoreBridgeGovernance is ICoreBridge { + function governanceChainId() external view returns (uint16); + function governanceContract() external view returns (bytes32); + function governanceActionIsConsumed( + bytes32 hash + ) external view returns (bool); +} contract Governance { using BytesParsing for bytes; @@ -28,7 +39,7 @@ contract Governance { SOLANA_CALL } - IWormhole immutable wormhole; + ICoreBridgeGovernance immutable wormhole; error PayloadTooLong(uint256 size); error InvalidModule(bytes32 module); @@ -77,15 +88,16 @@ contract Governance { constructor( address _wormhole ) { - wormhole = IWormhole(_wormhole); + wormhole = ICoreBridgeGovernance(_wormhole); } function performGovernance( bytes calldata vaa ) external { - IWormhole.VM memory verified = _verifyGovernanceVAA(vaa); + (,, bytes memory payload) = _verifyGovernanceVAA(vaa); + GeneralPurposeGovernanceMessage memory message = - parseGeneralPurposeGovernanceMessage(verified.payload); + parseGeneralPurposeGovernanceMessage(payload); if (message.action != uint8(GovernanceAction.EVM_CALL)) { revert InvalidAction(message.action); @@ -99,8 +111,6 @@ contract Governance { revert NotRecipientContract(message.governanceContract); } - // TODO: any other checks? the call is trusted (signed by guardians), - // but what's the worst that could happen to this contract? (bool success, bytes memory returnData) = message.governedContract.call(message.callData); if (!success) { revert(string(returnData)); @@ -118,26 +128,21 @@ contract Governance { } function _verifyGovernanceVAA( - bytes memory encodedVM - ) internal returns (IWormhole.VM memory parsedVM) { - (IWormhole.VM memory vm, bool valid, string memory reason) = - wormhole.parseAndVerifyVM(encodedVM); + bytes calldata encodedVM + ) internal returns (uint16 emitterChainId, bytes32 emitterAddress, bytes calldata payload) { + (,, emitterChainId, emitterAddress,,, payload) = + CoreBridgeLib.decodeAndVerifyVaaCd(address(wormhole), encodedVM); - if (!valid) { - revert(reason); + if (emitterChainId != wormhole.governanceChainId()) { + revert InvalidGovernanceChainId(emitterChainId); } - if (vm.emitterChainId != wormhole.governanceChainId()) { - revert InvalidGovernanceChainId(vm.emitterChainId); + if (emitterAddress != wormhole.governanceContract()) { + revert InvalidGovernanceContract(emitterAddress); } - if (vm.emitterAddress != wormhole.governanceContract()) { - revert InvalidGovernanceContract(vm.emitterAddress); - } - - _replayProtect(vm.hash); - - return vm; + bytes32 digest = VaaLib.calcVaaDoubleHashCd(encodedVM); + _replayProtect(digest); } function encodeGeneralPurposeGovernanceMessage( @@ -164,18 +169,18 @@ contract Governance { uint256 offset = 0; bytes32 module; - (module, offset) = encoded.asBytes32Unchecked(offset); + (module, offset) = encoded.asBytes32MemUnchecked(offset); if (module != MODULE) { revert InvalidModule(module); } - (message.action, offset) = encoded.asUint8Unchecked(offset); - (message.chain, offset) = encoded.asUint16Unchecked(offset); - (message.governanceContract, offset) = encoded.asAddressUnchecked(offset); - (message.governedContract, offset) = encoded.asAddressUnchecked(offset); + (message.action, offset) = encoded.asUint8MemUnchecked(offset); + (message.chain, offset) = encoded.asUint16MemUnchecked(offset); + (message.governanceContract, offset) = encoded.asAddressMemUnchecked(offset); + (message.governedContract, offset) = encoded.asAddressMemUnchecked(offset); uint256 callDataLength; - (callDataLength, offset) = encoded.asUint16Unchecked(offset); - (message.callData, offset) = encoded.sliceUnchecked(offset, callDataLength); - encoded.checkLength(offset); + (callDataLength, offset) = encoded.asUint16MemUnchecked(offset); + (message.callData, offset) = encoded.sliceMemUnchecked(offset, callDataLength); + BytesParsing.checkLength(encoded.length, offset); } } diff --git a/evm/test/DeploymentScripts.t.sol b/evm/test/DeploymentScripts.t.sol index 888ab9edf..939702a1f 100644 --- a/evm/test/DeploymentScripts.t.sol +++ b/evm/test/DeploymentScripts.t.sol @@ -11,15 +11,15 @@ import "../src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol"; import "../src/interfaces/INttManager.sol"; import "../src/interfaces/IManagerBase.sol"; import "../src/interfaces/IWormholeTransceiver.sol"; -import "../src/interfaces/ICustomConsistencyLevel.sol"; -import "../src/libraries/ConfigMakers.sol"; +import {ICustomConsistencyLevel} from "wormhole-sdk/interfaces/ICustomConsistencyLevel.sol"; +import {CustomConsistencyLib} from "wormhole-sdk/libraries/CustomConsistency.sol"; import {Utils} from "./libraries/Utils.sol"; import {DummyToken} from "./NttManager.t.sol"; import "../script/helpers/DeployWormholeNttBase.sol"; import "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol"; -import {IWormhole} from "wormhole-solidity-sdk/interfaces/IWormhole.sol"; -import {WormholeSimulator} from "wormhole-solidity-sdk/testing/helpers/WormholeSimulator.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; +import {WormholeOverride} from "wormhole-sdk/testing/WormholeOverride.sol"; /// @title DeploymentScriptsTest /// @notice Tests for the deployment scripts to ensure they work correctly with the updated constructor signatures @@ -37,11 +37,7 @@ contract DeploymentScriptsTest is Test, DeployWormholeNttBase { uint16 constant ADDTL_BLOCKS = 3; // Wait 3 additional blocks beyond CCL uint64 constant RATE_LIMIT_DURATION = 1 days; - uint256 constant DEVNET_GUARDIAN_PK = - 0xcfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0; - - IWormhole wormhole = IWormhole(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); - WormholeSimulator guardian; + ICoreBridge wormhole = ICoreBridge(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); DummyToken token; // Real CCL contract address on Sepolia and Linea @@ -52,7 +48,7 @@ contract DeploymentScriptsTest is Test, DeployWormholeNttBase { string memory url = "https://ethereum-sepolia-rpc.publicnode.com"; vm.createSelectFork(url); - guardian = new WormholeSimulator(address(wormhole), DEVNET_GUARDIAN_PK); + WormholeOverride.setUpOverride(wormhole); // Deploy test token token = new DummyToken(); @@ -158,8 +154,9 @@ contract DeploymentScriptsTest is Test, DeployWormholeNttBase { ); // Verify that the CCL configuration was set in the CCL contract - bytes32 expectedConfig = - ConfigMakers.makeAdditionalBlocksConfig(CUSTOM_CONSISTENCY_LEVEL, ADDTL_BLOCKS); + bytes32 expectedConfig = CustomConsistencyLib.encodeAdditionalBlocksConfig( + CUSTOM_CONSISTENCY_LEVEL, ADDTL_BLOCKS + ); bytes32 actualConfig = ICustomConsistencyLevel(CCL_CONTRACT_ADDRESS).getConfiguration(transceiver); assertEq(actualConfig, expectedConfig, "CCL configuration not set correctly in contract"); diff --git a/evm/test/IntegrationAdditionalTransfer.t.sol b/evm/test/IntegrationAdditionalTransfer.t.sol index e6386cfd9..8dce4e115 100755 --- a/evm/test/IntegrationAdditionalTransfer.t.sol +++ b/evm/test/IntegrationAdditionalTransfer.t.sol @@ -21,10 +21,13 @@ import "./mocks/MockTransceivers.sol"; import "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol"; -import "wormhole-solidity-sdk/interfaces/IWormhole.sol"; -import "wormhole-solidity-sdk/testing/helpers/WormholeSimulator.sol"; -import "wormhole-solidity-sdk/Utils.sol"; -//import "wormhole-solidity-sdk/testing/WormholeRelayerTest.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; +import { + WormholeOverride, + AdvancedWormholeOverride +} from "wormhole-sdk/testing/WormholeOverride.sol"; +import {VaaLib, Vaa, VaaBody as PublishedMessage} from "wormhole-sdk/libraries/VaaLib.sol"; +import "wormhole-sdk/Utils.sol"; contract TestAdditionalPayload is Test { NttManagerNoRateLimiting nttManagerChain1; @@ -39,9 +42,6 @@ contract TestAdditionalPayload is Test { uint256 constant GAS_LIMIT = 500000; uint16 constant SENDING_CHAIN_ID = 1; - uint256 constant DEVNET_GUARDIAN_PK = - 0xcfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0; - WormholeSimulator guardian; uint256 initialBlockTimestamp; WormholeTransceiver wormholeTransceiverChain1; @@ -51,14 +51,14 @@ contract TestAdditionalPayload is Test { address userC = address(0x789); address userD = address(0xABC); - IWormhole wormhole = IWormhole(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); + ICoreBridge wormhole = ICoreBridge(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); function setUp() public { string memory url = "https://ethereum-sepolia-rpc.publicnode.com"; vm.createSelectFork(url); initialBlockTimestamp = vm.getBlockTimestamp(); - guardian = new WormholeSimulator(address(wormhole), DEVNET_GUARDIAN_PK); + WormholeOverride.setUpOverride(wormhole); vm.chainId(chainId1); DummyToken t1 = new DummyToken(); @@ -190,12 +190,8 @@ contract TestAdditionalPayload is Test { } assertEq(sentAP, expectedAP); - // Get and sign the log to go down the other pipe. Thank you to whoever wrote this code in the past! - Vm.Log[] memory entries = guardian.fetchWormholeMessageFromLog(recordedLogs); - bytes[] memory encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId1); - } + // Get and sign the log to go down the other pipe. + bytes[] memory encodedVMs = _getSignedMessages(recordedLogs, chainId1); // Chain2 verification and checks vm.chainId(chainId2); @@ -228,12 +224,7 @@ contract TestAdditionalPayload is Test { assertEq(receivedAP, expectedAP); // Can't resubmit the same message twice - (IWormhole.VM memory wormholeVM,,) = wormhole.parseAndVerifyVM(encodedVMs[0]); - vm.expectRevert( - abi.encodeWithSelector( - IWormholeTransceiver.TransferAlreadyCompleted.selector, wormholeVM.hash - ) - ); + vm.expectRevert(); wormholeTransceiverChain2.receiveMessage(encodedVMs[0]); // Go back the other way from a THIRD user @@ -250,8 +241,8 @@ contract TestAdditionalPayload is Test { nttManagerChain2.transfer( sendingAmount, chainId1, - toWormholeFormat(userD), - toWormholeFormat(userC), + toUniversalAddress(userD), + toUniversalAddress(userC), false, encodeTransceiverInstruction(true) ); @@ -267,12 +258,8 @@ contract TestAdditionalPayload is Test { ); } - // Get and sign the log to go down the other pipe. Thank you to whoever wrote this code in the past! - entries = guardian.fetchWormholeMessageFromLog(vm.getRecordedLogs()); - encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId2); - } + // Get and sign the log to go down the other pipe. + encodedVMs = _getSignedMessages(vm.getRecordedLogs(), chainId2); // Chain1 verification and checks with the receiving of the message vm.chainId(chainId1); @@ -306,4 +293,17 @@ contract TestAdditionalPayload is Test { TransceiverInstructions[0] = TransceiverInstruction; return TransceiverStructs.encodeTransceiverInstructions(TransceiverInstructions); } + + function _getSignedMessages( + Vm.Log[] memory logs, + uint16 emitterChainId + ) internal view returns (bytes[] memory) { + PublishedMessage[] memory msgs = WormholeOverride.fetchPublishedMessages(wormhole, logs); + bytes[] memory encodedVMs = new bytes[](msgs.length); + for (uint256 i = 0; i < msgs.length; i++) { + msgs[i].envelope.emitterChainId = emitterChainId; + encodedVMs[i] = VaaLib.encode(WormholeOverride.sign(wormhole, msgs[i])); + } + return encodedVMs; + } } diff --git a/evm/test/IntegrationCustomConsistency.t.sol b/evm/test/IntegrationCustomConsistency.t.sol index 8f29a4c12..ab3cfd175 100644 --- a/evm/test/IntegrationCustomConsistency.t.sol +++ b/evm/test/IntegrationCustomConsistency.t.sol @@ -10,20 +10,24 @@ import "../src/interfaces/IRateLimiter.sol"; import "../src/interfaces/ITransceiver.sol"; import "../src/interfaces/IManagerBase.sol"; import "../src/interfaces/IRateLimiterEvents.sol"; -import "../src/interfaces/ICustomConsistencyLevel.sol"; +import {ICustomConsistencyLevel} from "wormhole-sdk/interfaces/ICustomConsistencyLevel.sol"; import {Utils} from "./libraries/Utils.sol"; import {DummyToken, DummyTokenMintAndBurn} from "./NttManager.t.sol"; import "../src/interfaces/IWormholeTransceiver.sol"; import {WormholeTransceiver} from "../src/Transceiver/WormholeTransceiver/WormholeTransceiver.sol"; import "../src/libraries/TransceiverStructs.sol"; -import "../src/libraries/ConfigMakers.sol"; +import {CustomConsistencyLib} from "wormhole-sdk/libraries/CustomConsistency.sol"; import "./mocks/MockNttManager.sol"; import "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol"; -import "wormhole-solidity-sdk/interfaces/IWormhole.sol"; -import "wormhole-solidity-sdk/testing/helpers/WormholeSimulator.sol"; -import "wormhole-solidity-sdk/Utils.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; +import { + WormholeOverride, + AdvancedWormholeOverride +} from "wormhole-sdk/testing/WormholeOverride.sol"; +import {VaaLib, Vaa, VaaBody as PublishedMessage} from "wormhole-sdk/libraries/VaaLib.sol"; +import "wormhole-sdk/Utils.sol"; contract TestCustomConsistencySepolia is Test, IRateLimiterEvents { NttManager nttManagerChain1; @@ -39,9 +43,6 @@ contract TestCustomConsistencySepolia is Test, IRateLimiterEvents { uint16 constant ADDTL_BLOCKS = 5; uint256 constant GAS_LIMIT = 500000; - uint256 constant DEVNET_GUARDIAN_PK = - 0xcfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0; - WormholeSimulator guardian; uint256 initialBlockTimestamp; WormholeTransceiver wormholeTransceiverChain1; @@ -51,7 +52,7 @@ contract TestCustomConsistencySepolia is Test, IRateLimiterEvents { // Testnet addresses // Ethereum Sepolia Wormhole: https://wormhole.com/docs/products/reference/chain-ids/ - IWormhole wormhole = IWormhole(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); + ICoreBridge wormhole = ICoreBridge(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); address customConsistencyLevelAddress = 0x6A4B4A882F5F0a447078b4Fd0b4B571A82371ec2; function setUp() public { @@ -59,7 +60,7 @@ contract TestCustomConsistencySepolia is Test, IRateLimiterEvents { vm.createSelectFork(url); initialBlockTimestamp = vm.getBlockTimestamp(); - guardian = new WormholeSimulator(address(wormhole), DEVNET_GUARDIAN_PK); + WormholeOverride.setUpOverride(wormhole); vm.chainId(chainId1); DummyToken t1 = new DummyToken(); @@ -103,7 +104,7 @@ contract TestCustomConsistencySepolia is Test, IRateLimiterEvents { require( emitterAddr == address(wormholeTransceiverChain1), "Wrong emitter address" ); - bytes32 expectedConfig = ConfigMakers.makeAdditionalBlocksConfig( + bytes32 expectedConfig = CustomConsistencyLib.encodeAdditionalBlocksConfig( BASE_CONSISTENCY_LEVEL, ADDTL_BLOCKS ); require(configData == expectedConfig, "Wrong config data"); @@ -172,7 +173,7 @@ contract TestCustomConsistencySepolia is Test, IRateLimiterEvents { // Verify CCL configuration was set during initialization bytes32 expectedConfig = - ConfigMakers.makeAdditionalBlocksConfig(BASE_CONSISTENCY_LEVEL, ADDTL_BLOCKS); + CustomConsistencyLib.encodeAdditionalBlocksConfig(BASE_CONSISTENCY_LEVEL, ADDTL_BLOCKS); bytes32 actualConfig = ICustomConsistencyLevel(customConsistencyLevelAddress) .getConfiguration(address(wormholeTransceiverChain1)); require(actualConfig == expectedConfig, "CCL configuration not set correctly"); @@ -222,11 +223,7 @@ contract TestCustomConsistencySepolia is Test, IRateLimiterEvents { require(sentEventDigest != bytes32(0), "TransferSent(bytes32) event should be found"); // Get and sign the log to go to chain2 - Vm.Log[] memory entries = guardian.fetchWormholeMessageFromLog(recordedLogs); - bytes[] memory encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId1); - } + bytes[] memory encodedVMs = _getSignedMessages(recordedLogs, chainId1); // Chain2 verification and checks vm.chainId(chainId2); @@ -303,4 +300,17 @@ contract TestCustomConsistencySepolia is Test, IRateLimiterEvents { .getConfiguration(address(testTransceiver)); require(config == bytes32(0), "CCL should not be configured for regular consistency"); } + + function _getSignedMessages( + Vm.Log[] memory logs, + uint16 emitterChainId + ) internal view returns (bytes[] memory) { + PublishedMessage[] memory msgs = WormholeOverride.fetchPublishedMessages(wormhole, logs); + bytes[] memory encodedVMs = new bytes[](msgs.length); + for (uint256 i = 0; i < msgs.length; i++) { + msgs[i].envelope.emitterChainId = emitterChainId; + encodedVMs[i] = VaaLib.encode(WormholeOverride.sign(wormhole, msgs[i])); + } + return encodedVMs; + } } diff --git a/evm/test/IntegrationStandalone.t.sol b/evm/test/IntegrationStandalone.t.sol index cc94d491b..48cf43b40 100755 --- a/evm/test/IntegrationStandalone.t.sol +++ b/evm/test/IntegrationStandalone.t.sol @@ -21,10 +21,13 @@ import "./mocks/MockTransceivers.sol"; import "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol"; -import "wormhole-solidity-sdk/interfaces/IWormhole.sol"; -import "wormhole-solidity-sdk/testing/helpers/WormholeSimulator.sol"; -import "wormhole-solidity-sdk/Utils.sol"; -//import "wormhole-solidity-sdk/testing/WormholeRelayerTest.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; +import { + WormholeOverride, + AdvancedWormholeOverride +} from "wormhole-sdk/testing/WormholeOverride.sol"; +import {VaaLib, Vaa, VaaBody as PublishedMessage} from "wormhole-sdk/libraries/VaaLib.sol"; +import "wormhole-sdk/Utils.sol"; contract TestEndToEndBase is Test, IRateLimiterEvents { NttManager nttManagerChain1; @@ -39,9 +42,6 @@ contract TestEndToEndBase is Test, IRateLimiterEvents { uint256 constant GAS_LIMIT = 500000; uint16 constant SENDING_CHAIN_ID = 1; - uint256 constant DEVNET_GUARDIAN_PK = - 0xcfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0; - WormholeSimulator guardian; uint256 initialBlockTimestamp; WormholeTransceiver wormholeTransceiverChain1; @@ -51,14 +51,14 @@ contract TestEndToEndBase is Test, IRateLimiterEvents { address userC = address(0x789); address userD = address(0xABC); - IWormhole wormhole = IWormhole(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); + ICoreBridge wormhole = ICoreBridge(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); function setUp() public { string memory url = "https://ethereum-sepolia-rpc.publicnode.com"; vm.createSelectFork(url); initialBlockTimestamp = vm.getBlockTimestamp(); - guardian = new WormholeSimulator(address(wormhole), DEVNET_GUARDIAN_PK); + WormholeOverride.setUpOverride(wormhole); vm.chainId(chainId1); DummyToken t1 = new DummyToken(); @@ -184,12 +184,8 @@ contract TestEndToEndBase is Test, IRateLimiterEvents { } require(sentEventDigest != bytes32(0), "TransferSent(bytes32) event should be found"); - // Get and sign the log to go down the other pipe. Thank you to whoever wrote this code in the past! - Vm.Log[] memory entries = guardian.fetchWormholeMessageFromLog(recordedLogs); - bytes[] memory encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId1); - } + // Get and sign the log to go down the other pipe. + bytes[] memory encodedVMs = _getSignedMessages(recordedLogs, chainId1); // Chain2 verification and checks vm.chainId(chainId2); @@ -224,12 +220,7 @@ contract TestEndToEndBase is Test, IRateLimiterEvents { ); // Can't resubmit the same message twice - (IWormhole.VM memory wormholeVM,,) = wormhole.parseAndVerifyVM(encodedVMs[0]); - vm.expectRevert( - abi.encodeWithSelector( - IWormholeTransceiver.TransferAlreadyCompleted.selector, wormholeVM.hash - ) - ); + vm.expectRevert(); wormholeTransceiverChain2.receiveMessage(encodedVMs[0]); // Go back the other way from a THIRD user @@ -246,8 +237,8 @@ contract TestEndToEndBase is Test, IRateLimiterEvents { nttManagerChain2.transfer( sendingAmount, chainId1, - toWormholeFormat(userD), - toWormholeFormat(userC), + toUniversalAddress(userD), + toUniversalAddress(userC), false, encodeTransceiverInstruction(true) ); @@ -263,12 +254,8 @@ contract TestEndToEndBase is Test, IRateLimiterEvents { ); } - // Get and sign the log to go down the other pipe. Thank you to whoever wrote this code in the past! - entries = guardian.fetchWormholeMessageFromLog(vm.getRecordedLogs()); - encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId2); - } + // Get and sign the log to go down the other pipe. + encodedVMs = _getSignedMessages(vm.getRecordedLogs(), chainId2); // Chain1 verification and checks with the receiving of the message vm.chainId(chainId1); @@ -308,8 +295,8 @@ contract TestEndToEndBase is Test, IRateLimiterEvents { nttManagerChain1.transfer( sendingAmount, chainId2, - toWormholeFormat(userB), - toWormholeFormat(userA), + toUniversalAddress(userB), + toUniversalAddress(userA), true, encodeTransceiverInstruction(true) ); @@ -329,12 +316,8 @@ contract TestEndToEndBase is Test, IRateLimiterEvents { vm.stopPrank(); - // Get and sign the log to go down the other pipe. Thank you to whoever wrote this code in the past! - Vm.Log[] memory entries = guardian.fetchWormholeMessageFromLog(vm.getRecordedLogs()); - bytes[] memory encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId1); - } + // Get and sign the log to go down the other pipe. + bytes[] memory encodedVMs = _getSignedMessages(vm.getRecordedLogs(), chainId1); vm.expectRevert( abi.encodeWithSelector( @@ -359,12 +342,7 @@ contract TestEndToEndBase is Test, IRateLimiterEvents { } // Can't resubmit the same message twice - (IWormhole.VM memory wormholeVM,,) = wormhole.parseAndVerifyVM(encodedVMs[0]); - vm.expectRevert( - abi.encodeWithSelector( - IWormholeTransceiver.TransferAlreadyCompleted.selector, wormholeVM.hash - ) - ); + vm.expectRevert(); wormholeTransceiverChain2.receiveMessage(encodedVMs[0]); // Go back the other way from a THIRD user @@ -386,8 +364,8 @@ contract TestEndToEndBase is Test, IRateLimiterEvents { nttManagerChain2.transfer( sendingAmount, chainId1, - toWormholeFormat(userD), - toWormholeFormat(userC), + toUniversalAddress(userD), + toUniversalAddress(userC), true, encodeTransceiverInstruction(true) ); @@ -438,12 +416,8 @@ contract TestEndToEndBase is Test, IRateLimiterEvents { ); } - // Get and sign the log to go down the other pipe. Thank you to whoever wrote this code in the past! - entries = guardian.fetchWormholeMessageFromLog(vm.getRecordedLogs()); - encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId2); - } + // Get and sign the log to go down the other pipe. + encodedVMs = _getSignedMessages(vm.getRecordedLogs(), chainId2); // Chain1 verification and checks with the receiving of the message vm.chainId(chainId1); @@ -541,19 +515,15 @@ contract TestEndToEndBase is Test, IRateLimiterEvents { nttManagerChain1.transfer( sendingAmount, chainId2, - toWormholeFormat(userB), - toWormholeFormat(userA), + toUniversalAddress(userB), + toUniversalAddress(userA), false, encodeTransceiverInstructions(true) ); } // Get and sign the event emissions to go to the other chain. - Vm.Log[] memory entries = guardian.fetchWormholeMessageFromLog(vm.getRecordedLogs()); - bytes[] memory encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId1); - } + bytes[] memory encodedVMs = _getSignedMessages(vm.getRecordedLogs(), chainId1); vm.chainId(chainId2); @@ -599,8 +569,8 @@ contract TestEndToEndBase is Test, IRateLimiterEvents { nttManagerChain2.transfer( sendingAmount, chainId1, - toWormholeFormat(userA), - toWormholeFormat(userB), + toUniversalAddress(userA), + toUniversalAddress(userB), false, encodeTransceiverInstructions(true) ); @@ -612,11 +582,7 @@ contract TestEndToEndBase is Test, IRateLimiterEvents { } // Get the VAA proof for the transfers to use - entries = guardian.fetchWormholeMessageFromLog(vm.getRecordedLogs()); - encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId2); - } + encodedVMs = _getSignedMessages(vm.getRecordedLogs(), chainId2); vm.chainId(chainId1); { @@ -700,4 +666,17 @@ contract TestEndToEndBase is Test, IRateLimiterEvents { return TransceiverStructs.encodeTransceiverInstructions(TransceiverInstructions); } + + function _getSignedMessages( + Vm.Log[] memory logs, + uint16 emitterChainId + ) internal view returns (bytes[] memory) { + PublishedMessage[] memory msgs = WormholeOverride.fetchPublishedMessages(wormhole, logs); + bytes[] memory encodedVMs = new bytes[](msgs.length); + for (uint256 i = 0; i < msgs.length; i++) { + msgs[i].envelope.emitterChainId = emitterChainId; + encodedVMs[i] = VaaLib.encode(WormholeOverride.sign(wormhole, msgs[i])); + } + return encodedVMs; + } } diff --git a/evm/test/IntegrationWithoutRateLimiting.t.sol b/evm/test/IntegrationWithoutRateLimiting.t.sol index cdf0adf79..6fc171d02 100755 --- a/evm/test/IntegrationWithoutRateLimiting.t.sol +++ b/evm/test/IntegrationWithoutRateLimiting.t.sol @@ -21,10 +21,13 @@ import "./mocks/MockTransceivers.sol"; import "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol"; -import "wormhole-solidity-sdk/interfaces/IWormhole.sol"; -import "wormhole-solidity-sdk/testing/helpers/WormholeSimulator.sol"; -import "wormhole-solidity-sdk/Utils.sol"; -//import "wormhole-solidity-sdk/testing/WormholeRelayerTest.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; +import { + WormholeOverride, + AdvancedWormholeOverride +} from "wormhole-sdk/testing/WormholeOverride.sol"; +import {VaaLib, Vaa, VaaBody as PublishedMessage} from "wormhole-sdk/libraries/VaaLib.sol"; +import "wormhole-sdk/Utils.sol"; contract TestEndToEndNoRateLimiting is Test { NttManagerNoRateLimiting nttManagerChain1; @@ -39,9 +42,6 @@ contract TestEndToEndNoRateLimiting is Test { uint256 constant GAS_LIMIT = 500000; uint16 constant SENDING_CHAIN_ID = 1; - uint256 constant DEVNET_GUARDIAN_PK = - 0xcfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0; - WormholeSimulator guardian; uint256 initialBlockTimestamp; WormholeTransceiver wormholeTransceiverChain1; @@ -51,14 +51,14 @@ contract TestEndToEndNoRateLimiting is Test { address userC = address(0x789); address userD = address(0xABC); - IWormhole wormhole = IWormhole(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); + ICoreBridge wormhole = ICoreBridge(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); function setUp() public { string memory url = "https://ethereum-sepolia-rpc.publicnode.com"; vm.createSelectFork(url); initialBlockTimestamp = vm.getBlockTimestamp(); - guardian = new WormholeSimulator(address(wormhole), DEVNET_GUARDIAN_PK); + WormholeOverride.setUpOverride(wormhole); vm.chainId(chainId1); DummyToken t1 = new DummyToken(); @@ -178,12 +178,8 @@ contract TestEndToEndNoRateLimiting is Test { vm.stopPrank(); - // Get and sign the log to go down the other pipe. Thank you to whoever wrote this code in the past! - Vm.Log[] memory entries = guardian.fetchWormholeMessageFromLog(vm.getRecordedLogs()); - bytes[] memory encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId1); - } + // Get and sign the log to go down the other pipe. + bytes[] memory encodedVMs = _getSignedMessages(vm.getRecordedLogs(), chainId1); // Chain2 verification and checks vm.chainId(chainId2); @@ -205,12 +201,7 @@ contract TestEndToEndNoRateLimiting is Test { } // Can't resubmit the same message twice - (IWormhole.VM memory wormholeVM,,) = wormhole.parseAndVerifyVM(encodedVMs[0]); - vm.expectRevert( - abi.encodeWithSelector( - IWormholeTransceiver.TransferAlreadyCompleted.selector, wormholeVM.hash - ) - ); + vm.expectRevert(); wormholeTransceiverChain2.receiveMessage(encodedVMs[0]); // Go back the other way from a THIRD user @@ -227,8 +218,8 @@ contract TestEndToEndNoRateLimiting is Test { nttManagerChain2.transfer( sendingAmount, chainId1, - toWormholeFormat(userD), - toWormholeFormat(userC), + toUniversalAddress(userD), + toUniversalAddress(userC), false, encodeTransceiverInstruction(true) ); @@ -244,12 +235,8 @@ contract TestEndToEndNoRateLimiting is Test { ); } - // Get and sign the log to go down the other pipe. Thank you to whoever wrote this code in the past! - entries = guardian.fetchWormholeMessageFromLog(vm.getRecordedLogs()); - encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId2); - } + // Get and sign the log to go down the other pipe. + encodedVMs = _getSignedMessages(vm.getRecordedLogs(), chainId2); // Chain1 verification and checks with the receiving of the message vm.chainId(chainId1); @@ -340,8 +327,8 @@ contract TestEndToEndNoRateLimiting is Test { nttManagerChain1.transfer( sendingAmount, chainId2, - toWormholeFormat(userB), - toWormholeFormat(userA), + toUniversalAddress(userB), + toUniversalAddress(userA), true, encodeTransceiverInstruction(true) ); @@ -361,12 +348,8 @@ contract TestEndToEndNoRateLimiting is Test { vm.stopPrank(); - // Get and sign the log to go down the other pipe. Thank you to whoever wrote this code in the past! - Vm.Log[] memory entries = guardian.fetchWormholeMessageFromLog(vm.getRecordedLogs()); - bytes[] memory encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId1); - } + // Get and sign the log to go down the other pipe. + bytes[] memory encodedVMs = _getSignedMessages(vm.getRecordedLogs(), chainId1); vm.expectRevert( abi.encodeWithSelector( @@ -392,12 +375,7 @@ contract TestEndToEndNoRateLimiting is Test { } // Can't resubmit the same message twice - (IWormhole.VM memory wormholeVM,,) = wormhole.parseAndVerifyVM(encodedVMs[0]); - vm.expectRevert( - abi.encodeWithSelector( - IWormholeTransceiver.TransferAlreadyCompleted.selector, wormholeVM.hash - ) - ); + vm.expectRevert(); wormholeTransceiverChain2.receiveMessage(encodedVMs[0]); // Go back the other way from a THIRD user @@ -419,8 +397,8 @@ contract TestEndToEndNoRateLimiting is Test { nttManagerChain2.transfer( sendingAmount, chainId1, - toWormholeFormat(userD), - toWormholeFormat(userC), + toUniversalAddress(userD), + toUniversalAddress(userC), true, encodeTransceiverInstruction(true) ); @@ -436,12 +414,8 @@ contract TestEndToEndNoRateLimiting is Test { ); } - // Get and sign the log to go down the other pipe. Thank you to whoever wrote this code in the past! - entries = guardian.fetchWormholeMessageFromLog(vm.getRecordedLogs()); - encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId2); - } + // Get and sign the log to go down the other pipe. + encodedVMs = _getSignedMessages(vm.getRecordedLogs(), chainId2); // Chain1 verification and checks with the receiving of the message vm.chainId(chainId1); @@ -529,19 +503,15 @@ contract TestEndToEndNoRateLimiting is Test { nttManagerChain1.transfer( sendingAmount, chainId2, - toWormholeFormat(userB), - toWormholeFormat(userA), + toUniversalAddress(userB), + toUniversalAddress(userA), false, encodeTransceiverInstructions(true) ); } // Get and sign the event emissions to go to the other chain. - Vm.Log[] memory entries = guardian.fetchWormholeMessageFromLog(vm.getRecordedLogs()); - bytes[] memory encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId1); - } + bytes[] memory encodedVMs = _getSignedMessages(vm.getRecordedLogs(), chainId1); vm.chainId(chainId2); @@ -588,8 +558,8 @@ contract TestEndToEndNoRateLimiting is Test { nttManagerChain2.transfer( sendingAmount, chainId1, - toWormholeFormat(userA), - toWormholeFormat(userB), + toUniversalAddress(userA), + toUniversalAddress(userB), false, encodeTransceiverInstructions(true) ); @@ -604,11 +574,7 @@ contract TestEndToEndNoRateLimiting is Test { } // Get the VAA proof for the transfers to use - entries = guardian.fetchWormholeMessageFromLog(vm.getRecordedLogs()); - encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId2); - } + encodedVMs = _getSignedMessages(vm.getRecordedLogs(), chainId2); vm.chainId(chainId1); { @@ -692,4 +658,17 @@ contract TestEndToEndNoRateLimiting is Test { return TransceiverStructs.encodeTransceiverInstructions(TransceiverInstructions); } + + function _getSignedMessages( + Vm.Log[] memory logs, + uint16 emitterChainId + ) internal view returns (bytes[] memory) { + PublishedMessage[] memory msgs = WormholeOverride.fetchPublishedMessages(wormhole, logs); + bytes[] memory encodedVMs = new bytes[](msgs.length); + for (uint256 i = 0; i < msgs.length; i++) { + msgs[i].envelope.emitterChainId = emitterChainId; + encodedVMs[i] = VaaLib.encode(WormholeOverride.sign(wormhole, msgs[i])); + } + return encodedVMs; + } } diff --git a/evm/test/NttManager.t.sol b/evm/test/NttManager.t.sol index cb8e3acc9..4a7317808 100644 --- a/evm/test/NttManager.t.sol +++ b/evm/test/NttManager.t.sol @@ -16,9 +16,13 @@ import {Utils} from "./libraries/Utils.sol"; import "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol"; -import "wormhole-solidity-sdk/interfaces/IWormhole.sol"; -import "wormhole-solidity-sdk/testing/helpers/WormholeSimulator.sol"; -import "wormhole-solidity-sdk/Utils.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; +import { + WormholeOverride, + AdvancedWormholeOverride +} from "wormhole-sdk/testing/WormholeOverride.sol"; +import {VaaLib, Vaa, VaaBody as PublishedMessage} from "wormhole-sdk/libraries/VaaLib.sol"; +import "wormhole-sdk/Utils.sol"; import "./libraries/TransceiverHelpers.sol"; import "./libraries/NttManagerHelpers.sol"; import "./interfaces/ITransceiverReceiver.sol"; @@ -40,19 +44,18 @@ contract TestNttManager is Test, IRateLimiterEvents { // 0x99'E''T''T' uint16 constant chainId = 7; uint16 constant chainId2 = 8; - uint256 constant DEVNET_GUARDIAN_PK = - 0xcfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0; - WormholeSimulator guardian; uint256 initialBlockTimestamp; + uint256 cachedEvmChainId; DummyTransceiver dummyTransceiver; function setUp() public { string memory url = "https://ethereum-sepolia-rpc.publicnode.com"; - IWormhole wormhole = IWormhole(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); + ICoreBridge wormhole = ICoreBridge(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); vm.createSelectFork(url); initialBlockTimestamp = vm.getBlockTimestamp(); + cachedEvmChainId = block.chainid; - guardian = new WormholeSimulator(address(wormhole), DEVNET_GUARDIAN_PK); + WormholeOverride.setUpOverride(wormhole); DummyToken t = new DummyToken(); NttManager implementation = new MockNttManagerContract( @@ -116,7 +119,7 @@ contract TestNttManager is Test, IRateLimiterEvents { uint8 decimals = t.decimals(); nttManagerZeroRateLimiter.setPeer( - chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max + chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max ); t.mintDummy(address(user_A), 5 * 10 ** decimals); @@ -126,13 +129,13 @@ contract TestNttManager is Test, IRateLimiterEvents { t.approve(address(nttManagerZeroRateLimiter), 3 * 10 ** decimals); uint64 s1 = nttManagerZeroRateLimiter.transfer( - 1 * 10 ** decimals, chainId2, toWormholeFormat(user_B) + 1 * 10 ** decimals, chainId2, toUniversalAddress(user_B) ); uint64 s2 = nttManagerZeroRateLimiter.transfer( - 1 * 10 ** decimals, chainId2, toWormholeFormat(user_B) + 1 * 10 ** decimals, chainId2, toUniversalAddress(user_B) ); uint64 s3 = nttManagerZeroRateLimiter.transfer( - 1 * 10 ** decimals, chainId2, toWormholeFormat(user_B) + 1 * 10 ** decimals, chainId2, toUniversalAddress(user_B) ); vm.stopPrank(); @@ -145,7 +148,7 @@ contract TestNttManager is Test, IRateLimiterEvents { nttManagerZeroRateLimiter.setThreshold(2); // register nttManager peer - bytes32 peer = toWormholeFormat(address(nttManager)); + bytes32 peer = toUniversalAddress(address(nttManager)); nttManagerZeroRateLimiter.setPeer( TransceiverHelpersLib.SENDING_CHAIN_ID, peer, 9, type(uint64).max ); @@ -157,7 +160,7 @@ contract TestNttManager is Test, IRateLimiterEvents { 0, bytes32(0), peer, - toWormholeFormat(address(nttManagerZeroRateLimiter)), + toUniversalAddress(address(nttManagerZeroRateLimiter)), abi.encode("payload") ); @@ -224,8 +227,8 @@ contract TestNttManager is Test, IRateLimiterEvents { (, transceiverMessage) = TransceiverHelpersLib.buildTransceiverMessageWithNttManagerPayload( 0, bytes32(0), - toWormholeFormat(address(nttManagerOther)), - toWormholeFormat(address(nttManager)), + toUniversalAddress(address(nttManagerOther)), + toUniversalAddress(address(nttManager)), abi.encode("payload") ); vm.expectRevert( @@ -367,7 +370,7 @@ contract TestNttManager is Test, IRateLimiterEvents { uint8 decimals = token.decimals(); - newNttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max); + newNttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max); newNttManager.setOutboundLimit(packTrimmedAmount(type(uint64).max, 8).untrim(decimals)); token.mintDummy(address(user_A), 5 * 10 ** decimals); @@ -380,8 +383,8 @@ contract TestNttManager is Test, IRateLimiterEvents { newNttManager.transfer( 1 * 10 ** decimals, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -429,7 +432,7 @@ contract TestNttManager is Test, IRateLimiterEvents { uint8 decimals = token.decimals(); - nttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max); + nttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max); nttManager.setOutboundLimit(packTrimmedAmount(type(uint64).max, 8).untrim(decimals)); token.mintDummy(address(user_A), 5 * 10 ** decimals); @@ -450,8 +453,8 @@ contract TestNttManager is Test, IRateLimiterEvents { nttManager.transfer( 1 * 10 ** decimals, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, instructions ); @@ -465,7 +468,7 @@ contract TestNttManager is Test, IRateLimiterEvents { uint8 decimals = token.decimals(); - nttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max); + nttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max); nttManager.setOutboundLimit(0); token.mintDummy(address(user_A), 5 * 10 ** decimals); @@ -480,8 +483,8 @@ contract TestNttManager is Test, IRateLimiterEvents { uint64 s1 = nttManager.transfer( 1 * 10 ** decimals, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), true, new bytes(1) ); @@ -517,8 +520,8 @@ contract TestNttManager is Test, IRateLimiterEvents { uint64 s2 = nttManager.transfer( 1 * 10 ** decimals, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), true, new bytes(1) ); @@ -566,7 +569,7 @@ contract TestNttManager is Test, IRateLimiterEvents { // == threshold function test_peerRegistrationLimitsCanBeUpdated() public { - bytes32 peer = toWormholeFormat(address(nttManager)); + bytes32 peer = toUniversalAddress(address(nttManager)); nttManager.setPeer(TransceiverHelpersLib.SENDING_CHAIN_ID, peer, 9, 0); IRateLimiter.RateLimitParams memory params = @@ -585,12 +588,12 @@ contract TestNttManager is Test, IRateLimiterEvents { function test_onlyEnabledTransceiversCanAttest() public { (DummyTransceiver e1,) = TransceiverHelpersLib.setup_transceivers(nttManagerOther); nttManagerOther.removeTransceiver(address(e1)); - bytes32 peer = toWormholeFormat(address(nttManager)); + bytes32 peer = toUniversalAddress(address(nttManager)); nttManagerOther.setPeer(TransceiverHelpersLib.SENDING_CHAIN_ID, peer, 9, type(uint64).max); bytes memory transceiverMessage; (, transceiverMessage) = TransceiverHelpersLib.buildTransceiverMessageWithNttManagerPayload( - 0, bytes32(0), peer, toWormholeFormat(address(nttManagerOther)), abi.encode("payload") + 0, bytes32(0), peer, toUniversalAddress(address(nttManagerOther)), abi.encode("payload") ); vm.expectRevert( @@ -603,7 +606,7 @@ contract TestNttManager is Test, IRateLimiterEvents { (DummyTransceiver e1,) = TransceiverHelpersLib.setup_transceivers(nttManagerOther); nttManagerOther.setThreshold(2); - bytes32 peer = toWormholeFormat(address(nttManager)); + bytes32 peer = toUniversalAddress(address(nttManager)); TransceiverStructs.NttManagerMessage memory nttManagerMessage; bytes memory transceiverMessage; @@ -612,7 +615,7 @@ contract TestNttManager is Test, IRateLimiterEvents { 0, bytes32(0), peer, - toWormholeFormat(address(nttManagerOther)), + toUniversalAddress(address(nttManagerOther)), abi.encode("payload") ); @@ -629,7 +632,7 @@ contract TestNttManager is Test, IRateLimiterEvents { nttManagerOther.setThreshold(2); // register nttManager peer - bytes32 peer = toWormholeFormat(address(nttManager)); + bytes32 peer = toUniversalAddress(address(nttManager)); nttManagerOther.setPeer(TransceiverHelpersLib.SENDING_CHAIN_ID, peer, 9, type(uint64).max); TransceiverStructs.NttManagerMessage memory nttManagerMessage; @@ -639,7 +642,7 @@ contract TestNttManager is Test, IRateLimiterEvents { 0, bytes32(0), peer, - toWormholeFormat(address(nttManagerOther)), + toUniversalAddress(address(nttManagerOther)), abi.encode("payload") ); @@ -656,7 +659,7 @@ contract TestNttManager is Test, IRateLimiterEvents { nttManagerOther.setThreshold(2); // register nttManager peer - bytes32 peer = toWormholeFormat(address(nttManager)); + bytes32 peer = toUniversalAddress(address(nttManager)); nttManagerOther.setPeer(TransceiverHelpersLib.SENDING_CHAIN_ID, peer, 9, type(uint64).max); TransceiverStructs.NttManagerMessage memory nttManagerMessage; @@ -666,7 +669,7 @@ contract TestNttManager is Test, IRateLimiterEvents { 0, bytes32(0), peer, - toWormholeFormat(address(nttManagerOther)), + toUniversalAddress(address(nttManagerOther)), abi.encode("payload") ); @@ -688,7 +691,7 @@ contract TestNttManager is Test, IRateLimiterEvents { (DummyTransceiver e1,) = TransceiverHelpersLib.setup_transceivers(nttManagerOther); nttManagerOther.setThreshold(2); - bytes32 peer = toWormholeFormat(address(nttManager)); + bytes32 peer = toUniversalAddress(address(nttManager)); nttManagerOther.setPeer(TransceiverHelpersLib.SENDING_CHAIN_ID, peer, 9, type(uint64).max); ITransceiverReceiver[] memory transceivers = new ITransceiverReceiver[](1); @@ -726,7 +729,7 @@ contract TestNttManager is Test, IRateLimiterEvents { uint8 decimals = token.decimals(); - nttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max); + nttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max); nttManager.setOutboundLimit(packTrimmedAmount(type(uint64).max, 8).untrim(decimals)); token.mintDummy(address(user_A), 5 * 10 ** decimals); @@ -738,24 +741,24 @@ contract TestNttManager is Test, IRateLimiterEvents { uint64 s1 = nttManager.transfer( 1 * 10 ** decimals, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); uint64 s2 = nttManager.transfer( 1 * 10 ** decimals, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); uint64 s3 = nttManager.transfer( 1 * 10 ** decimals, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -767,7 +770,7 @@ contract TestNttManager is Test, IRateLimiterEvents { function test_transferWithAmountAndDecimalsThatCouldOverflow() public { // The source chain has 18 decimals trimmed to 8, and the peer has 6 decimals trimmed to 6 - nttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 6, type(uint64).max); + nttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 6, type(uint64).max); address user_A = address(0x123); address user_B = address(0x456); @@ -790,8 +793,8 @@ contract TestNttManager is Test, IRateLimiterEvents { nttManager.transfer( amount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -801,8 +804,8 @@ contract TestNttManager is Test, IRateLimiterEvents { nttManager.transfer( amount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -858,7 +861,12 @@ contract TestNttManager is Test, IRateLimiterEvents { } function test_transfersOnForkedChains() public { - uint256 evmChainId = block.chainid; + // NOTE: We use the state variable cachedEvmChainId (set in setUp) instead of a local + // `uint256 evmChainId = block.chainid` because the via_ir Yul optimizer treats the + // CHAINID opcode as a pure/movable expression and may substitute a stale value after + // vm.chainId() changes block.chainid mid-function. + // See: https://github.com/foundry-rs/foundry/issues/1373 + uint256 evmChainId = cachedEvmChainId; address user_A = address(0x123); address user_B = address(0x456); @@ -869,7 +877,7 @@ contract TestNttManager is Test, IRateLimiterEvents { nttManager.setPeer( TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(address(nttManagerOther)), + toUniversalAddress(address(nttManagerOther)), 9, type(uint64).max ); @@ -884,8 +892,8 @@ contract TestNttManager is Test, IRateLimiterEvents { uint64 sequence = nttManager.transfer( 1 * 10 ** decimals, TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), true, new bytes(1) ); @@ -907,8 +915,8 @@ contract TestNttManager is Test, IRateLimiterEvents { nttManager.transfer( 1 * 10 ** decimals, TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), true, new bytes(1) ); @@ -921,8 +929,8 @@ contract TestNttManager is Test, IRateLimiterEvents { nttManager.transfer( 1 * 10 ** decimals, TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -932,8 +940,8 @@ contract TestNttManager is Test, IRateLimiterEvents { bytes memory tokenTransferMessage = TransceiverStructs.encodeNativeTokenTransfer( TransceiverStructs.NativeTokenTransfer({ amount: packTrimmedAmount(100, 8), - sourceToken: toWormholeFormat(address(token)), - to: toWormholeFormat(user_B), + sourceToken: toUniversalAddress(address(token)), + to: toUniversalAddress(user_B), toChain: chainId, additionalPayload: "" }) @@ -944,9 +952,9 @@ contract TestNttManager is Test, IRateLimiterEvents { (nttManagerMessage, transceiverMessage) = TransceiverHelpersLib.buildTransceiverMessageWithNttManagerPayload( 0, - toWormholeFormat(address(0x1)), - toWormholeFormat(address(nttManagerOther)), - toWormholeFormat(address(nttManager)), + toUniversalAddress(address(0x1)), + toUniversalAddress(address(nttManagerOther)), + toUniversalAddress(address(nttManager)), tokenTransferMessage ); @@ -1012,7 +1020,7 @@ contract TestNttManager is Test, IRateLimiterEvents { uint256 maxAmount = 5 * 10 ** decimals; token.mintDummy(from, maxAmount); - nttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max); + nttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max); nttManager.setOutboundLimit(packTrimmedAmount(type(uint64).max, 8).untrim(decimals)); nttManager.setInboundLimit( packTrimmedAmount(type(uint64).max, 8).untrim(decimals), @@ -1038,8 +1046,8 @@ contract TestNttManager is Test, IRateLimiterEvents { nttManager.transfer( amountWithDust, chainId2, - toWormholeFormat(to), - toWormholeFormat(from), + toUniversalAddress(to), + toUniversalAddress(from), false, new bytes(1) ); @@ -1137,7 +1145,7 @@ contract TestNttManager is Test, IRateLimiterEvents { newNttManager.initialize(); // register nttManager peer and transceiver - bytes32 peer = toWormholeFormat(address(nttManager)); + bytes32 peer = toUniversalAddress(address(nttManager)); newNttManager.setPeer(TransceiverHelpersLib.SENDING_CHAIN_ID, peer, 9, type(uint64).max); { DummyTransceiver e = new DummyTransceiver(address(newNttManager)); @@ -1154,8 +1162,8 @@ contract TestNttManager is Test, IRateLimiterEvents { newNttManager.transfer( 1 * 10 ** t.decimals(), TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -1173,15 +1181,15 @@ contract TestNttManager is Test, IRateLimiterEvents { tokenTransferMessage = TransceiverStructs.encodeNativeTokenTransfer( TransceiverStructs.NativeTokenTransfer({ amount: transferAmount, - sourceToken: toWormholeFormat(address(t)), - to: toWormholeFormat(user_B), + sourceToken: toUniversalAddress(address(t)), + to: toUniversalAddress(user_B), toChain: chainId, additionalPayload: "" }) ); (, transceiverMessage) = TransceiverHelpersLib.buildTransceiverMessageWithNttManagerPayload( - 0, bytes32(0), peer, toWormholeFormat(address(newNttManager)), tokenTransferMessage + 0, bytes32(0), peer, toUniversalAddress(address(newNttManager)), tokenTransferMessage ); e1.receiveMessage(transceiverMessage); @@ -1196,8 +1204,8 @@ contract TestNttManager is Test, IRateLimiterEvents { newNttManager.transfer( 1 * 10 ** 10, TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -1207,7 +1215,7 @@ contract TestNttManager is Test, IRateLimiterEvents { bytes32("1"), bytes32(0), peer, - toWormholeFormat(address(newNttManager)), + toUniversalAddress(address(newNttManager)), tokenTransferMessage ); e1.receiveMessage(transceiverMessage); @@ -1224,8 +1232,8 @@ contract TestNttManager is Test, IRateLimiterEvents { newNttManager.transfer( 1 * 10 ** 7, TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -1235,7 +1243,7 @@ contract TestNttManager is Test, IRateLimiterEvents { bytes32("2"), bytes32(0), peer, - toWormholeFormat(address(newNttManager)), + toUniversalAddress(address(newNttManager)), tokenTransferMessage ); vm.expectRevert(abi.encodeWithSelector(NumberOfDecimalsNotEqual.selector, 8, 7)); @@ -1258,7 +1266,7 @@ contract TestNttManager is Test, IRateLimiterEvents { uint8 decimals = token.decimals(); - nttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max); + nttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max); nttManager.setOutboundLimit(packTrimmedAmount(type(uint64).max, 8).untrim(decimals)); token.mintDummy(address(user_A), 5 * 10 ** decimals); @@ -1273,8 +1281,8 @@ contract TestNttManager is Test, IRateLimiterEvents { nttManager.transfer( 1 * 10 ** decimals, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, encodedInstructions ); diff --git a/evm/test/NttManagerNoRateLimiting.t.sol b/evm/test/NttManagerNoRateLimiting.t.sol index 892501d2b..c7872b211 100644 --- a/evm/test/NttManagerNoRateLimiting.t.sol +++ b/evm/test/NttManagerNoRateLimiting.t.sol @@ -16,9 +16,13 @@ import {Utils} from "./libraries/Utils.sol"; import "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol"; -import "wormhole-solidity-sdk/interfaces/IWormhole.sol"; -import "wormhole-solidity-sdk/testing/helpers/WormholeSimulator.sol"; -import "wormhole-solidity-sdk/Utils.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; +import { + WormholeOverride, + AdvancedWormholeOverride +} from "wormhole-sdk/testing/WormholeOverride.sol"; +import {VaaLib, Vaa, VaaBody as PublishedMessage} from "wormhole-sdk/libraries/VaaLib.sol"; +import "wormhole-sdk/Utils.sol"; import "./libraries/TransceiverHelpers.sol"; import "./libraries/NttManagerHelpers.sol"; import "./interfaces/ITransceiverReceiver.sol"; @@ -38,19 +42,18 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { // 0x99'E''T''T' uint16 constant chainId = 7; uint16 constant chainId2 = 8; - uint256 constant DEVNET_GUARDIAN_PK = - 0xcfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0; - WormholeSimulator guardian; uint256 initialBlockTimestamp; + uint256 cachedEvmChainId; DummyTransceiver dummyTransceiver; function setUp() public { string memory url = "https://ethereum-sepolia-rpc.publicnode.com"; - IWormhole wormhole = IWormhole(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); + ICoreBridge wormhole = ICoreBridge(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); vm.createSelectFork(url); initialBlockTimestamp = vm.getBlockTimestamp(); + cachedEvmChainId = block.chainid; - guardian = new WormholeSimulator(address(wormhole), DEVNET_GUARDIAN_PK); + WormholeOverride.setUpOverride(wormhole); DummyToken t = new DummyToken(); NttManagerNoRateLimiting implementation = new MockNttManagerNoRateLimitingContract( @@ -152,8 +155,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { (, transceiverMessage) = TransceiverHelpersLib.buildTransceiverMessageWithNttManagerPayload( 0, bytes32(0), - toWormholeFormat(address(nttManagerOther)), - toWormholeFormat(address(nttManager)), + toUniversalAddress(address(nttManagerOther)), + toUniversalAddress(address(nttManager)), abi.encode("payload") ); vm.expectRevert( @@ -292,7 +295,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { uint8 decimals = token.decimals(); newNttManagerNoRateLimiting.setPeer( - chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max + chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max ); newNttManagerNoRateLimiting.setOutboundLimit( packTrimmedAmount(type(uint64).max, 8).untrim(decimals) @@ -308,8 +311,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { newNttManagerNoRateLimiting.transfer( 1 * 10 ** decimals, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -357,7 +360,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { uint8 decimals = token.decimals(); - nttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max); + nttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max); nttManager.setOutboundLimit(packTrimmedAmount(type(uint64).max, 8).untrim(decimals)); token.mintDummy(address(user_A), 5 * 10 ** decimals); @@ -378,8 +381,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { nttManager.transfer( 1 * 10 ** decimals, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, instructions ); @@ -425,7 +428,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { // == threshold function test_peerRegistrationLimitsCantBeUpdated() public { - bytes32 peer = toWormholeFormat(address(nttManager)); + bytes32 peer = toUniversalAddress(address(nttManager)); nttManager.setPeer(TransceiverHelpersLib.SENDING_CHAIN_ID, peer, 9, 0); IRateLimiter.RateLimitParams memory params = @@ -444,12 +447,12 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { function test_onlyEnabledTransceiversCanAttest() public { (DummyTransceiver e1,) = TransceiverHelpersLib.setup_transceivers(nttManagerOther); nttManagerOther.removeTransceiver(address(e1)); - bytes32 peer = toWormholeFormat(address(nttManager)); + bytes32 peer = toUniversalAddress(address(nttManager)); nttManagerOther.setPeer(TransceiverHelpersLib.SENDING_CHAIN_ID, peer, 9, type(uint64).max); bytes memory transceiverMessage; (, transceiverMessage) = TransceiverHelpersLib.buildTransceiverMessageWithNttManagerPayload( - 0, bytes32(0), peer, toWormholeFormat(address(nttManagerOther)), abi.encode("payload") + 0, bytes32(0), peer, toUniversalAddress(address(nttManagerOther)), abi.encode("payload") ); vm.expectRevert( @@ -462,7 +465,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { (DummyTransceiver e1,) = TransceiverHelpersLib.setup_transceivers(nttManagerOther); nttManagerOther.setThreshold(2); - bytes32 peer = toWormholeFormat(address(nttManager)); + bytes32 peer = toUniversalAddress(address(nttManager)); TransceiverStructs.NttManagerMessage memory nttManagerMessage; bytes memory transceiverMessage; @@ -471,7 +474,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { 0, bytes32(0), peer, - toWormholeFormat(address(nttManagerOther)), + toUniversalAddress(address(nttManagerOther)), abi.encode("payload") ); @@ -488,7 +491,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { nttManagerOther.setThreshold(2); // register nttManager peer - bytes32 peer = toWormholeFormat(address(nttManager)); + bytes32 peer = toUniversalAddress(address(nttManager)); nttManagerOther.setPeer(TransceiverHelpersLib.SENDING_CHAIN_ID, peer, 9, type(uint64).max); TransceiverStructs.NttManagerMessage memory nttManagerMessage; @@ -498,7 +501,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { 0, bytes32(0), peer, - toWormholeFormat(address(nttManagerOther)), + toUniversalAddress(address(nttManagerOther)), abi.encode("payload") ); @@ -515,7 +518,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { nttManagerOther.setThreshold(2); // register nttManager peer - bytes32 peer = toWormholeFormat(address(nttManager)); + bytes32 peer = toUniversalAddress(address(nttManager)); nttManagerOther.setPeer(TransceiverHelpersLib.SENDING_CHAIN_ID, peer, 9, type(uint64).max); TransceiverStructs.NttManagerMessage memory nttManagerMessage; @@ -525,7 +528,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { 0, bytes32(0), peer, - toWormholeFormat(address(nttManagerOther)), + toUniversalAddress(address(nttManagerOther)), abi.encode("payload") ); @@ -547,7 +550,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { (DummyTransceiver e1,) = TransceiverHelpersLib.setup_transceivers(nttManagerOther); nttManagerOther.setThreshold(2); - bytes32 peer = toWormholeFormat(address(nttManager)); + bytes32 peer = toUniversalAddress(address(nttManager)); nttManagerOther.setPeer(TransceiverHelpersLib.SENDING_CHAIN_ID, peer, 9, type(uint64).max); ITransceiverReceiver[] memory transceivers = new ITransceiverReceiver[](1); @@ -585,7 +588,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { uint8 decimals = token.decimals(); - nttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max); + nttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max); nttManager.setOutboundLimit(packTrimmedAmount(type(uint64).max, 8).untrim(decimals)); token.mintDummy(address(user_A), 5 * 10 ** decimals); @@ -597,24 +600,24 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { uint64 s1 = nttManager.transfer( 1 * 10 ** decimals, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); uint64 s2 = nttManager.transfer( 1 * 10 ** decimals, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); uint64 s3 = nttManager.transfer( 1 * 10 ** decimals, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -626,7 +629,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { function test_transferWithAmountAndDecimalsThatCouldOverflow() public { // The source chain has 18 decimals trimmed to 8, and the peer has 6 decimals trimmed to 6 - nttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 6, type(uint64).max); + nttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 6, type(uint64).max); address user_A = address(0x123); address user_B = address(0x456); @@ -645,8 +648,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { nttManager.transfer( amount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -657,8 +660,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { nttManager.transfer( amount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -668,8 +671,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { nttManager.transfer( amount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -725,7 +728,12 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { } function test_transfersOnForkedChains() public { - uint256 evmChainId = block.chainid; + // NOTE: We use the state variable cachedEvmChainId (set in setUp) instead of a local + // `uint256 evmChainId = block.chainid` because the via_ir Yul optimizer treats the + // CHAINID opcode as a pure/movable expression and may substitute a stale value after + // vm.chainId() changes block.chainid mid-function. + // See: https://github.com/foundry-rs/foundry/issues/1373 + uint256 evmChainId = cachedEvmChainId; address user_A = address(0x123); address user_B = address(0x456); @@ -736,7 +744,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { nttManager.setPeer( TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(address(nttManagerOther)), + toUniversalAddress(address(nttManagerOther)), 9, type(uint64).max ); @@ -751,8 +759,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { uint64 sequence = nttManager.transfer( 1 * 10 ** decimals, TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), true, new bytes(1) ); @@ -774,8 +782,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { nttManager.transfer( 1 * 10 ** decimals, TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), true, new bytes(1) ); @@ -788,8 +796,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { nttManager.transfer( 1 * 10 ** decimals, TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -799,8 +807,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { bytes memory tokenTransferMessage = TransceiverStructs.encodeNativeTokenTransfer( TransceiverStructs.NativeTokenTransfer({ amount: packTrimmedAmount(100, 8), - sourceToken: toWormholeFormat(address(token)), - to: toWormholeFormat(user_B), + sourceToken: toUniversalAddress(address(token)), + to: toUniversalAddress(user_B), toChain: chainId, additionalPayload: "" }) @@ -811,9 +819,9 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { (nttManagerMessage, transceiverMessage) = TransceiverHelpersLib.buildTransceiverMessageWithNttManagerPayload( 0, - toWormholeFormat(address(0x1)), - toWormholeFormat(address(nttManagerOther)), - toWormholeFormat(address(nttManager)), + toUniversalAddress(address(0x1)), + toUniversalAddress(address(nttManagerOther)), + toUniversalAddress(address(nttManager)), tokenTransferMessage ); @@ -879,7 +887,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { uint256 maxAmount = 5 * 10 ** decimals; token.mintDummy(from, maxAmount); - nttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max); + nttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max); nttManager.setOutboundLimit(packTrimmedAmount(type(uint64).max, 8).untrim(decimals)); nttManager.setInboundLimit( packTrimmedAmount(type(uint64).max, 8).untrim(decimals), @@ -905,8 +913,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { nttManager.transfer( amountWithDust, chainId2, - toWormholeFormat(to), - toWormholeFormat(from), + toUniversalAddress(to), + toUniversalAddress(from), false, new bytes(1) ); @@ -1000,7 +1008,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { MockNttManagerContract(address(new ERC1967Proxy(address(implementation), ""))); thisNttManager.initialize(); - thisNttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max); + thisNttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max); // Upgrade from NttManagerNoRateLimiting to NttManager with rate limiting enabled. This should work. NttManager rateLimitingImplementation = new MockNttManagerNoRateLimitingContract( @@ -1021,7 +1029,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { MockNttManagerContract(address(new ERC1967Proxy(address(implementation), ""))); thisNttManager.initialize(); - thisNttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max); + thisNttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max); // Upgrade from NttManagerNoRateLimiting to NttManager with rate limiting enabled. The immutable check should panic. NttManager rateLimitingImplementation = new MockNttManagerNoRateLimitingContract( @@ -1050,7 +1058,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { newNttManagerNoRateLimiting.initialize(); // register nttManager peer and transceiver - bytes32 peer = toWormholeFormat(address(nttManager)); + bytes32 peer = toUniversalAddress(address(nttManager)); newNttManagerNoRateLimiting.setPeer( TransceiverHelpersLib.SENDING_CHAIN_ID, peer, 9, type(uint64).max ); @@ -1069,8 +1077,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { newNttManagerNoRateLimiting.transfer( 1 * 10 ** t.decimals(), TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -1089,8 +1097,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { tokenTransferMessage = TransceiverStructs.encodeNativeTokenTransfer( TransceiverStructs.NativeTokenTransfer({ amount: transferAmount, - sourceToken: toWormholeFormat(address(t)), - to: toWormholeFormat(user_B), + sourceToken: toUniversalAddress(address(t)), + to: toUniversalAddress(user_B), toChain: chainId, additionalPayload: "" }) @@ -1100,7 +1108,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { 0, bytes32(0), peer, - toWormholeFormat(address(newNttManagerNoRateLimiting)), + toUniversalAddress(address(newNttManagerNoRateLimiting)), tokenTransferMessage ); @@ -1116,8 +1124,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { newNttManagerNoRateLimiting.transfer( 1 * 10 ** 10, TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -1127,7 +1135,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { bytes32("1"), bytes32(0), peer, - toWormholeFormat(address(newNttManagerNoRateLimiting)), + toUniversalAddress(address(newNttManagerNoRateLimiting)), tokenTransferMessage ); e1.receiveMessage(transceiverMessage); @@ -1143,8 +1151,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { newNttManagerNoRateLimiting.transfer( 1 * 10 ** 7, TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -1154,7 +1162,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { bytes32("2"), bytes32(0), peer, - toWormholeFormat(address(newNttManagerNoRateLimiting)), + toUniversalAddress(address(newNttManagerNoRateLimiting)), tokenTransferMessage ); e1.receiveMessage(transceiverMessage); @@ -1178,7 +1186,7 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { uint8 decimals = token.decimals(); - nttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max); + nttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max); nttManager.setOutboundLimit(packTrimmedAmount(type(uint64).max, 8).untrim(decimals)); token.mintDummy(address(user_A), 5 * 10 ** decimals); @@ -1193,8 +1201,8 @@ contract TestNttManagerNoRateLimiting is Test, IRateLimiterEvents { nttManager.transfer( 1 * 10 ** decimals, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, encodedInstructions ); diff --git a/evm/test/RateLimit.t.sol b/evm/test/RateLimit.t.sol index e1aa83e89..34e5615f7 100644 --- a/evm/test/RateLimit.t.sol +++ b/evm/test/RateLimit.t.sol @@ -7,11 +7,16 @@ import "../src/NttManager/NttManager.sol"; import "./mocks/DummyTransceiver.sol"; import "../src/mocks/DummyToken.sol"; import "./mocks/MockNttManager.sol"; -import "wormhole-solidity-sdk/testing/helpers/WormholeSimulator.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; +import { + WormholeOverride, + AdvancedWormholeOverride +} from "wormhole-sdk/testing/WormholeOverride.sol"; +import {VaaLib, Vaa, VaaBody as PublishedMessage} from "wormhole-sdk/libraries/VaaLib.sol"; import "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol"; import "./libraries/TransceiverHelpers.sol"; import "./libraries/NttManagerHelpers.sol"; -import "wormhole-solidity-sdk/libraries/BytesParsing.sol"; +import "wormhole-sdk/libraries/BytesParsing.sol"; pragma solidity >=0.8.8 <0.9.0; @@ -25,18 +30,15 @@ contract TestRateLimit is Test, IRateLimiterEvents { uint16 constant chainId = 7; uint16 constant chainId2 = 8; - uint256 constant DEVNET_GUARDIAN_PK = - 0xcfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0; - WormholeSimulator guardian; uint256 initialBlockTimestamp; function setUp() public { string memory url = "https://ethereum-sepolia-rpc.publicnode.com"; - IWormhole wormhole = IWormhole(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); + ICoreBridge wormhole = ICoreBridge(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); vm.createSelectFork(url); initialBlockTimestamp = vm.getBlockTimestamp(); - guardian = new WormholeSimulator(address(wormhole), DEVNET_GUARDIAN_PK); + WormholeOverride.setUpOverride(wormhole); DummyToken t = new DummyToken(); NttManager implementation = new MockNttManagerContract( @@ -46,7 +48,7 @@ contract TestRateLimit is Test, IRateLimiterEvents { nttManager = MockNttManagerContract(address(new ERC1967Proxy(address(implementation), ""))); nttManager.initialize(); - nttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max); + nttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max); DummyTransceiver e = new DummyTransceiver(address(nttManager)); nttManager.setTransceiver(address(e)); @@ -90,8 +92,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { nttManager.transfer( transferAmount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -137,8 +139,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { nttManager.transfer( transferAmount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -184,8 +186,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { nttManager.transfer( transferAmount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -226,8 +228,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { nttManager.transfer( transferAmount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -280,8 +282,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { nttManager.transfer( transferAmount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -330,8 +332,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { nttManager.transfer( transferAmount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -389,8 +391,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { nttManager.transfer( transferAmount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -415,8 +417,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { nttManager.transfer( transferAmount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -443,8 +445,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { nttManager.transfer( badTransferAmount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -476,8 +478,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { uint64 qSeq = nttManager.transfer( transferAmount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), true, new bytes(1) ); @@ -487,7 +489,7 @@ contract TestRateLimit is Test, IRateLimiterEvents { IRateLimiter.OutboundQueuedTransfer memory qt = nttManager.getOutboundQueuedTransfer(0); assertEq(qt.amount.getAmount(), transferAmount.trim(decimals, decimals).getAmount()); assertEq(qt.recipientChain, chainId2); - assertEq(qt.recipient, toWormholeFormat(user_B)); + assertEq(qt.recipient, toUniversalAddress(user_B)); assertEq(qt.txTimestamp, initialBlockTimestamp); // assert that the contract also locked funds from the user @@ -644,7 +646,7 @@ contract TestRateLimit is Test, IRateLimiterEvents { // replay protection on executeMsg vm.recordLogs(); nttManager.executeMsg( - TransceiverHelpersLib.SENDING_CHAIN_ID, toWormholeFormat(address(nttManager)), m + TransceiverHelpersLib.SENDING_CHAIN_ID, toUniversalAddress(address(nttManager)), m ); { @@ -652,7 +654,7 @@ contract TestRateLimit is Test, IRateLimiterEvents { assertEq(entries.length, 1); assertEq(entries[0].topics.length, 3); assertEq(entries[0].topics[0], keccak256("MessageAlreadyExecuted(bytes32,bytes32)")); - assertEq(entries[0].topics[1], toWormholeFormat(address(nttManager))); + assertEq(entries[0].topics[1], toUniversalAddress(address(nttManager))); assertEq( entries[0].topics[2], TransceiverStructs.nttManagerMessageDigest( @@ -684,8 +686,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { nttManager.transfer( transferAmount.untrim(decimals), chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -763,8 +765,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { nttManager.transfer( transferAmount.untrim(decimals), TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(user_B), - toWormholeFormat(userA), + toUniversalAddress(user_B), + toUniversalAddress(userA), false, new bytes(1) ); @@ -828,7 +830,7 @@ contract TestRateLimit is Test, IRateLimiterEvents { console.log("result: %s", result.length); // // compare revert strings bytes32 expectedRevertHash = keccak256(abi.encode(expectedRevert)); - (bytes memory res,) = result.slice(4, result.length - 4); + (bytes memory res,) = result.sliceMem(4, result.length - 4); bytes32 actualRevertHash = keccak256(abi.encodePacked(res)); require(expectedRevertHash == actualRevertHash, "call did not revert as expected"); } @@ -876,8 +878,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { nttManager.transfer( transferAmount.untrim(decimals), chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -889,8 +891,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { nttManager.transfer( transferAmount.untrim(decimals), chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -959,8 +961,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { nttManager.transfer( transferAmount.untrim(decimals), TransceiverHelpersLib.SENDING_CHAIN_ID, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), false, new bytes(1) ); @@ -1022,8 +1024,8 @@ contract TestRateLimit is Test, IRateLimiterEvents { uint64 qSeq = nttManager.transfer( transferAmount, chainId2, - toWormholeFormat(user_B), - toWormholeFormat(user_A), + toUniversalAddress(user_B), + toUniversalAddress(user_A), true, new bytes(1) ); @@ -1033,7 +1035,7 @@ contract TestRateLimit is Test, IRateLimiterEvents { IRateLimiter.OutboundQueuedTransfer memory qt = nttManager.getOutboundQueuedTransfer(0); assertEq(qt.amount.getAmount(), transferAmount.trim(decimals, decimals).getAmount()); assertEq(qt.recipientChain, chainId2); - assertEq(qt.recipient, toWormholeFormat(user_B)); + assertEq(qt.recipient, toUniversalAddress(user_B)); assertEq(qt.txTimestamp, initialBlockTimestamp); // assert that the contract also locked funds from the user @@ -1161,7 +1163,7 @@ contract TestRateLimit is Test, IRateLimiterEvents { // replay protection on executeMsg vm.recordLogs(); nttManager.executeMsg( - TransceiverHelpersLib.SENDING_CHAIN_ID, toWormholeFormat(address(nttManager)), m + TransceiverHelpersLib.SENDING_CHAIN_ID, toUniversalAddress(address(nttManager)), m ); { @@ -1169,7 +1171,7 @@ contract TestRateLimit is Test, IRateLimiterEvents { assertEq(entries.length, 1); assertEq(entries[0].topics.length, 3); assertEq(entries[0].topics[0], keccak256("MessageAlreadyExecuted(bytes32,bytes32)")); - assertEq(entries[0].topics[1], toWormholeFormat(address(nttManager))); + assertEq(entries[0].topics[1], toUniversalAddress(address(nttManager))); assertEq( entries[0].topics[2], TransceiverStructs.nttManagerMessageDigest( diff --git a/evm/test/Upgrades.t.sol b/evm/test/Upgrades.t.sol index 9bdbed9a7..bfb9a8cba 100644 --- a/evm/test/Upgrades.t.sol +++ b/evm/test/Upgrades.t.sol @@ -21,9 +21,13 @@ import "./mocks/MockTransceivers.sol"; import "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol"; -import "wormhole-solidity-sdk/interfaces/IWormhole.sol"; -import "wormhole-solidity-sdk/testing/helpers/WormholeSimulator.sol"; -import "wormhole-solidity-sdk/Utils.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; +import { + WormholeOverride, + AdvancedWormholeOverride +} from "wormhole-sdk/testing/WormholeOverride.sol"; +import {VaaLib, Vaa, VaaBody as PublishedMessage} from "wormhole-sdk/libraries/VaaLib.sol"; +import "wormhole-sdk/Utils.sol"; contract TestUpgrades is Test, IRateLimiterEvents { NttManager nttManagerChain1; @@ -36,9 +40,6 @@ contract TestUpgrades is Test, IRateLimiterEvents { uint16 constant chainId2 = 100; uint16 constant SENDING_CHAIN_ID = 1; - uint256 constant DEVNET_GUARDIAN_PK = - 0xcfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0; - WormholeSimulator guardian; uint256 initialBlockTimestamp; uint8 constant FAST_CONSISTENCY_LEVEL = 200; uint256 constant GAS_LIMIT = 500000; @@ -51,14 +52,14 @@ contract TestUpgrades is Test, IRateLimiterEvents { address userD = address(0xABC); address relayer = address(0x28D8F1Be96f97C1387e94A53e00eCcFb4E75175a); - IWormhole wormhole = IWormhole(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); + ICoreBridge wormhole = ICoreBridge(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); function setUp() public virtual { string memory url = "https://ethereum-sepolia-rpc.publicnode.com"; vm.createSelectFork(url); initialBlockTimestamp = vm.getBlockTimestamp(); - guardian = new WormholeSimulator(address(wormhole), DEVNET_GUARDIAN_PK); + WormholeOverride.setUpOverride(wormhole); vm.chainId(chainId1); DummyToken t1 = new DummyToken(); @@ -191,7 +192,7 @@ contract TestUpgrades is Test, IRateLimiterEvents { MockNttManagerContract(address(new ERC1967Proxy(address(implementation), ""))); thisNttManager.initialize(); - thisNttManager.setPeer(chainId2, toWormholeFormat(address(0x1)), 9, type(uint64).max); + thisNttManager.setPeer(chainId2, toUniversalAddress(address(0x1)), 9, type(uint64).max); // Upgrade from NttManager with rate limiting disabled to NttManagerNoRateLimiting. NttManager rateLimitingImplementation = new MockNttManagerNoRateLimitingContract( @@ -433,7 +434,7 @@ contract TestUpgrades is Test, IRateLimiterEvents { // Set the message fee to be non-zero vm.chainId(11155111); // Sepolia testnet id uint256 fee = 0.000001e18; - guardian.setMessageFee(fee); + WormholeOverride.setMessageFee(wormhole, fee); uint256 balanceBefore = address(userA).balance; basicFunctionality(); uint256 balanceAfter = address(userA).balance; @@ -466,8 +467,8 @@ contract TestUpgrades is Test, IRateLimiterEvents { nttManagerChain1.transfer{value: totalQuote}( sendingAmount, chainId2, - toWormholeFormat(userB), - toWormholeFormat(userA), + toUniversalAddress(userB), + toUniversalAddress(userA), false, encodeTransceiverInstruction(true) ); @@ -487,12 +488,8 @@ contract TestUpgrades is Test, IRateLimiterEvents { vm.stopPrank(); - // Get and sign the log to go down the other pipe. Thank you to whoever wrote this code in the past! - Vm.Log[] memory entries = guardian.fetchWormholeMessageFromLog(vm.getRecordedLogs()); - bytes[] memory encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId1); - } + // Get and sign the log to go down the other pipe. + bytes[] memory encodedVMs = _getSignedMessages(vm.getRecordedLogs(), chainId1); // Chain2 verification and checks vm.chainId(chainId2); @@ -513,12 +510,7 @@ contract TestUpgrades is Test, IRateLimiterEvents { } // Can't resubmit the same message twice - (IWormhole.VM memory wormholeVM,,) = wormhole.parseAndVerifyVM(encodedVMs[0]); - vm.expectRevert( - abi.encodeWithSelector( - IWormholeTransceiver.TransferAlreadyCompleted.selector, wormholeVM.hash - ) - ); + vm.expectRevert(); wormholeTransceiverChain2.receiveMessage(encodedVMs[0]); // Go back the other way from a THIRD user @@ -540,8 +532,8 @@ contract TestUpgrades is Test, IRateLimiterEvents { nttManagerChain2.transfer{value: totalQuote}( sendingAmount, chainId1, - toWormholeFormat(userD), - toWormholeFormat(userC), + toUniversalAddress(userD), + toUniversalAddress(userC), false, encodeTransceiverInstruction(true) ); @@ -557,12 +549,8 @@ contract TestUpgrades is Test, IRateLimiterEvents { ); } - // Get and sign the log to go down the other pipe. Thank you to whoever wrote this code in the past! - entries = guardian.fetchWormholeMessageFromLog(vm.getRecordedLogs()); - encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], chainId2); - } + // Get and sign the log to go down the other pipe. + encodedVMs = _getSignedMessages(vm.getRecordedLogs(), chainId2); // Chain1 verification and checks with the receiving of the message vm.chainId(chainId1); @@ -601,6 +589,19 @@ contract TestUpgrades is Test, IRateLimiterEvents { TransceiverInstructions[0] = TransceiverInstruction; return TransceiverStructs.encodeTransceiverInstructions(TransceiverInstructions); } + + function _getSignedMessages( + Vm.Log[] memory logs, + uint16 emitterChainId + ) internal view returns (bytes[] memory) { + PublishedMessage[] memory msgs = WormholeOverride.fetchPublishedMessages(wormhole, logs); + bytes[] memory encodedVMs = new bytes[](msgs.length); + for (uint256 i = 0; i < msgs.length; i++) { + msgs[i].envelope.emitterChainId = emitterChainId; + encodedVMs[i] = VaaLib.encode(WormholeOverride.sign(wormhole, msgs[i])); + } + return encodedVMs; + } } contract TestInitialize is Test { @@ -614,14 +615,11 @@ contract TestInitialize is Test { uint16 constant chainId1 = 7; - uint256 constant DEVNET_GUARDIAN_PK = - 0xcfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0; - WormholeTransceiver wormholeTransceiverChain1; address userA = address(0x123); address relayer = address(0x28D8F1Be96f97C1387e94A53e00eCcFb4E75175a); - IWormhole wormhole = IWormhole(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); + ICoreBridge wormhole = ICoreBridge(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); function test_doubleInitialize() public { string memory url = "https://ethereum-sepolia-rpc.publicnode.com"; diff --git a/evm/test/libraries/IntegrationHelpers.sol b/evm/test/libraries/IntegrationHelpers.sol index c35bc4d38..20a3ba7b6 100644 --- a/evm/test/libraries/IntegrationHelpers.sol +++ b/evm/test/libraries/IntegrationHelpers.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache 2 -pragma solidity 0.8.19; +pragma solidity >=0.8.8 <0.9.0; import "forge-std/Test.sol"; import "forge-std/console.sol"; @@ -10,11 +10,15 @@ import {DummyToken, DummyTokenMintAndBurn} from "../../src/mocks/DummyToken.sol" import "../../src/libraries/TrimmedAmount.sol"; import {Utils} from "./../libraries/Utils.sol"; import "../../src/libraries/TransceiverStructs.sol"; -import "wormhole-solidity-sdk/Utils.sol"; +import "wormhole-sdk/Utils.sol"; import "../../src/interfaces/IWormholeTransceiver.sol"; -import {WormholeRelayerBasicTest} from "wormhole-solidity-sdk/testing/WormholeRelayerTest.sol"; import "../../src/NttManager/NttManager.sol"; -import "wormhole-solidity-sdk/testing/helpers/WormholeSimulator.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; +import { + WormholeOverride, + AdvancedWormholeOverride +} from "wormhole-sdk/testing/WormholeOverride.sol"; +import {VaaLib, Vaa, VaaBody as PublishedMessage} from "wormhole-sdk/libraries/VaaLib.sol"; contract IntegrationHelpers is Test { using TrimmedAmountLib for uint256; @@ -64,7 +68,7 @@ contract IntegrationHelpers is Test { ) internal { for (uint256 i; i < transceivers.length; i++) { transceivers[i].setWormholePeer( - chainIds[i], toWormholeFormat(address(transceiverPeers[i])) + chainIds[i], toUniversalAddress(address(transceiverPeers[i])) ); } } @@ -77,7 +81,7 @@ contract IntegrationHelpers is Test { uint64 inboundLimit ) internal { sourceManager.setPeer( - peerChainId, toWormholeFormat(address(peerManagerAddr)), peerDecimals, inboundLimit + peerChainId, toUniversalAddress(address(peerManagerAddr)), peerDecimals, inboundLimit ); } @@ -121,12 +125,12 @@ contract IntegrationHelpers is Test { TransceiverStructs.NttManagerMessage memory nttManagerMessage; nttManagerMessage = TransceiverStructs.NttManagerMessage( 0, - toWormholeFormat(from), + toUniversalAddress(from), TransceiverStructs.encodeNativeTokenTransfer( TransceiverStructs.NativeTokenTransfer({ amount: sendingAmount, - sourceToken: toWormholeFormat(tokenAddr), - to: toWormholeFormat(to), + sourceToken: toUniversalAddress(tokenAddr), + to: toUniversalAddress(to), toChain: recipientChainId, additionalPayload: "" }) @@ -160,24 +164,25 @@ contract IntegrationHelpers is Test { sourceManager.transfer{value: quoteSum}( sendingAmount, recipientChainId, - toWormholeFormat(to), - toWormholeFormat(refund), + toUniversalAddress(to), + toUniversalAddress(refund), relayer_off, encodeTransceiverInstruction(relayer_off) ); } function _getWormholeMessage( - WormholeSimulator guardian, + ICoreBridge coreBridge, Vm.Log[] memory logs, - uint16 emitterChain + uint16 emitterChainId ) internal view returns (bytes[] memory) { - Vm.Log[] memory entries = guardian.fetchWormholeMessageFromLog(logs); - bytes[] memory encodedVMs = new bytes[](entries.length); - for (uint256 i = 0; i < encodedVMs.length; i++) { - encodedVMs[i] = guardian.fetchSignedMessageFromLogs(entries[i], emitterChain); + PublishedMessage[] memory msgs = WormholeOverride.fetchPublishedMessages(coreBridge, logs); + bytes[] memory encodedVaas = new bytes[](msgs.length); + for (uint256 i = 0; i < msgs.length; i++) { + msgs[i].envelope.emitterChainId = emitterChainId; + encodedVaas[i] = VaaLib.encode(WormholeOverride.sign(coreBridge, msgs[i])); } - return encodedVMs; + return encodedVaas; } } diff --git a/evm/test/libraries/NttManagerHelpers.sol b/evm/test/libraries/NttManagerHelpers.sol index dbef7b6fe..d2841bb32 100644 --- a/evm/test/libraries/NttManagerHelpers.sol +++ b/evm/test/libraries/NttManagerHelpers.sol @@ -5,6 +5,7 @@ pragma solidity >=0.8.8 <0.9.0; import "../../src/libraries/TrimmedAmount.sol"; import "../../src/NttManager/NttManager.sol"; import "../../src/interfaces/INttManager.sol"; +import "wormhole-sdk/Utils.sol"; library NttManagerHelpersLib { uint16 constant SENDING_CHAIN_ID = 1; @@ -26,7 +27,10 @@ library NttManagerHelpersLib { uint8 tokenDecimals = abi.decode(queriedDecimals, (uint8)); recipientNttManager.setPeer( - SENDING_CHAIN_ID, toWormholeFormat(address(nttManager)), tokenDecimals, type(uint64).max + SENDING_CHAIN_ID, + toUniversalAddress(address(nttManager)), + tokenDecimals, + type(uint64).max ); recipientNttManager.setInboundLimit(inboundLimit.untrim(decimals), SENDING_CHAIN_ID); } diff --git a/evm/test/libraries/TransceiverHelpers.sol b/evm/test/libraries/TransceiverHelpers.sol index 7b7c39a4d..9f444326d 100644 --- a/evm/test/libraries/TransceiverHelpers.sol +++ b/evm/test/libraries/TransceiverHelpers.sol @@ -7,6 +7,7 @@ import "../mocks/DummyTransceiver.sol"; import "../../src/mocks/DummyToken.sol"; import "../../src/NttManager/NttManager.sol"; import "../../src/libraries/TrimmedAmount.sol"; +import "wormhole-sdk/Utils.sol"; library TransceiverHelpersLib { using TrimmedAmountLib for TrimmedAmount; @@ -52,8 +53,8 @@ library TransceiverHelpersLib { bytes memory encodedEm; (em, encodedEm) = TransceiverStructs.buildAndEncodeTransceiverMessage( TEST_TRANSCEIVER_PAYLOAD_PREFIX, - toWormholeFormat(address(nttManager)), - toWormholeFormat(address(recipientNttManager)), + toUniversalAddress(address(nttManager)), + toUniversalAddress(address(recipientNttManager)), encodedM, new bytes(0) ); @@ -81,8 +82,8 @@ library TransceiverHelpersLib { TransceiverStructs.encodeNativeTokenTransfer( TransceiverStructs.NativeTokenTransfer({ amount: amount, - sourceToken: toWormholeFormat(address(token)), - to: toWormholeFormat(to), + sourceToken: toUniversalAddress(address(token)), + to: toUniversalAddress(to), toChain: toChain, additionalPayload: "" }) diff --git a/evm/test/mocks/MockNttManagerAdditionalPayload.sol b/evm/test/mocks/MockNttManagerAdditionalPayload.sol index a313c3d86..9f83079ae 100644 --- a/evm/test/mocks/MockNttManagerAdditionalPayload.sol +++ b/evm/test/mocks/MockNttManagerAdditionalPayload.sol @@ -3,6 +3,7 @@ pragma solidity >=0.8.8 <0.9.0; import "../../src/NttManager/NttManagerNoRateLimiting.sol"; +import "wormhole-sdk/Utils.sol"; contract MockNttManagerAdditionalPayloadContract is NttManagerNoRateLimiting { constructor( @@ -25,7 +26,7 @@ contract MockNttManagerAdditionalPayloadContract is NttManagerNoRateLimiting { bytes memory additionalPayload = abi.encodePacked("banana"); emit AdditionalPayloadSent(additionalPayload); return TransceiverStructs.NativeTokenTransfer( - amount, toWormholeFormat(token), recipient, recipientChain, additionalPayload + amount, toUniversalAddress(token), recipient, recipientChain, additionalPayload ); } diff --git a/evm/test/wormhole/Governance.t.sol b/evm/test/wormhole/Governance.t.sol index 7cc22b6f5..9b06726d1 100644 --- a/evm/test/wormhole/Governance.t.sol +++ b/evm/test/wormhole/Governance.t.sol @@ -5,7 +5,14 @@ import "../../src/wormhole/Governance.sol"; import "forge-std/console.sol"; import "forge-std/Test.sol"; import "openzeppelin-contracts/contracts/access/Ownable.sol"; -import "wormhole-solidity-sdk/testing/helpers/WormholeSimulator.sol"; +import {ICoreBridge} from "wormhole-sdk/interfaces/ICoreBridge.sol"; +import {WormholeOverride} from "wormhole-sdk/testing/WormholeOverride.sol"; +import { + VaaLib, + Vaa, + VaaBody as PublishedMessage, + VaaEnvelope +} from "wormhole-sdk/libraries/VaaLib.sol"; contract GovernedContract is Ownable { error RandomError(); @@ -22,19 +29,16 @@ contract GovernedContract is Ownable { } contract GovernanceTest is Test { - uint256 constant DEVNET_GUARDIAN_PK = - 0xcfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0; - Governance governance; - WormholeSimulator guardian; GovernedContract myContract; - IWormhole constant wormhole = IWormhole(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); + ICoreBridgeGovernance constant wormhole = + ICoreBridgeGovernance(0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78); function setUp() public { string memory url = "https://ethereum-sepolia-rpc.publicnode.com"; vm.createSelectFork(url); - guardian = new WormholeSimulator(address(wormhole), DEVNET_GUARDIAN_PK); + WormholeOverride.setUpOverride(ICoreBridge(address(wormhole))); governance = new Governance(address(wormhole)); myContract = new GovernedContract(); @@ -85,27 +89,25 @@ contract GovernanceTest is Test { callData: callData }); - IWormhole.VM memory vaa = - buildVaa(governance.encodeGeneralPurposeGovernanceMessage(message)); + PublishedMessage memory body = + buildVaaBody(governance.encodeGeneralPurposeGovernanceMessage(message)); - return guardian.encodeAndSignMessage(vaa); + return VaaLib.encode(WormholeOverride.sign(ICoreBridge(address(wormhole)), body)); } - function buildVaa( + function buildVaaBody( bytes memory payload - ) public view returns (IWormhole.VM memory) { - return IWormhole.VM({ - version: 1, - timestamp: uint32(block.timestamp), - nonce: 0, - emitterChainId: wormhole.governanceChainId(), - emitterAddress: wormhole.governanceContract(), - sequence: 0, - consistencyLevel: 200, - payload: payload, - guardianSetIndex: 0, - signatures: new IWormhole.Signature[](0), - hash: bytes32("") + ) public view returns (PublishedMessage memory) { + return PublishedMessage({ + envelope: VaaEnvelope({ + timestamp: uint32(block.timestamp), + nonce: 0, + emitterChainId: wormhole.governanceChainId(), + emitterAddress: wormhole.governanceContract(), + sequence: 0, + consistencyLevel: 200 + }), + payload: payload }); } diff --git a/evm/ts/src/bindings.ts b/evm/ts/src/bindings.ts index 5ebf04ae9..ca009ee51 100644 --- a/evm/ts/src/bindings.ts +++ b/evm/ts/src/bindings.ts @@ -6,6 +6,7 @@ import { _1_1_0, _1_3_1, _2_0_0, + _2_1_0, } from "./ethers-contracts/index.js"; import { Ntt } from "@wormhole-foundation/sdk-definitions-ntt"; @@ -13,6 +14,7 @@ import { Ntt } from "@wormhole-foundation/sdk-definitions-ntt"; // We check for the first match in descending order, allowing for higher minor and patch versions // being used by the live contract (these are supposed to still be compatible with older ABIs). export const abiVersions = [ + ["2.1.0", _2_1_0], ["2.0.0", _2_0_0], ["1.3.1", _1_3_1], ["1.1.0", _1_1_0], diff --git a/evm/ts/src/ethers-contracts/2_1_0/NttManager.ts b/evm/ts/src/ethers-contracts/2_1_0/NttManager.ts new file mode 100644 index 000000000..f77f28ea2 --- /dev/null +++ b/evm/ts/src/ethers-contracts/2_1_0/NttManager.ts @@ -0,0 +1,1792 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common.js"; + +export declare namespace TransceiverStructs { + export type NttManagerMessageStruct = { + id: BytesLike; + sender: BytesLike; + payload: BytesLike; + }; + + export type NttManagerMessageStructOutput = [ + id: string, + sender: string, + payload: string + ] & { id: string; sender: string; payload: string }; +} + +export declare namespace IRateLimiter { + export type RateLimitParamsStruct = { + limit: BigNumberish; + currentCapacity: BigNumberish; + lastTxTimestamp: BigNumberish; + }; + + export type RateLimitParamsStructOutput = [ + limit: bigint, + currentCapacity: bigint, + lastTxTimestamp: bigint + ] & { limit: bigint; currentCapacity: bigint; lastTxTimestamp: bigint }; + + export type InboundQueuedTransferStruct = { + amount: BigNumberish; + txTimestamp: BigNumberish; + recipient: AddressLike; + }; + + export type InboundQueuedTransferStructOutput = [ + amount: bigint, + txTimestamp: bigint, + recipient: string + ] & { amount: bigint; txTimestamp: bigint; recipient: string }; + + export type OutboundQueuedTransferStruct = { + recipient: BytesLike; + refundAddress: BytesLike; + amount: BigNumberish; + txTimestamp: BigNumberish; + recipientChain: BigNumberish; + sender: AddressLike; + transceiverInstructions: BytesLike; + }; + + export type OutboundQueuedTransferStructOutput = [ + recipient: string, + refundAddress: string, + amount: bigint, + txTimestamp: bigint, + recipientChain: bigint, + sender: string, + transceiverInstructions: string + ] & { + recipient: string; + refundAddress: string; + amount: bigint; + txTimestamp: bigint; + recipientChain: bigint; + sender: string; + transceiverInstructions: string; + }; +} + +export declare namespace INttManager { + export type NttManagerPeerStruct = { + peerAddress: BytesLike; + tokenDecimals: BigNumberish; + }; + + export type NttManagerPeerStructOutput = [ + peerAddress: string, + tokenDecimals: bigint + ] & { peerAddress: string; tokenDecimals: bigint }; +} + +export declare namespace TransceiverRegistry { + export type TransceiverInfoStruct = { + registered: boolean; + enabled: boolean; + index: BigNumberish; + }; + + export type TransceiverInfoStructOutput = [ + registered: boolean, + enabled: boolean, + index: bigint + ] & { registered: boolean; enabled: boolean; index: bigint }; +} + +export interface NttManagerInterface extends Interface { + getFunction( + nameOrSignature: + | "NTT_MANAGER_VERSION" + | "attestationReceived" + | "cancelOutboundQueuedTransfer" + | "chainId" + | "completeInboundQueuedTransfer" + | "completeOutboundQueuedTransfer" + | "executeMsg" + | "getCurrentInboundCapacity" + | "getCurrentOutboundCapacity" + | "getInboundLimitParams" + | "getInboundQueuedTransfer" + | "getMigratesImmutables" + | "getMode" + | "getOutboundLimitParams" + | "getOutboundQueuedTransfer" + | "getPeer" + | "getThreshold" + | "getTransceiverInfo" + | "getTransceivers" + | "initialize" + | "isMessageApproved" + | "isMessageExecuted" + | "isPaused" + | "messageAttestations" + | "migrate" + | "mode" + | "nextMessageSequence" + | "owner" + | "pause" + | "pauser" + | "quoteDeliveryPrice" + | "rateLimitDuration" + | "removeTransceiver" + | "setInboundLimit" + | "setOutboundLimit" + | "setPeer" + | "setThreshold" + | "setTransceiver" + | "token" + | "tokenDecimals" + | "transceiverAttestedToMessage" + | "transfer(uint256,uint16,bytes32)" + | "transfer(uint256,uint16,bytes32,bytes32,bool,bytes)" + | "transferOwnership" + | "transferPauserCapability" + | "unpause" + | "upgrade" + ): FunctionFragment; + + getEvent( + nameOrSignatureOrTopic: + | "AdminChanged" + | "BeaconUpgraded" + | "InboundTransferLimitUpdated" + | "InboundTransferQueued" + | "Initialized" + | "MessageAlreadyExecuted" + | "MessageAttestedTo" + | "NotPaused" + | "OutboundTransferCancelled" + | "OutboundTransferLimitUpdated" + | "OutboundTransferQueued" + | "OutboundTransferRateLimited" + | "OwnershipTransferred" + | "Paused" + | "PauserTransferred" + | "PeerUpdated" + | "ThresholdChanged" + | "TransceiverAdded" + | "TransceiverRemoved" + | "TransferRedeemed" + | "TransferSent(bytes32,bytes32,uint256,uint256,uint16,uint64)" + | "TransferSent(bytes32)" + | "Upgraded" + ): EventFragment; + + encodeFunctionData( + functionFragment: "NTT_MANAGER_VERSION", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "attestationReceived", + values: [ + BigNumberish, + BytesLike, + TransceiverStructs.NttManagerMessageStruct + ] + ): string; + encodeFunctionData( + functionFragment: "cancelOutboundQueuedTransfer", + values: [BigNumberish] + ): string; + encodeFunctionData(functionFragment: "chainId", values?: undefined): string; + encodeFunctionData( + functionFragment: "completeInboundQueuedTransfer", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "completeOutboundQueuedTransfer", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "executeMsg", + values: [ + BigNumberish, + BytesLike, + TransceiverStructs.NttManagerMessageStruct + ] + ): string; + encodeFunctionData( + functionFragment: "getCurrentInboundCapacity", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getCurrentOutboundCapacity", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getInboundLimitParams", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getInboundQueuedTransfer", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "getMigratesImmutables", + values?: undefined + ): string; + encodeFunctionData(functionFragment: "getMode", values?: undefined): string; + encodeFunctionData( + functionFragment: "getOutboundLimitParams", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getOutboundQueuedTransfer", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getPeer", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getThreshold", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getTransceiverInfo", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getTransceivers", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "initialize", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "isMessageApproved", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "isMessageExecuted", + values: [BytesLike] + ): string; + encodeFunctionData(functionFragment: "isPaused", values?: undefined): string; + encodeFunctionData( + functionFragment: "messageAttestations", + values: [BytesLike] + ): string; + encodeFunctionData(functionFragment: "migrate", values?: undefined): string; + encodeFunctionData(functionFragment: "mode", values?: undefined): string; + encodeFunctionData( + functionFragment: "nextMessageSequence", + values?: undefined + ): string; + encodeFunctionData(functionFragment: "owner", values?: undefined): string; + encodeFunctionData(functionFragment: "pause", values?: undefined): string; + encodeFunctionData(functionFragment: "pauser", values?: undefined): string; + encodeFunctionData( + functionFragment: "quoteDeliveryPrice", + values: [BigNumberish, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "rateLimitDuration", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "removeTransceiver", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "setInboundLimit", + values: [BigNumberish, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "setOutboundLimit", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "setPeer", + values: [BigNumberish, BytesLike, BigNumberish, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "setThreshold", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "setTransceiver", + values: [AddressLike] + ): string; + encodeFunctionData(functionFragment: "token", values?: undefined): string; + encodeFunctionData( + functionFragment: "tokenDecimals", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "transceiverAttestedToMessage", + values: [BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "transfer(uint256,uint16,bytes32)", + values: [BigNumberish, BigNumberish, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "transfer(uint256,uint16,bytes32,bytes32,bool,bytes)", + values: [ + BigNumberish, + BigNumberish, + BytesLike, + BytesLike, + boolean, + BytesLike + ] + ): string; + encodeFunctionData( + functionFragment: "transferOwnership", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "transferPauserCapability", + values: [AddressLike] + ): string; + encodeFunctionData(functionFragment: "unpause", values?: undefined): string; + encodeFunctionData( + functionFragment: "upgrade", + values: [AddressLike] + ): string; + + decodeFunctionResult( + functionFragment: "NTT_MANAGER_VERSION", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "attestationReceived", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "cancelOutboundQueuedTransfer", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "chainId", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "completeInboundQueuedTransfer", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "completeOutboundQueuedTransfer", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "executeMsg", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "getCurrentInboundCapacity", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getCurrentOutboundCapacity", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getInboundLimitParams", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getInboundQueuedTransfer", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getMigratesImmutables", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "getMode", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "getOutboundLimitParams", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getOutboundQueuedTransfer", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "getPeer", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "getThreshold", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getTransceiverInfo", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getTransceivers", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "initialize", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "isMessageApproved", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isMessageExecuted", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "isPaused", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "messageAttestations", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "migrate", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "mode", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "nextMessageSequence", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "pause", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "pauser", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "quoteDeliveryPrice", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "rateLimitDuration", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "removeTransceiver", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setInboundLimit", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setOutboundLimit", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "setPeer", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "setThreshold", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setTransceiver", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "token", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "tokenDecimals", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "transceiverAttestedToMessage", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "transfer(uint256,uint16,bytes32)", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "transfer(uint256,uint16,bytes32,bytes32,bool,bytes)", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "transferOwnership", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "transferPauserCapability", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "unpause", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "upgrade", data: BytesLike): Result; +} + +export namespace AdminChangedEvent { + export type InputTuple = [previousAdmin: AddressLike, newAdmin: AddressLike]; + export type OutputTuple = [previousAdmin: string, newAdmin: string]; + export interface OutputObject { + previousAdmin: string; + newAdmin: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace BeaconUpgradedEvent { + export type InputTuple = [beacon: AddressLike]; + export type OutputTuple = [beacon: string]; + export interface OutputObject { + beacon: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace InboundTransferLimitUpdatedEvent { + export type InputTuple = [ + chainId: BigNumberish, + oldLimit: BigNumberish, + newLimit: BigNumberish + ]; + export type OutputTuple = [ + chainId: bigint, + oldLimit: bigint, + newLimit: bigint + ]; + export interface OutputObject { + chainId: bigint; + oldLimit: bigint; + newLimit: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace InboundTransferQueuedEvent { + export type InputTuple = [digest: BytesLike]; + export type OutputTuple = [digest: string]; + export interface OutputObject { + digest: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace InitializedEvent { + export type InputTuple = [version: BigNumberish]; + export type OutputTuple = [version: bigint]; + export interface OutputObject { + version: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace MessageAlreadyExecutedEvent { + export type InputTuple = [sourceNttManager: BytesLike, msgHash: BytesLike]; + export type OutputTuple = [sourceNttManager: string, msgHash: string]; + export interface OutputObject { + sourceNttManager: string; + msgHash: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace MessageAttestedToEvent { + export type InputTuple = [ + digest: BytesLike, + transceiver: AddressLike, + index: BigNumberish + ]; + export type OutputTuple = [ + digest: string, + transceiver: string, + index: bigint + ]; + export interface OutputObject { + digest: string; + transceiver: string; + index: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NotPausedEvent { + export type InputTuple = [notPaused: boolean]; + export type OutputTuple = [notPaused: boolean]; + export interface OutputObject { + notPaused: boolean; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace OutboundTransferCancelledEvent { + export type InputTuple = [ + sequence: BigNumberish, + recipient: AddressLike, + amount: BigNumberish + ]; + export type OutputTuple = [ + sequence: bigint, + recipient: string, + amount: bigint + ]; + export interface OutputObject { + sequence: bigint; + recipient: string; + amount: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace OutboundTransferLimitUpdatedEvent { + export type InputTuple = [oldLimit: BigNumberish, newLimit: BigNumberish]; + export type OutputTuple = [oldLimit: bigint, newLimit: bigint]; + export interface OutputObject { + oldLimit: bigint; + newLimit: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace OutboundTransferQueuedEvent { + export type InputTuple = [queueSequence: BigNumberish]; + export type OutputTuple = [queueSequence: bigint]; + export interface OutputObject { + queueSequence: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace OutboundTransferRateLimitedEvent { + export type InputTuple = [ + sender: AddressLike, + sequence: BigNumberish, + amount: BigNumberish, + currentCapacity: BigNumberish + ]; + export type OutputTuple = [ + sender: string, + sequence: bigint, + amount: bigint, + currentCapacity: bigint + ]; + export interface OutputObject { + sender: string; + sequence: bigint; + amount: bigint; + currentCapacity: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace OwnershipTransferredEvent { + export type InputTuple = [previousOwner: AddressLike, newOwner: AddressLike]; + export type OutputTuple = [previousOwner: string, newOwner: string]; + export interface OutputObject { + previousOwner: string; + newOwner: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace PausedEvent { + export type InputTuple = [paused: boolean]; + export type OutputTuple = [paused: boolean]; + export interface OutputObject { + paused: boolean; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace PauserTransferredEvent { + export type InputTuple = [oldPauser: AddressLike, newPauser: AddressLike]; + export type OutputTuple = [oldPauser: string, newPauser: string]; + export interface OutputObject { + oldPauser: string; + newPauser: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace PeerUpdatedEvent { + export type InputTuple = [ + chainId_: BigNumberish, + oldPeerContract: BytesLike, + oldPeerDecimals: BigNumberish, + peerContract: BytesLike, + peerDecimals: BigNumberish + ]; + export type OutputTuple = [ + chainId_: bigint, + oldPeerContract: string, + oldPeerDecimals: bigint, + peerContract: string, + peerDecimals: bigint + ]; + export interface OutputObject { + chainId_: bigint; + oldPeerContract: string; + oldPeerDecimals: bigint; + peerContract: string; + peerDecimals: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace ThresholdChangedEvent { + export type InputTuple = [ + oldThreshold: BigNumberish, + threshold: BigNumberish + ]; + export type OutputTuple = [oldThreshold: bigint, threshold: bigint]; + export interface OutputObject { + oldThreshold: bigint; + threshold: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace TransceiverAddedEvent { + export type InputTuple = [ + transceiver: AddressLike, + transceiversNum: BigNumberish, + threshold: BigNumberish + ]; + export type OutputTuple = [ + transceiver: string, + transceiversNum: bigint, + threshold: bigint + ]; + export interface OutputObject { + transceiver: string; + transceiversNum: bigint; + threshold: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace TransceiverRemovedEvent { + export type InputTuple = [transceiver: AddressLike, threshold: BigNumberish]; + export type OutputTuple = [transceiver: string, threshold: bigint]; + export interface OutputObject { + transceiver: string; + threshold: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace TransferRedeemedEvent { + export type InputTuple = [digest: BytesLike]; + export type OutputTuple = [digest: string]; + export interface OutputObject { + digest: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace TransferSent_bytes32_bytes32_uint256_uint256_uint16_uint64_Event { + export type InputTuple = [ + recipient: BytesLike, + refundAddress: BytesLike, + amount: BigNumberish, + fee: BigNumberish, + recipientChain: BigNumberish, + msgSequence: BigNumberish + ]; + export type OutputTuple = [ + recipient: string, + refundAddress: string, + amount: bigint, + fee: bigint, + recipientChain: bigint, + msgSequence: bigint + ]; + export interface OutputObject { + recipient: string; + refundAddress: string; + amount: bigint; + fee: bigint; + recipientChain: bigint; + msgSequence: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace TransferSent_bytes32_Event { + export type InputTuple = [digest: BytesLike]; + export type OutputTuple = [digest: string]; + export interface OutputObject { + digest: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace UpgradedEvent { + export type InputTuple = [implementation: AddressLike]; + export type OutputTuple = [implementation: string]; + export interface OutputObject { + implementation: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface NttManager extends BaseContract { + connect(runner?: ContractRunner | null): NttManager; + waitForDeployment(): Promise; + + interface: NttManagerInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + NTT_MANAGER_VERSION: TypedContractMethod<[], [string], "view">; + + attestationReceived: TypedContractMethod< + [ + sourceChainId: BigNumberish, + sourceNttManagerAddress: BytesLike, + payload: TransceiverStructs.NttManagerMessageStruct + ], + [void], + "nonpayable" + >; + + cancelOutboundQueuedTransfer: TypedContractMethod< + [messageSequence: BigNumberish], + [void], + "nonpayable" + >; + + chainId: TypedContractMethod<[], [bigint], "view">; + + completeInboundQueuedTransfer: TypedContractMethod< + [digest: BytesLike], + [void], + "nonpayable" + >; + + completeOutboundQueuedTransfer: TypedContractMethod< + [messageSequence: BigNumberish], + [bigint], + "payable" + >; + + executeMsg: TypedContractMethod< + [ + sourceChainId: BigNumberish, + sourceNttManagerAddress: BytesLike, + message: TransceiverStructs.NttManagerMessageStruct + ], + [void], + "nonpayable" + >; + + getCurrentInboundCapacity: TypedContractMethod< + [chainId_: BigNumberish], + [bigint], + "view" + >; + + getCurrentOutboundCapacity: TypedContractMethod<[], [bigint], "view">; + + getInboundLimitParams: TypedContractMethod< + [chainId_: BigNumberish], + [IRateLimiter.RateLimitParamsStructOutput], + "view" + >; + + getInboundQueuedTransfer: TypedContractMethod< + [digest: BytesLike], + [IRateLimiter.InboundQueuedTransferStructOutput], + "view" + >; + + getMigratesImmutables: TypedContractMethod<[], [boolean], "view">; + + getMode: TypedContractMethod<[], [bigint], "view">; + + getOutboundLimitParams: TypedContractMethod< + [], + [IRateLimiter.RateLimitParamsStructOutput], + "view" + >; + + getOutboundQueuedTransfer: TypedContractMethod< + [queueSequence: BigNumberish], + [IRateLimiter.OutboundQueuedTransferStructOutput], + "view" + >; + + getPeer: TypedContractMethod< + [chainId_: BigNumberish], + [INttManager.NttManagerPeerStructOutput], + "view" + >; + + getThreshold: TypedContractMethod<[], [bigint], "view">; + + getTransceiverInfo: TypedContractMethod< + [], + [TransceiverRegistry.TransceiverInfoStructOutput[]], + "view" + >; + + getTransceivers: TypedContractMethod<[], [string[]], "view">; + + initialize: TypedContractMethod<[], [void], "payable">; + + isMessageApproved: TypedContractMethod< + [digest: BytesLike], + [boolean], + "view" + >; + + isMessageExecuted: TypedContractMethod< + [digest: BytesLike], + [boolean], + "view" + >; + + isPaused: TypedContractMethod<[], [boolean], "view">; + + messageAttestations: TypedContractMethod< + [digest: BytesLike], + [bigint], + "view" + >; + + migrate: TypedContractMethod<[], [void], "nonpayable">; + + mode: TypedContractMethod<[], [bigint], "view">; + + nextMessageSequence: TypedContractMethod<[], [bigint], "view">; + + owner: TypedContractMethod<[], [string], "view">; + + pause: TypedContractMethod<[], [void], "nonpayable">; + + pauser: TypedContractMethod<[], [string], "view">; + + quoteDeliveryPrice: TypedContractMethod< + [recipientChain: BigNumberish, transceiverInstructions: BytesLike], + [[bigint[], bigint]], + "view" + >; + + rateLimitDuration: TypedContractMethod<[], [bigint], "view">; + + removeTransceiver: TypedContractMethod< + [transceiver: AddressLike], + [void], + "nonpayable" + >; + + setInboundLimit: TypedContractMethod< + [limit: BigNumberish, chainId_: BigNumberish], + [void], + "nonpayable" + >; + + setOutboundLimit: TypedContractMethod< + [limit: BigNumberish], + [void], + "nonpayable" + >; + + setPeer: TypedContractMethod< + [ + peerChainId: BigNumberish, + peerContract: BytesLike, + decimals: BigNumberish, + inboundLimit: BigNumberish + ], + [void], + "nonpayable" + >; + + setThreshold: TypedContractMethod< + [threshold: BigNumberish], + [void], + "nonpayable" + >; + + setTransceiver: TypedContractMethod< + [transceiver: AddressLike], + [void], + "nonpayable" + >; + + token: TypedContractMethod<[], [string], "view">; + + tokenDecimals: TypedContractMethod<[], [bigint], "view">; + + transceiverAttestedToMessage: TypedContractMethod< + [digest: BytesLike, index: BigNumberish], + [boolean], + "view" + >; + + "transfer(uint256,uint16,bytes32)": TypedContractMethod< + [amount: BigNumberish, recipientChain: BigNumberish, recipient: BytesLike], + [bigint], + "payable" + >; + + "transfer(uint256,uint16,bytes32,bytes32,bool,bytes)": TypedContractMethod< + [ + amount: BigNumberish, + recipientChain: BigNumberish, + recipient: BytesLike, + refundAddress: BytesLike, + shouldQueue: boolean, + transceiverInstructions: BytesLike + ], + [bigint], + "payable" + >; + + transferOwnership: TypedContractMethod< + [newOwner: AddressLike], + [void], + "nonpayable" + >; + + transferPauserCapability: TypedContractMethod< + [newPauser: AddressLike], + [void], + "nonpayable" + >; + + unpause: TypedContractMethod<[], [void], "nonpayable">; + + upgrade: TypedContractMethod< + [newImplementation: AddressLike], + [void], + "nonpayable" + >; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "NTT_MANAGER_VERSION" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "attestationReceived" + ): TypedContractMethod< + [ + sourceChainId: BigNumberish, + sourceNttManagerAddress: BytesLike, + payload: TransceiverStructs.NttManagerMessageStruct + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "cancelOutboundQueuedTransfer" + ): TypedContractMethod<[messageSequence: BigNumberish], [void], "nonpayable">; + getFunction( + nameOrSignature: "chainId" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "completeInboundQueuedTransfer" + ): TypedContractMethod<[digest: BytesLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "completeOutboundQueuedTransfer" + ): TypedContractMethod<[messageSequence: BigNumberish], [bigint], "payable">; + getFunction( + nameOrSignature: "executeMsg" + ): TypedContractMethod< + [ + sourceChainId: BigNumberish, + sourceNttManagerAddress: BytesLike, + message: TransceiverStructs.NttManagerMessageStruct + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "getCurrentInboundCapacity" + ): TypedContractMethod<[chainId_: BigNumberish], [bigint], "view">; + getFunction( + nameOrSignature: "getCurrentOutboundCapacity" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "getInboundLimitParams" + ): TypedContractMethod< + [chainId_: BigNumberish], + [IRateLimiter.RateLimitParamsStructOutput], + "view" + >; + getFunction( + nameOrSignature: "getInboundQueuedTransfer" + ): TypedContractMethod< + [digest: BytesLike], + [IRateLimiter.InboundQueuedTransferStructOutput], + "view" + >; + getFunction( + nameOrSignature: "getMigratesImmutables" + ): TypedContractMethod<[], [boolean], "view">; + getFunction( + nameOrSignature: "getMode" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "getOutboundLimitParams" + ): TypedContractMethod< + [], + [IRateLimiter.RateLimitParamsStructOutput], + "view" + >; + getFunction( + nameOrSignature: "getOutboundQueuedTransfer" + ): TypedContractMethod< + [queueSequence: BigNumberish], + [IRateLimiter.OutboundQueuedTransferStructOutput], + "view" + >; + getFunction( + nameOrSignature: "getPeer" + ): TypedContractMethod< + [chainId_: BigNumberish], + [INttManager.NttManagerPeerStructOutput], + "view" + >; + getFunction( + nameOrSignature: "getThreshold" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "getTransceiverInfo" + ): TypedContractMethod< + [], + [TransceiverRegistry.TransceiverInfoStructOutput[]], + "view" + >; + getFunction( + nameOrSignature: "getTransceivers" + ): TypedContractMethod<[], [string[]], "view">; + getFunction( + nameOrSignature: "initialize" + ): TypedContractMethod<[], [void], "payable">; + getFunction( + nameOrSignature: "isMessageApproved" + ): TypedContractMethod<[digest: BytesLike], [boolean], "view">; + getFunction( + nameOrSignature: "isMessageExecuted" + ): TypedContractMethod<[digest: BytesLike], [boolean], "view">; + getFunction( + nameOrSignature: "isPaused" + ): TypedContractMethod<[], [boolean], "view">; + getFunction( + nameOrSignature: "messageAttestations" + ): TypedContractMethod<[digest: BytesLike], [bigint], "view">; + getFunction( + nameOrSignature: "migrate" + ): TypedContractMethod<[], [void], "nonpayable">; + getFunction( + nameOrSignature: "mode" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "nextMessageSequence" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "owner" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "pause" + ): TypedContractMethod<[], [void], "nonpayable">; + getFunction( + nameOrSignature: "pauser" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "quoteDeliveryPrice" + ): TypedContractMethod< + [recipientChain: BigNumberish, transceiverInstructions: BytesLike], + [[bigint[], bigint]], + "view" + >; + getFunction( + nameOrSignature: "rateLimitDuration" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "removeTransceiver" + ): TypedContractMethod<[transceiver: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "setInboundLimit" + ): TypedContractMethod< + [limit: BigNumberish, chainId_: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setOutboundLimit" + ): TypedContractMethod<[limit: BigNumberish], [void], "nonpayable">; + getFunction( + nameOrSignature: "setPeer" + ): TypedContractMethod< + [ + peerChainId: BigNumberish, + peerContract: BytesLike, + decimals: BigNumberish, + inboundLimit: BigNumberish + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setThreshold" + ): TypedContractMethod<[threshold: BigNumberish], [void], "nonpayable">; + getFunction( + nameOrSignature: "setTransceiver" + ): TypedContractMethod<[transceiver: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "token" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "tokenDecimals" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "transceiverAttestedToMessage" + ): TypedContractMethod< + [digest: BytesLike, index: BigNumberish], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "transfer(uint256,uint16,bytes32)" + ): TypedContractMethod< + [amount: BigNumberish, recipientChain: BigNumberish, recipient: BytesLike], + [bigint], + "payable" + >; + getFunction( + nameOrSignature: "transfer(uint256,uint16,bytes32,bytes32,bool,bytes)" + ): TypedContractMethod< + [ + amount: BigNumberish, + recipientChain: BigNumberish, + recipient: BytesLike, + refundAddress: BytesLike, + shouldQueue: boolean, + transceiverInstructions: BytesLike + ], + [bigint], + "payable" + >; + getFunction( + nameOrSignature: "transferOwnership" + ): TypedContractMethod<[newOwner: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "transferPauserCapability" + ): TypedContractMethod<[newPauser: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "unpause" + ): TypedContractMethod<[], [void], "nonpayable">; + getFunction( + nameOrSignature: "upgrade" + ): TypedContractMethod< + [newImplementation: AddressLike], + [void], + "nonpayable" + >; + + getEvent( + key: "AdminChanged" + ): TypedContractEvent< + AdminChangedEvent.InputTuple, + AdminChangedEvent.OutputTuple, + AdminChangedEvent.OutputObject + >; + getEvent( + key: "BeaconUpgraded" + ): TypedContractEvent< + BeaconUpgradedEvent.InputTuple, + BeaconUpgradedEvent.OutputTuple, + BeaconUpgradedEvent.OutputObject + >; + getEvent( + key: "InboundTransferLimitUpdated" + ): TypedContractEvent< + InboundTransferLimitUpdatedEvent.InputTuple, + InboundTransferLimitUpdatedEvent.OutputTuple, + InboundTransferLimitUpdatedEvent.OutputObject + >; + getEvent( + key: "InboundTransferQueued" + ): TypedContractEvent< + InboundTransferQueuedEvent.InputTuple, + InboundTransferQueuedEvent.OutputTuple, + InboundTransferQueuedEvent.OutputObject + >; + getEvent( + key: "Initialized" + ): TypedContractEvent< + InitializedEvent.InputTuple, + InitializedEvent.OutputTuple, + InitializedEvent.OutputObject + >; + getEvent( + key: "MessageAlreadyExecuted" + ): TypedContractEvent< + MessageAlreadyExecutedEvent.InputTuple, + MessageAlreadyExecutedEvent.OutputTuple, + MessageAlreadyExecutedEvent.OutputObject + >; + getEvent( + key: "MessageAttestedTo" + ): TypedContractEvent< + MessageAttestedToEvent.InputTuple, + MessageAttestedToEvent.OutputTuple, + MessageAttestedToEvent.OutputObject + >; + getEvent( + key: "NotPaused" + ): TypedContractEvent< + NotPausedEvent.InputTuple, + NotPausedEvent.OutputTuple, + NotPausedEvent.OutputObject + >; + getEvent( + key: "OutboundTransferCancelled" + ): TypedContractEvent< + OutboundTransferCancelledEvent.InputTuple, + OutboundTransferCancelledEvent.OutputTuple, + OutboundTransferCancelledEvent.OutputObject + >; + getEvent( + key: "OutboundTransferLimitUpdated" + ): TypedContractEvent< + OutboundTransferLimitUpdatedEvent.InputTuple, + OutboundTransferLimitUpdatedEvent.OutputTuple, + OutboundTransferLimitUpdatedEvent.OutputObject + >; + getEvent( + key: "OutboundTransferQueued" + ): TypedContractEvent< + OutboundTransferQueuedEvent.InputTuple, + OutboundTransferQueuedEvent.OutputTuple, + OutboundTransferQueuedEvent.OutputObject + >; + getEvent( + key: "OutboundTransferRateLimited" + ): TypedContractEvent< + OutboundTransferRateLimitedEvent.InputTuple, + OutboundTransferRateLimitedEvent.OutputTuple, + OutboundTransferRateLimitedEvent.OutputObject + >; + getEvent( + key: "OwnershipTransferred" + ): TypedContractEvent< + OwnershipTransferredEvent.InputTuple, + OwnershipTransferredEvent.OutputTuple, + OwnershipTransferredEvent.OutputObject + >; + getEvent( + key: "Paused" + ): TypedContractEvent< + PausedEvent.InputTuple, + PausedEvent.OutputTuple, + PausedEvent.OutputObject + >; + getEvent( + key: "PauserTransferred" + ): TypedContractEvent< + PauserTransferredEvent.InputTuple, + PauserTransferredEvent.OutputTuple, + PauserTransferredEvent.OutputObject + >; + getEvent( + key: "PeerUpdated" + ): TypedContractEvent< + PeerUpdatedEvent.InputTuple, + PeerUpdatedEvent.OutputTuple, + PeerUpdatedEvent.OutputObject + >; + getEvent( + key: "ThresholdChanged" + ): TypedContractEvent< + ThresholdChangedEvent.InputTuple, + ThresholdChangedEvent.OutputTuple, + ThresholdChangedEvent.OutputObject + >; + getEvent( + key: "TransceiverAdded" + ): TypedContractEvent< + TransceiverAddedEvent.InputTuple, + TransceiverAddedEvent.OutputTuple, + TransceiverAddedEvent.OutputObject + >; + getEvent( + key: "TransceiverRemoved" + ): TypedContractEvent< + TransceiverRemovedEvent.InputTuple, + TransceiverRemovedEvent.OutputTuple, + TransceiverRemovedEvent.OutputObject + >; + getEvent( + key: "TransferRedeemed" + ): TypedContractEvent< + TransferRedeemedEvent.InputTuple, + TransferRedeemedEvent.OutputTuple, + TransferRedeemedEvent.OutputObject + >; + getEvent( + key: "TransferSent(bytes32,bytes32,uint256,uint256,uint16,uint64)" + ): TypedContractEvent< + TransferSent_bytes32_bytes32_uint256_uint256_uint16_uint64_Event.InputTuple, + TransferSent_bytes32_bytes32_uint256_uint256_uint16_uint64_Event.OutputTuple, + TransferSent_bytes32_bytes32_uint256_uint256_uint16_uint64_Event.OutputObject + >; + getEvent( + key: "TransferSent(bytes32)" + ): TypedContractEvent< + TransferSent_bytes32_Event.InputTuple, + TransferSent_bytes32_Event.OutputTuple, + TransferSent_bytes32_Event.OutputObject + >; + getEvent( + key: "Upgraded" + ): TypedContractEvent< + UpgradedEvent.InputTuple, + UpgradedEvent.OutputTuple, + UpgradedEvent.OutputObject + >; + + filters: { + "AdminChanged(address,address)": TypedContractEvent< + AdminChangedEvent.InputTuple, + AdminChangedEvent.OutputTuple, + AdminChangedEvent.OutputObject + >; + AdminChanged: TypedContractEvent< + AdminChangedEvent.InputTuple, + AdminChangedEvent.OutputTuple, + AdminChangedEvent.OutputObject + >; + + "BeaconUpgraded(address)": TypedContractEvent< + BeaconUpgradedEvent.InputTuple, + BeaconUpgradedEvent.OutputTuple, + BeaconUpgradedEvent.OutputObject + >; + BeaconUpgraded: TypedContractEvent< + BeaconUpgradedEvent.InputTuple, + BeaconUpgradedEvent.OutputTuple, + BeaconUpgradedEvent.OutputObject + >; + + "InboundTransferLimitUpdated(uint16,uint256,uint256)": TypedContractEvent< + InboundTransferLimitUpdatedEvent.InputTuple, + InboundTransferLimitUpdatedEvent.OutputTuple, + InboundTransferLimitUpdatedEvent.OutputObject + >; + InboundTransferLimitUpdated: TypedContractEvent< + InboundTransferLimitUpdatedEvent.InputTuple, + InboundTransferLimitUpdatedEvent.OutputTuple, + InboundTransferLimitUpdatedEvent.OutputObject + >; + + "InboundTransferQueued(bytes32)": TypedContractEvent< + InboundTransferQueuedEvent.InputTuple, + InboundTransferQueuedEvent.OutputTuple, + InboundTransferQueuedEvent.OutputObject + >; + InboundTransferQueued: TypedContractEvent< + InboundTransferQueuedEvent.InputTuple, + InboundTransferQueuedEvent.OutputTuple, + InboundTransferQueuedEvent.OutputObject + >; + + "Initialized(uint64)": TypedContractEvent< + InitializedEvent.InputTuple, + InitializedEvent.OutputTuple, + InitializedEvent.OutputObject + >; + Initialized: TypedContractEvent< + InitializedEvent.InputTuple, + InitializedEvent.OutputTuple, + InitializedEvent.OutputObject + >; + + "MessageAlreadyExecuted(bytes32,bytes32)": TypedContractEvent< + MessageAlreadyExecutedEvent.InputTuple, + MessageAlreadyExecutedEvent.OutputTuple, + MessageAlreadyExecutedEvent.OutputObject + >; + MessageAlreadyExecuted: TypedContractEvent< + MessageAlreadyExecutedEvent.InputTuple, + MessageAlreadyExecutedEvent.OutputTuple, + MessageAlreadyExecutedEvent.OutputObject + >; + + "MessageAttestedTo(bytes32,address,uint8)": TypedContractEvent< + MessageAttestedToEvent.InputTuple, + MessageAttestedToEvent.OutputTuple, + MessageAttestedToEvent.OutputObject + >; + MessageAttestedTo: TypedContractEvent< + MessageAttestedToEvent.InputTuple, + MessageAttestedToEvent.OutputTuple, + MessageAttestedToEvent.OutputObject + >; + + "NotPaused(bool)": TypedContractEvent< + NotPausedEvent.InputTuple, + NotPausedEvent.OutputTuple, + NotPausedEvent.OutputObject + >; + NotPaused: TypedContractEvent< + NotPausedEvent.InputTuple, + NotPausedEvent.OutputTuple, + NotPausedEvent.OutputObject + >; + + "OutboundTransferCancelled(uint256,address,uint256)": TypedContractEvent< + OutboundTransferCancelledEvent.InputTuple, + OutboundTransferCancelledEvent.OutputTuple, + OutboundTransferCancelledEvent.OutputObject + >; + OutboundTransferCancelled: TypedContractEvent< + OutboundTransferCancelledEvent.InputTuple, + OutboundTransferCancelledEvent.OutputTuple, + OutboundTransferCancelledEvent.OutputObject + >; + + "OutboundTransferLimitUpdated(uint256,uint256)": TypedContractEvent< + OutboundTransferLimitUpdatedEvent.InputTuple, + OutboundTransferLimitUpdatedEvent.OutputTuple, + OutboundTransferLimitUpdatedEvent.OutputObject + >; + OutboundTransferLimitUpdated: TypedContractEvent< + OutboundTransferLimitUpdatedEvent.InputTuple, + OutboundTransferLimitUpdatedEvent.OutputTuple, + OutboundTransferLimitUpdatedEvent.OutputObject + >; + + "OutboundTransferQueued(uint64)": TypedContractEvent< + OutboundTransferQueuedEvent.InputTuple, + OutboundTransferQueuedEvent.OutputTuple, + OutboundTransferQueuedEvent.OutputObject + >; + OutboundTransferQueued: TypedContractEvent< + OutboundTransferQueuedEvent.InputTuple, + OutboundTransferQueuedEvent.OutputTuple, + OutboundTransferQueuedEvent.OutputObject + >; + + "OutboundTransferRateLimited(address,uint64,uint256,uint256)": TypedContractEvent< + OutboundTransferRateLimitedEvent.InputTuple, + OutboundTransferRateLimitedEvent.OutputTuple, + OutboundTransferRateLimitedEvent.OutputObject + >; + OutboundTransferRateLimited: TypedContractEvent< + OutboundTransferRateLimitedEvent.InputTuple, + OutboundTransferRateLimitedEvent.OutputTuple, + OutboundTransferRateLimitedEvent.OutputObject + >; + + "OwnershipTransferred(address,address)": TypedContractEvent< + OwnershipTransferredEvent.InputTuple, + OwnershipTransferredEvent.OutputTuple, + OwnershipTransferredEvent.OutputObject + >; + OwnershipTransferred: TypedContractEvent< + OwnershipTransferredEvent.InputTuple, + OwnershipTransferredEvent.OutputTuple, + OwnershipTransferredEvent.OutputObject + >; + + "Paused(bool)": TypedContractEvent< + PausedEvent.InputTuple, + PausedEvent.OutputTuple, + PausedEvent.OutputObject + >; + Paused: TypedContractEvent< + PausedEvent.InputTuple, + PausedEvent.OutputTuple, + PausedEvent.OutputObject + >; + + "PauserTransferred(address,address)": TypedContractEvent< + PauserTransferredEvent.InputTuple, + PauserTransferredEvent.OutputTuple, + PauserTransferredEvent.OutputObject + >; + PauserTransferred: TypedContractEvent< + PauserTransferredEvent.InputTuple, + PauserTransferredEvent.OutputTuple, + PauserTransferredEvent.OutputObject + >; + + "PeerUpdated(uint16,bytes32,uint8,bytes32,uint8)": TypedContractEvent< + PeerUpdatedEvent.InputTuple, + PeerUpdatedEvent.OutputTuple, + PeerUpdatedEvent.OutputObject + >; + PeerUpdated: TypedContractEvent< + PeerUpdatedEvent.InputTuple, + PeerUpdatedEvent.OutputTuple, + PeerUpdatedEvent.OutputObject + >; + + "ThresholdChanged(uint8,uint8)": TypedContractEvent< + ThresholdChangedEvent.InputTuple, + ThresholdChangedEvent.OutputTuple, + ThresholdChangedEvent.OutputObject + >; + ThresholdChanged: TypedContractEvent< + ThresholdChangedEvent.InputTuple, + ThresholdChangedEvent.OutputTuple, + ThresholdChangedEvent.OutputObject + >; + + "TransceiverAdded(address,uint256,uint8)": TypedContractEvent< + TransceiverAddedEvent.InputTuple, + TransceiverAddedEvent.OutputTuple, + TransceiverAddedEvent.OutputObject + >; + TransceiverAdded: TypedContractEvent< + TransceiverAddedEvent.InputTuple, + TransceiverAddedEvent.OutputTuple, + TransceiverAddedEvent.OutputObject + >; + + "TransceiverRemoved(address,uint8)": TypedContractEvent< + TransceiverRemovedEvent.InputTuple, + TransceiverRemovedEvent.OutputTuple, + TransceiverRemovedEvent.OutputObject + >; + TransceiverRemoved: TypedContractEvent< + TransceiverRemovedEvent.InputTuple, + TransceiverRemovedEvent.OutputTuple, + TransceiverRemovedEvent.OutputObject + >; + + "TransferRedeemed(bytes32)": TypedContractEvent< + TransferRedeemedEvent.InputTuple, + TransferRedeemedEvent.OutputTuple, + TransferRedeemedEvent.OutputObject + >; + TransferRedeemed: TypedContractEvent< + TransferRedeemedEvent.InputTuple, + TransferRedeemedEvent.OutputTuple, + TransferRedeemedEvent.OutputObject + >; + + "TransferSent(bytes32,bytes32,uint256,uint256,uint16,uint64)": TypedContractEvent< + TransferSent_bytes32_bytes32_uint256_uint256_uint16_uint64_Event.InputTuple, + TransferSent_bytes32_bytes32_uint256_uint256_uint16_uint64_Event.OutputTuple, + TransferSent_bytes32_bytes32_uint256_uint256_uint16_uint64_Event.OutputObject + >; + "TransferSent(bytes32)": TypedContractEvent< + TransferSent_bytes32_Event.InputTuple, + TransferSent_bytes32_Event.OutputTuple, + TransferSent_bytes32_Event.OutputObject + >; + + "Upgraded(address)": TypedContractEvent< + UpgradedEvent.InputTuple, + UpgradedEvent.OutputTuple, + UpgradedEvent.OutputObject + >; + Upgraded: TypedContractEvent< + UpgradedEvent.InputTuple, + UpgradedEvent.OutputTuple, + UpgradedEvent.OutputObject + >; + }; +} diff --git a/evm/ts/src/ethers-contracts/2_1_0/WormholeTransceiver.ts b/evm/ts/src/ethers-contracts/2_1_0/WormholeTransceiver.ts new file mode 100644 index 000000000..c9ff8fc40 --- /dev/null +++ b/evm/ts/src/ethers-contracts/2_1_0/WormholeTransceiver.ts @@ -0,0 +1,994 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common.js"; + +export declare namespace IWormholeTransceiver { + export type WormholeTransceiverInstructionStruct = { + shouldSkipRelayerSend: boolean; + }; + + export type WormholeTransceiverInstructionStructOutput = [ + shouldSkipRelayerSend: boolean + ] & { shouldSkipRelayerSend: boolean }; +} + +export declare namespace TransceiverStructs { + export type TransceiverInstructionStruct = { + index: BigNumberish; + payload: BytesLike; + }; + + export type TransceiverInstructionStructOutput = [ + index: bigint, + payload: string + ] & { index: bigint; payload: string }; + + export type TransceiverMessageStruct = { + sourceNttManagerAddress: BytesLike; + recipientNttManagerAddress: BytesLike; + nttManagerPayload: BytesLike; + transceiverPayload: BytesLike; + }; + + export type TransceiverMessageStructOutput = [ + sourceNttManagerAddress: string, + recipientNttManagerAddress: string, + nttManagerPayload: string, + transceiverPayload: string + ] & { + sourceNttManagerAddress: string; + recipientNttManagerAddress: string; + nttManagerPayload: string; + transceiverPayload: string; + }; +} + +export interface WormholeTransceiverInterface extends Interface { + getFunction( + nameOrSignature: + | "WORMHOLE_TRANSCEIVER_VERSION" + | "additionalBlocks" + | "consistencyLevel" + | "customConsistencyLevel" + | "customConsistencyLevelAddress" + | "encodeWormholeTransceiverInstruction" + | "getMigratesImmutables" + | "getNttManagerOwner" + | "getNttManagerToken" + | "getTransceiverType" + | "getWormholePeer" + | "initialize" + | "isPaused" + | "isVAAConsumed" + | "migrate" + | "nttManager" + | "nttManagerToken" + | "owner" + | "parseWormholeTransceiverInstruction" + | "pauser" + | "quoteDeliveryPrice" + | "receiveMessage" + | "sendMessage" + | "setWormholePeer" + | "transferOwnership" + | "transferPauserCapability" + | "transferTransceiverOwnership" + | "upgrade" + | "wormhole" + ): FunctionFragment; + + getEvent( + nameOrSignatureOrTopic: + | "AdminChanged" + | "BeaconUpgraded" + | "Initialized" + | "NotPaused" + | "OwnershipTransferred" + | "Paused" + | "PauserTransferred" + | "ReceivedMessage" + | "RelayingInfo" + | "SendTransceiverMessage" + | "SetWormholePeer" + | "Upgraded" + ): EventFragment; + + encodeFunctionData( + functionFragment: "WORMHOLE_TRANSCEIVER_VERSION", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "additionalBlocks", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "consistencyLevel", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "customConsistencyLevel", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "customConsistencyLevelAddress", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "encodeWormholeTransceiverInstruction", + values: [IWormholeTransceiver.WormholeTransceiverInstructionStruct] + ): string; + encodeFunctionData( + functionFragment: "getMigratesImmutables", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getNttManagerOwner", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getNttManagerToken", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getTransceiverType", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getWormholePeer", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "initialize", + values?: undefined + ): string; + encodeFunctionData(functionFragment: "isPaused", values?: undefined): string; + encodeFunctionData( + functionFragment: "isVAAConsumed", + values: [BytesLike] + ): string; + encodeFunctionData(functionFragment: "migrate", values?: undefined): string; + encodeFunctionData( + functionFragment: "nttManager", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "nttManagerToken", + values?: undefined + ): string; + encodeFunctionData(functionFragment: "owner", values?: undefined): string; + encodeFunctionData( + functionFragment: "parseWormholeTransceiverInstruction", + values: [BytesLike] + ): string; + encodeFunctionData(functionFragment: "pauser", values?: undefined): string; + encodeFunctionData( + functionFragment: "quoteDeliveryPrice", + values: [BigNumberish, TransceiverStructs.TransceiverInstructionStruct] + ): string; + encodeFunctionData( + functionFragment: "receiveMessage", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "sendMessage", + values: [ + BigNumberish, + TransceiverStructs.TransceiverInstructionStruct, + BytesLike, + BytesLike, + BytesLike + ] + ): string; + encodeFunctionData( + functionFragment: "setWormholePeer", + values: [BigNumberish, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "transferOwnership", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "transferPauserCapability", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "transferTransceiverOwnership", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "upgrade", + values: [AddressLike] + ): string; + encodeFunctionData(functionFragment: "wormhole", values?: undefined): string; + + decodeFunctionResult( + functionFragment: "WORMHOLE_TRANSCEIVER_VERSION", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "additionalBlocks", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "consistencyLevel", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "customConsistencyLevel", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "customConsistencyLevelAddress", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "encodeWormholeTransceiverInstruction", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getMigratesImmutables", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getNttManagerOwner", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getNttManagerToken", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getTransceiverType", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getWormholePeer", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "initialize", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "isPaused", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "isVAAConsumed", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "migrate", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "nttManager", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "nttManagerToken", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "parseWormholeTransceiverInstruction", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "pauser", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "quoteDeliveryPrice", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "receiveMessage", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "sendMessage", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setWormholePeer", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "transferOwnership", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "transferPauserCapability", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "transferTransceiverOwnership", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "upgrade", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "wormhole", data: BytesLike): Result; +} + +export namespace AdminChangedEvent { + export type InputTuple = [previousAdmin: AddressLike, newAdmin: AddressLike]; + export type OutputTuple = [previousAdmin: string, newAdmin: string]; + export interface OutputObject { + previousAdmin: string; + newAdmin: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace BeaconUpgradedEvent { + export type InputTuple = [beacon: AddressLike]; + export type OutputTuple = [beacon: string]; + export interface OutputObject { + beacon: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace InitializedEvent { + export type InputTuple = [version: BigNumberish]; + export type OutputTuple = [version: bigint]; + export interface OutputObject { + version: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NotPausedEvent { + export type InputTuple = [notPaused: boolean]; + export type OutputTuple = [notPaused: boolean]; + export interface OutputObject { + notPaused: boolean; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace OwnershipTransferredEvent { + export type InputTuple = [previousOwner: AddressLike, newOwner: AddressLike]; + export type OutputTuple = [previousOwner: string, newOwner: string]; + export interface OutputObject { + previousOwner: string; + newOwner: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace PausedEvent { + export type InputTuple = [paused: boolean]; + export type OutputTuple = [paused: boolean]; + export interface OutputObject { + paused: boolean; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace PauserTransferredEvent { + export type InputTuple = [oldPauser: AddressLike, newPauser: AddressLike]; + export type OutputTuple = [oldPauser: string, newPauser: string]; + export interface OutputObject { + oldPauser: string; + newPauser: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace ReceivedMessageEvent { + export type InputTuple = [ + digest: BytesLike, + emitterChainId: BigNumberish, + emitterAddress: BytesLike, + sequence: BigNumberish + ]; + export type OutputTuple = [ + digest: string, + emitterChainId: bigint, + emitterAddress: string, + sequence: bigint + ]; + export interface OutputObject { + digest: string; + emitterChainId: bigint; + emitterAddress: string; + sequence: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace RelayingInfoEvent { + export type InputTuple = [ + relayingType: BigNumberish, + refundAddress: BytesLike, + deliveryPayment: BigNumberish + ]; + export type OutputTuple = [ + relayingType: bigint, + refundAddress: string, + deliveryPayment: bigint + ]; + export interface OutputObject { + relayingType: bigint; + refundAddress: string; + deliveryPayment: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace SendTransceiverMessageEvent { + export type InputTuple = [ + recipientChain: BigNumberish, + message: TransceiverStructs.TransceiverMessageStruct + ]; + export type OutputTuple = [ + recipientChain: bigint, + message: TransceiverStructs.TransceiverMessageStructOutput + ]; + export interface OutputObject { + recipientChain: bigint; + message: TransceiverStructs.TransceiverMessageStructOutput; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace SetWormholePeerEvent { + export type InputTuple = [chainId: BigNumberish, peerContract: BytesLike]; + export type OutputTuple = [chainId: bigint, peerContract: string]; + export interface OutputObject { + chainId: bigint; + peerContract: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace UpgradedEvent { + export type InputTuple = [implementation: AddressLike]; + export type OutputTuple = [implementation: string]; + export interface OutputObject { + implementation: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface WormholeTransceiver extends BaseContract { + connect(runner?: ContractRunner | null): WormholeTransceiver; + waitForDeployment(): Promise; + + interface: WormholeTransceiverInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + WORMHOLE_TRANSCEIVER_VERSION: TypedContractMethod<[], [string], "view">; + + additionalBlocks: TypedContractMethod<[], [bigint], "view">; + + consistencyLevel: TypedContractMethod<[], [bigint], "view">; + + customConsistencyLevel: TypedContractMethod<[], [bigint], "view">; + + customConsistencyLevelAddress: TypedContractMethod<[], [string], "view">; + + encodeWormholeTransceiverInstruction: TypedContractMethod< + [instruction: IWormholeTransceiver.WormholeTransceiverInstructionStruct], + [string], + "view" + >; + + getMigratesImmutables: TypedContractMethod<[], [boolean], "view">; + + getNttManagerOwner: TypedContractMethod<[], [string], "view">; + + getNttManagerToken: TypedContractMethod<[], [string], "view">; + + getTransceiverType: TypedContractMethod<[], [string], "view">; + + getWormholePeer: TypedContractMethod< + [chainId: BigNumberish], + [string], + "view" + >; + + initialize: TypedContractMethod<[], [void], "payable">; + + isPaused: TypedContractMethod<[], [boolean], "view">; + + isVAAConsumed: TypedContractMethod<[hash: BytesLike], [boolean], "view">; + + migrate: TypedContractMethod<[], [void], "nonpayable">; + + nttManager: TypedContractMethod<[], [string], "view">; + + nttManagerToken: TypedContractMethod<[], [string], "view">; + + owner: TypedContractMethod<[], [string], "view">; + + parseWormholeTransceiverInstruction: TypedContractMethod< + [encoded: BytesLike], + [IWormholeTransceiver.WormholeTransceiverInstructionStructOutput], + "view" + >; + + pauser: TypedContractMethod<[], [string], "view">; + + quoteDeliveryPrice: TypedContractMethod< + [ + targetChain: BigNumberish, + instruction: TransceiverStructs.TransceiverInstructionStruct + ], + [bigint], + "view" + >; + + receiveMessage: TypedContractMethod< + [encodedMessage: BytesLike], + [void], + "nonpayable" + >; + + sendMessage: TypedContractMethod< + [ + recipientChain: BigNumberish, + instruction: TransceiverStructs.TransceiverInstructionStruct, + nttManagerMessage: BytesLike, + recipientNttManagerAddress: BytesLike, + refundAddress: BytesLike + ], + [void], + "payable" + >; + + setWormholePeer: TypedContractMethod< + [peerChainId: BigNumberish, peerContract: BytesLike], + [void], + "payable" + >; + + transferOwnership: TypedContractMethod< + [newOwner: AddressLike], + [void], + "nonpayable" + >; + + transferPauserCapability: TypedContractMethod< + [newPauser: AddressLike], + [void], + "nonpayable" + >; + + transferTransceiverOwnership: TypedContractMethod< + [newOwner: AddressLike], + [void], + "nonpayable" + >; + + upgrade: TypedContractMethod< + [newImplementation: AddressLike], + [void], + "nonpayable" + >; + + wormhole: TypedContractMethod<[], [string], "view">; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "WORMHOLE_TRANSCEIVER_VERSION" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "additionalBlocks" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "consistencyLevel" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "customConsistencyLevel" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "customConsistencyLevelAddress" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "encodeWormholeTransceiverInstruction" + ): TypedContractMethod< + [instruction: IWormholeTransceiver.WormholeTransceiverInstructionStruct], + [string], + "view" + >; + getFunction( + nameOrSignature: "getMigratesImmutables" + ): TypedContractMethod<[], [boolean], "view">; + getFunction( + nameOrSignature: "getNttManagerOwner" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "getNttManagerToken" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "getTransceiverType" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "getWormholePeer" + ): TypedContractMethod<[chainId: BigNumberish], [string], "view">; + getFunction( + nameOrSignature: "initialize" + ): TypedContractMethod<[], [void], "payable">; + getFunction( + nameOrSignature: "isPaused" + ): TypedContractMethod<[], [boolean], "view">; + getFunction( + nameOrSignature: "isVAAConsumed" + ): TypedContractMethod<[hash: BytesLike], [boolean], "view">; + getFunction( + nameOrSignature: "migrate" + ): TypedContractMethod<[], [void], "nonpayable">; + getFunction( + nameOrSignature: "nttManager" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "nttManagerToken" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "owner" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "parseWormholeTransceiverInstruction" + ): TypedContractMethod< + [encoded: BytesLike], + [IWormholeTransceiver.WormholeTransceiverInstructionStructOutput], + "view" + >; + getFunction( + nameOrSignature: "pauser" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "quoteDeliveryPrice" + ): TypedContractMethod< + [ + targetChain: BigNumberish, + instruction: TransceiverStructs.TransceiverInstructionStruct + ], + [bigint], + "view" + >; + getFunction( + nameOrSignature: "receiveMessage" + ): TypedContractMethod<[encodedMessage: BytesLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "sendMessage" + ): TypedContractMethod< + [ + recipientChain: BigNumberish, + instruction: TransceiverStructs.TransceiverInstructionStruct, + nttManagerMessage: BytesLike, + recipientNttManagerAddress: BytesLike, + refundAddress: BytesLike + ], + [void], + "payable" + >; + getFunction( + nameOrSignature: "setWormholePeer" + ): TypedContractMethod< + [peerChainId: BigNumberish, peerContract: BytesLike], + [void], + "payable" + >; + getFunction( + nameOrSignature: "transferOwnership" + ): TypedContractMethod<[newOwner: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "transferPauserCapability" + ): TypedContractMethod<[newPauser: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "transferTransceiverOwnership" + ): TypedContractMethod<[newOwner: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "upgrade" + ): TypedContractMethod< + [newImplementation: AddressLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "wormhole" + ): TypedContractMethod<[], [string], "view">; + + getEvent( + key: "AdminChanged" + ): TypedContractEvent< + AdminChangedEvent.InputTuple, + AdminChangedEvent.OutputTuple, + AdminChangedEvent.OutputObject + >; + getEvent( + key: "BeaconUpgraded" + ): TypedContractEvent< + BeaconUpgradedEvent.InputTuple, + BeaconUpgradedEvent.OutputTuple, + BeaconUpgradedEvent.OutputObject + >; + getEvent( + key: "Initialized" + ): TypedContractEvent< + InitializedEvent.InputTuple, + InitializedEvent.OutputTuple, + InitializedEvent.OutputObject + >; + getEvent( + key: "NotPaused" + ): TypedContractEvent< + NotPausedEvent.InputTuple, + NotPausedEvent.OutputTuple, + NotPausedEvent.OutputObject + >; + getEvent( + key: "OwnershipTransferred" + ): TypedContractEvent< + OwnershipTransferredEvent.InputTuple, + OwnershipTransferredEvent.OutputTuple, + OwnershipTransferredEvent.OutputObject + >; + getEvent( + key: "Paused" + ): TypedContractEvent< + PausedEvent.InputTuple, + PausedEvent.OutputTuple, + PausedEvent.OutputObject + >; + getEvent( + key: "PauserTransferred" + ): TypedContractEvent< + PauserTransferredEvent.InputTuple, + PauserTransferredEvent.OutputTuple, + PauserTransferredEvent.OutputObject + >; + getEvent( + key: "ReceivedMessage" + ): TypedContractEvent< + ReceivedMessageEvent.InputTuple, + ReceivedMessageEvent.OutputTuple, + ReceivedMessageEvent.OutputObject + >; + getEvent( + key: "RelayingInfo" + ): TypedContractEvent< + RelayingInfoEvent.InputTuple, + RelayingInfoEvent.OutputTuple, + RelayingInfoEvent.OutputObject + >; + getEvent( + key: "SendTransceiverMessage" + ): TypedContractEvent< + SendTransceiverMessageEvent.InputTuple, + SendTransceiverMessageEvent.OutputTuple, + SendTransceiverMessageEvent.OutputObject + >; + getEvent( + key: "SetWormholePeer" + ): TypedContractEvent< + SetWormholePeerEvent.InputTuple, + SetWormholePeerEvent.OutputTuple, + SetWormholePeerEvent.OutputObject + >; + getEvent( + key: "Upgraded" + ): TypedContractEvent< + UpgradedEvent.InputTuple, + UpgradedEvent.OutputTuple, + UpgradedEvent.OutputObject + >; + + filters: { + "AdminChanged(address,address)": TypedContractEvent< + AdminChangedEvent.InputTuple, + AdminChangedEvent.OutputTuple, + AdminChangedEvent.OutputObject + >; + AdminChanged: TypedContractEvent< + AdminChangedEvent.InputTuple, + AdminChangedEvent.OutputTuple, + AdminChangedEvent.OutputObject + >; + + "BeaconUpgraded(address)": TypedContractEvent< + BeaconUpgradedEvent.InputTuple, + BeaconUpgradedEvent.OutputTuple, + BeaconUpgradedEvent.OutputObject + >; + BeaconUpgraded: TypedContractEvent< + BeaconUpgradedEvent.InputTuple, + BeaconUpgradedEvent.OutputTuple, + BeaconUpgradedEvent.OutputObject + >; + + "Initialized(uint64)": TypedContractEvent< + InitializedEvent.InputTuple, + InitializedEvent.OutputTuple, + InitializedEvent.OutputObject + >; + Initialized: TypedContractEvent< + InitializedEvent.InputTuple, + InitializedEvent.OutputTuple, + InitializedEvent.OutputObject + >; + + "NotPaused(bool)": TypedContractEvent< + NotPausedEvent.InputTuple, + NotPausedEvent.OutputTuple, + NotPausedEvent.OutputObject + >; + NotPaused: TypedContractEvent< + NotPausedEvent.InputTuple, + NotPausedEvent.OutputTuple, + NotPausedEvent.OutputObject + >; + + "OwnershipTransferred(address,address)": TypedContractEvent< + OwnershipTransferredEvent.InputTuple, + OwnershipTransferredEvent.OutputTuple, + OwnershipTransferredEvent.OutputObject + >; + OwnershipTransferred: TypedContractEvent< + OwnershipTransferredEvent.InputTuple, + OwnershipTransferredEvent.OutputTuple, + OwnershipTransferredEvent.OutputObject + >; + + "Paused(bool)": TypedContractEvent< + PausedEvent.InputTuple, + PausedEvent.OutputTuple, + PausedEvent.OutputObject + >; + Paused: TypedContractEvent< + PausedEvent.InputTuple, + PausedEvent.OutputTuple, + PausedEvent.OutputObject + >; + + "PauserTransferred(address,address)": TypedContractEvent< + PauserTransferredEvent.InputTuple, + PauserTransferredEvent.OutputTuple, + PauserTransferredEvent.OutputObject + >; + PauserTransferred: TypedContractEvent< + PauserTransferredEvent.InputTuple, + PauserTransferredEvent.OutputTuple, + PauserTransferredEvent.OutputObject + >; + + "ReceivedMessage(bytes32,uint16,bytes32,uint64)": TypedContractEvent< + ReceivedMessageEvent.InputTuple, + ReceivedMessageEvent.OutputTuple, + ReceivedMessageEvent.OutputObject + >; + ReceivedMessage: TypedContractEvent< + ReceivedMessageEvent.InputTuple, + ReceivedMessageEvent.OutputTuple, + ReceivedMessageEvent.OutputObject + >; + + "RelayingInfo(uint8,bytes32,uint256)": TypedContractEvent< + RelayingInfoEvent.InputTuple, + RelayingInfoEvent.OutputTuple, + RelayingInfoEvent.OutputObject + >; + RelayingInfo: TypedContractEvent< + RelayingInfoEvent.InputTuple, + RelayingInfoEvent.OutputTuple, + RelayingInfoEvent.OutputObject + >; + + "SendTransceiverMessage(uint16,tuple)": TypedContractEvent< + SendTransceiverMessageEvent.InputTuple, + SendTransceiverMessageEvent.OutputTuple, + SendTransceiverMessageEvent.OutputObject + >; + SendTransceiverMessage: TypedContractEvent< + SendTransceiverMessageEvent.InputTuple, + SendTransceiverMessageEvent.OutputTuple, + SendTransceiverMessageEvent.OutputObject + >; + + "SetWormholePeer(uint16,bytes32)": TypedContractEvent< + SetWormholePeerEvent.InputTuple, + SetWormholePeerEvent.OutputTuple, + SetWormholePeerEvent.OutputObject + >; + SetWormholePeer: TypedContractEvent< + SetWormholePeerEvent.InputTuple, + SetWormholePeerEvent.OutputTuple, + SetWormholePeerEvent.OutputObject + >; + + "Upgraded(address)": TypedContractEvent< + UpgradedEvent.InputTuple, + UpgradedEvent.OutputTuple, + UpgradedEvent.OutputObject + >; + Upgraded: TypedContractEvent< + UpgradedEvent.InputTuple, + UpgradedEvent.OutputTuple, + UpgradedEvent.OutputObject + >; + }; +} diff --git a/evm/ts/src/ethers-contracts/2_1_0/common.ts b/evm/ts/src/ethers-contracts/2_1_0/common.ts new file mode 100644 index 000000000..56b5f21e9 --- /dev/null +++ b/evm/ts/src/ethers-contracts/2_1_0/common.ts @@ -0,0 +1,131 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + FunctionFragment, + Typed, + EventFragment, + ContractTransaction, + ContractTransactionResponse, + DeferredTopicFilter, + EventLog, + TransactionRequest, + LogDescription, +} from "ethers"; + +export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> + extends DeferredTopicFilter {} + +export interface TypedContractEvent< + InputTuple extends Array = any, + OutputTuple extends Array = any, + OutputObject = any +> { + (...args: Partial): TypedDeferredTopicFilter< + TypedContractEvent + >; + name: string; + fragment: EventFragment; + getFragment(...args: Partial): EventFragment; +} + +type __TypechainAOutputTuple = T extends TypedContractEvent< + infer _U, + infer W +> + ? W + : never; +type __TypechainOutputObject = T extends TypedContractEvent< + infer _U, + infer _W, + infer V +> + ? V + : never; + +export interface TypedEventLog + extends Omit { + args: __TypechainAOutputTuple & __TypechainOutputObject; +} + +export interface TypedLogDescription + extends Omit { + args: __TypechainAOutputTuple & __TypechainOutputObject; +} + +export type TypedListener = ( + ...listenerArg: [ + ...__TypechainAOutputTuple, + TypedEventLog, + ...undefined[] + ] +) => void; + +export type MinEthersFactory = { + deploy(...a: ARGS[]): Promise; +}; + +export type GetContractTypeFromFactory = F extends MinEthersFactory< + infer C, + any +> + ? C + : never; +export type GetARGsTypeFromFactory = F extends MinEthersFactory + ? Parameters + : never; + +export type StateMutability = "nonpayable" | "payable" | "view"; + +export type BaseOverrides = Omit; +export type NonPayableOverrides = Omit< + BaseOverrides, + "value" | "blockTag" | "enableCcipRead" +>; +export type PayableOverrides = Omit< + BaseOverrides, + "blockTag" | "enableCcipRead" +>; +export type ViewOverrides = Omit; +export type Overrides = S extends "nonpayable" + ? NonPayableOverrides + : S extends "payable" + ? PayableOverrides + : ViewOverrides; + +export type PostfixOverrides, S extends StateMutability> = + | A + | [...A, Overrides]; +export type ContractMethodArgs< + A extends Array, + S extends StateMutability +> = PostfixOverrides<{ [I in keyof A]-?: A[I] | Typed }, S>; + +export type DefaultReturnType = R extends Array ? R[0] : R; + +// export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> { +export interface TypedContractMethod< + A extends Array = Array, + R = any, + S extends StateMutability = "payable" +> { + (...args: ContractMethodArgs): S extends "view" + ? Promise> + : Promise; + + name: string; + + fragment: FunctionFragment; + + getFragment(...args: ContractMethodArgs): FunctionFragment; + + populateTransaction( + ...args: ContractMethodArgs + ): Promise; + staticCall( + ...args: ContractMethodArgs + ): Promise>; + send(...args: ContractMethodArgs): Promise; + estimateGas(...args: ContractMethodArgs): Promise; + staticCallResult(...args: ContractMethodArgs): Promise; +} diff --git a/evm/ts/src/ethers-contracts/2_1_0/factories/NttManager__factory.ts b/evm/ts/src/ethers-contracts/2_1_0/factories/NttManager__factory.ts new file mode 100644 index 000000000..23cb153d5 --- /dev/null +++ b/evm/ts/src/ethers-contracts/2_1_0/factories/NttManager__factory.ts @@ -0,0 +1,2038 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { + Contract, + ContractFactory, + ContractTransactionResponse, + Interface, +} from "ethers"; +import type { + Signer, + BigNumberish, + AddressLike, + ContractDeployTransaction, + ContractRunner, +} from "ethers"; +import type { NonPayableOverrides } from "../common.js"; +import type { NttManager, NttManagerInterface } from "../NttManager.js"; + +const _abi = [ + { + type: "constructor", + inputs: [ + { + name: "_token", + type: "address", + internalType: "address", + }, + { + name: "_mode", + type: "uint8", + internalType: "enum IManagerBase.Mode", + }, + { + name: "_chainId", + type: "uint16", + internalType: "uint16", + }, + { + name: "_rateLimitDuration", + type: "uint64", + internalType: "uint64", + }, + { + name: "_skipRateLimiting", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "NTT_MANAGER_VERSION", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "attestationReceived", + inputs: [ + { + name: "sourceChainId", + type: "uint16", + internalType: "uint16", + }, + { + name: "sourceNttManagerAddress", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "payload", + type: "tuple", + internalType: "struct TransceiverStructs.NttManagerMessage", + components: [ + { + name: "id", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "sender", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "payload", + type: "bytes", + internalType: "bytes", + }, + ], + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "cancelOutboundQueuedTransfer", + inputs: [ + { + name: "messageSequence", + type: "uint64", + internalType: "uint64", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "chainId", + inputs: [], + outputs: [ + { + name: "", + type: "uint16", + internalType: "uint16", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "completeInboundQueuedTransfer", + inputs: [ + { + name: "digest", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "completeOutboundQueuedTransfer", + inputs: [ + { + name: "messageSequence", + type: "uint64", + internalType: "uint64", + }, + ], + outputs: [ + { + name: "", + type: "uint64", + internalType: "uint64", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "executeMsg", + inputs: [ + { + name: "sourceChainId", + type: "uint16", + internalType: "uint16", + }, + { + name: "sourceNttManagerAddress", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "message", + type: "tuple", + internalType: "struct TransceiverStructs.NttManagerMessage", + components: [ + { + name: "id", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "sender", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "payload", + type: "bytes", + internalType: "bytes", + }, + ], + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "getCurrentInboundCapacity", + inputs: [ + { + name: "chainId_", + type: "uint16", + internalType: "uint16", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getCurrentOutboundCapacity", + inputs: [], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getInboundLimitParams", + inputs: [ + { + name: "chainId_", + type: "uint16", + internalType: "uint16", + }, + ], + outputs: [ + { + name: "", + type: "tuple", + internalType: "struct IRateLimiter.RateLimitParams", + components: [ + { + name: "limit", + type: "uint72", + internalType: "TrimmedAmount", + }, + { + name: "currentCapacity", + type: "uint72", + internalType: "TrimmedAmount", + }, + { + name: "lastTxTimestamp", + type: "uint64", + internalType: "uint64", + }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getInboundQueuedTransfer", + inputs: [ + { + name: "digest", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "tuple", + internalType: "struct IRateLimiter.InboundQueuedTransfer", + components: [ + { + name: "amount", + type: "uint72", + internalType: "TrimmedAmount", + }, + { + name: "txTimestamp", + type: "uint64", + internalType: "uint64", + }, + { + name: "recipient", + type: "address", + internalType: "address", + }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getMigratesImmutables", + inputs: [], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getMode", + inputs: [], + outputs: [ + { + name: "", + type: "uint8", + internalType: "uint8", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getOutboundLimitParams", + inputs: [], + outputs: [ + { + name: "", + type: "tuple", + internalType: "struct IRateLimiter.RateLimitParams", + components: [ + { + name: "limit", + type: "uint72", + internalType: "TrimmedAmount", + }, + { + name: "currentCapacity", + type: "uint72", + internalType: "TrimmedAmount", + }, + { + name: "lastTxTimestamp", + type: "uint64", + internalType: "uint64", + }, + ], + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "getOutboundQueuedTransfer", + inputs: [ + { + name: "queueSequence", + type: "uint64", + internalType: "uint64", + }, + ], + outputs: [ + { + name: "", + type: "tuple", + internalType: "struct IRateLimiter.OutboundQueuedTransfer", + components: [ + { + name: "recipient", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "refundAddress", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "amount", + type: "uint72", + internalType: "TrimmedAmount", + }, + { + name: "txTimestamp", + type: "uint64", + internalType: "uint64", + }, + { + name: "recipientChain", + type: "uint16", + internalType: "uint16", + }, + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "transceiverInstructions", + type: "bytes", + internalType: "bytes", + }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getPeer", + inputs: [ + { + name: "chainId_", + type: "uint16", + internalType: "uint16", + }, + ], + outputs: [ + { + name: "", + type: "tuple", + internalType: "struct INttManager.NttManagerPeer", + components: [ + { + name: "peerAddress", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "tokenDecimals", + type: "uint8", + internalType: "uint8", + }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getThreshold", + inputs: [], + outputs: [ + { + name: "", + type: "uint8", + internalType: "uint8", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getTransceiverInfo", + inputs: [], + outputs: [ + { + name: "", + type: "tuple[]", + internalType: "struct TransceiverRegistry.TransceiverInfo[]", + components: [ + { + name: "registered", + type: "bool", + internalType: "bool", + }, + { + name: "enabled", + type: "bool", + internalType: "bool", + }, + { + name: "index", + type: "uint8", + internalType: "uint8", + }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getTransceivers", + inputs: [], + outputs: [ + { + name: "result", + type: "address[]", + internalType: "address[]", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "initialize", + inputs: [], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "isMessageApproved", + inputs: [ + { + name: "digest", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "isMessageExecuted", + inputs: [ + { + name: "digest", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "isPaused", + inputs: [], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "messageAttestations", + inputs: [ + { + name: "digest", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "count", + type: "uint8", + internalType: "uint8", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "migrate", + inputs: [], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "mode", + inputs: [], + outputs: [ + { + name: "", + type: "uint8", + internalType: "enum IManagerBase.Mode", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "nextMessageSequence", + inputs: [], + outputs: [ + { + name: "", + type: "uint64", + internalType: "uint64", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "owner", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "pause", + inputs: [], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "pauser", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "quoteDeliveryPrice", + inputs: [ + { + name: "recipientChain", + type: "uint16", + internalType: "uint16", + }, + { + name: "transceiverInstructions", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "rateLimitDuration", + inputs: [], + outputs: [ + { + name: "", + type: "uint64", + internalType: "uint64", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "removeTransceiver", + inputs: [ + { + name: "transceiver", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setInboundLimit", + inputs: [ + { + name: "limit", + type: "uint256", + internalType: "uint256", + }, + { + name: "chainId_", + type: "uint16", + internalType: "uint16", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setOutboundLimit", + inputs: [ + { + name: "limit", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setPeer", + inputs: [ + { + name: "peerChainId", + type: "uint16", + internalType: "uint16", + }, + { + name: "peerContract", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "decimals", + type: "uint8", + internalType: "uint8", + }, + { + name: "inboundLimit", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setThreshold", + inputs: [ + { + name: "threshold", + type: "uint8", + internalType: "uint8", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setTransceiver", + inputs: [ + { + name: "transceiver", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "token", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "tokenDecimals", + inputs: [], + outputs: [ + { + name: "", + type: "uint8", + internalType: "uint8", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "transceiverAttestedToMessage", + inputs: [ + { + name: "digest", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "index", + type: "uint8", + internalType: "uint8", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "transfer", + inputs: [ + { + name: "amount", + type: "uint256", + internalType: "uint256", + }, + { + name: "recipientChain", + type: "uint16", + internalType: "uint16", + }, + { + name: "recipient", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "uint64", + internalType: "uint64", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "transfer", + inputs: [ + { + name: "amount", + type: "uint256", + internalType: "uint256", + }, + { + name: "recipientChain", + type: "uint16", + internalType: "uint16", + }, + { + name: "recipient", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "refundAddress", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "shouldQueue", + type: "bool", + internalType: "bool", + }, + { + name: "transceiverInstructions", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "uint64", + internalType: "uint64", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "transferOwnership", + inputs: [ + { + name: "newOwner", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "transferPauserCapability", + inputs: [ + { + name: "newPauser", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "unpause", + inputs: [], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "upgrade", + inputs: [ + { + name: "newImplementation", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "AdminChanged", + inputs: [ + { + name: "previousAdmin", + type: "address", + indexed: false, + internalType: "address", + }, + { + name: "newAdmin", + type: "address", + indexed: false, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "BeaconUpgraded", + inputs: [ + { + name: "beacon", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "InboundTransferLimitUpdated", + inputs: [ + { + name: "chainId", + type: "uint16", + indexed: true, + internalType: "uint16", + }, + { + name: "oldLimit", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "newLimit", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "InboundTransferQueued", + inputs: [ + { + name: "digest", + type: "bytes32", + indexed: false, + internalType: "bytes32", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Initialized", + inputs: [ + { + name: "version", + type: "uint64", + indexed: false, + internalType: "uint64", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "MessageAlreadyExecuted", + inputs: [ + { + name: "sourceNttManager", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "msgHash", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "MessageAttestedTo", + inputs: [ + { + name: "digest", + type: "bytes32", + indexed: false, + internalType: "bytes32", + }, + { + name: "transceiver", + type: "address", + indexed: false, + internalType: "address", + }, + { + name: "index", + type: "uint8", + indexed: false, + internalType: "uint8", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "NotPaused", + inputs: [ + { + name: "notPaused", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "OutboundTransferCancelled", + inputs: [ + { + name: "sequence", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "recipient", + type: "address", + indexed: false, + internalType: "address", + }, + { + name: "amount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "OutboundTransferLimitUpdated", + inputs: [ + { + name: "oldLimit", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "newLimit", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "OutboundTransferQueued", + inputs: [ + { + name: "queueSequence", + type: "uint64", + indexed: false, + internalType: "uint64", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "OutboundTransferRateLimited", + inputs: [ + { + name: "sender", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "sequence", + type: "uint64", + indexed: false, + internalType: "uint64", + }, + { + name: "amount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "currentCapacity", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "OwnershipTransferred", + inputs: [ + { + name: "previousOwner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newOwner", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Paused", + inputs: [ + { + name: "paused", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "PauserTransferred", + inputs: [ + { + name: "oldPauser", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newPauser", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "PeerUpdated", + inputs: [ + { + name: "chainId_", + type: "uint16", + indexed: true, + internalType: "uint16", + }, + { + name: "oldPeerContract", + type: "bytes32", + indexed: false, + internalType: "bytes32", + }, + { + name: "oldPeerDecimals", + type: "uint8", + indexed: false, + internalType: "uint8", + }, + { + name: "peerContract", + type: "bytes32", + indexed: false, + internalType: "bytes32", + }, + { + name: "peerDecimals", + type: "uint8", + indexed: false, + internalType: "uint8", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ThresholdChanged", + inputs: [ + { + name: "oldThreshold", + type: "uint8", + indexed: false, + internalType: "uint8", + }, + { + name: "threshold", + type: "uint8", + indexed: false, + internalType: "uint8", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "TransceiverAdded", + inputs: [ + { + name: "transceiver", + type: "address", + indexed: false, + internalType: "address", + }, + { + name: "transceiversNum", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "threshold", + type: "uint8", + indexed: false, + internalType: "uint8", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "TransceiverRemoved", + inputs: [ + { + name: "transceiver", + type: "address", + indexed: false, + internalType: "address", + }, + { + name: "threshold", + type: "uint8", + indexed: false, + internalType: "uint8", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "TransferRedeemed", + inputs: [ + { + name: "digest", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "TransferSent", + inputs: [ + { + name: "recipient", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "refundAddress", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "amount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "fee", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "recipientChain", + type: "uint16", + indexed: false, + internalType: "uint16", + }, + { + name: "msgSequence", + type: "uint64", + indexed: false, + internalType: "uint64", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "TransferSent", + inputs: [ + { + name: "digest", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Upgraded", + inputs: [ + { + name: "implementation", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "BurnAmountDifferentThanBalanceDiff", + inputs: [ + { + name: "burnAmount", + type: "uint256", + internalType: "uint256", + }, + { + name: "balanceDiff", + type: "uint256", + internalType: "uint256", + }, + ], + }, + { + type: "error", + name: "CallerNotTransceiver", + inputs: [ + { + name: "caller", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "CancellerNotSender", + inputs: [ + { + name: "canceller", + type: "address", + internalType: "address", + }, + { + name: "sender", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "CapacityCannotExceedLimit", + inputs: [ + { + name: "newCurrentCapacity", + type: "uint72", + internalType: "TrimmedAmount", + }, + { + name: "newLimit", + type: "uint72", + internalType: "TrimmedAmount", + }, + ], + }, + { + type: "error", + name: "DeliveryPaymentTooLow", + inputs: [ + { + name: "requiredPayment", + type: "uint256", + internalType: "uint256", + }, + { + name: "providedPayment", + type: "uint256", + internalType: "uint256", + }, + ], + }, + { + type: "error", + name: "DisabledTransceiver", + inputs: [ + { + name: "transceiver", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "InboundQueuedTransferNotFound", + inputs: [ + { + name: "digest", + type: "bytes32", + internalType: "bytes32", + }, + ], + }, + { + type: "error", + name: "InboundQueuedTransferStillQueued", + inputs: [ + { + name: "digest", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "transferTimestamp", + type: "uint256", + internalType: "uint256", + }, + ], + }, + { + type: "error", + name: "InvalidFork", + inputs: [ + { + name: "evmChainId", + type: "uint256", + internalType: "uint256", + }, + { + name: "blockChainId", + type: "uint256", + internalType: "uint256", + }, + ], + }, + { + type: "error", + name: "InvalidInitialization", + inputs: [], + }, + { + type: "error", + name: "InvalidMode", + inputs: [ + { + name: "mode", + type: "uint8", + internalType: "uint8", + }, + ], + }, + { + type: "error", + name: "InvalidPauser", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "InvalidPeer", + inputs: [ + { + name: "chainId", + type: "uint16", + internalType: "uint16", + }, + { + name: "peerAddress", + type: "bytes32", + internalType: "bytes32", + }, + ], + }, + { + type: "error", + name: "InvalidPeerChainIdZero", + inputs: [], + }, + { + type: "error", + name: "InvalidPeerDecimals", + inputs: [], + }, + { + type: "error", + name: "InvalidPeerSameChainId", + inputs: [], + }, + { + type: "error", + name: "InvalidPeerZeroAddress", + inputs: [], + }, + { + type: "error", + name: "InvalidRecipient", + inputs: [], + }, + { + type: "error", + name: "InvalidRefundAddress", + inputs: [], + }, + { + type: "error", + name: "InvalidTargetChain", + inputs: [ + { + name: "targetChain", + type: "uint16", + internalType: "uint16", + }, + { + name: "thisChain", + type: "uint16", + internalType: "uint16", + }, + ], + }, + { + type: "error", + name: "InvalidTransceiverZeroAddress", + inputs: [], + }, + { + type: "error", + name: "MessageNotApproved", + inputs: [ + { + name: "msgHash", + type: "bytes32", + internalType: "bytes32", + }, + ], + }, + { + type: "error", + name: "NoEnabledTransceivers", + inputs: [], + }, + { + type: "error", + name: "NonRegisteredTransceiver", + inputs: [ + { + name: "transceiver", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "NotAnEvmAddress", + inputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + }, + { + type: "error", + name: "NotEnoughCapacity", + inputs: [ + { + name: "currentCapacity", + type: "uint256", + internalType: "uint256", + }, + { + name: "amount", + type: "uint256", + internalType: "uint256", + }, + ], + }, + { + type: "error", + name: "NotImplemented", + inputs: [], + }, + { + type: "error", + name: "NotInitializing", + inputs: [], + }, + { + type: "error", + name: "NotMigrating", + inputs: [], + }, + { + type: "error", + name: "NumberOfDecimalsNotEqual", + inputs: [ + { + name: "decimals", + type: "uint8", + internalType: "uint8", + }, + { + name: "decimalsOther", + type: "uint8", + internalType: "uint8", + }, + ], + }, + { + type: "error", + name: "OnlyDelegateCall", + inputs: [], + }, + { + type: "error", + name: "OutboundQueuedTransferNotFound", + inputs: [ + { + name: "queueSequence", + type: "uint64", + internalType: "uint64", + }, + ], + }, + { + type: "error", + name: "OutboundQueuedTransferStillQueued", + inputs: [ + { + name: "queueSequence", + type: "uint64", + internalType: "uint64", + }, + { + name: "transferTimestamp", + type: "uint256", + internalType: "uint256", + }, + ], + }, + { + type: "error", + name: "OwnableInvalidOwner", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "OwnableUnauthorizedAccount", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "PeerNotRegistered", + inputs: [ + { + name: "chainId", + type: "uint16", + internalType: "uint16", + }, + ], + }, + { + type: "error", + name: "ReentrancyGuardReentrantCall", + inputs: [], + }, + { + type: "error", + name: "RefundFailed", + inputs: [ + { + name: "refundAmount", + type: "uint256", + internalType: "uint256", + }, + ], + }, + { + type: "error", + name: "RequireContractIsNotPaused", + inputs: [], + }, + { + type: "error", + name: "RequireContractIsPaused", + inputs: [], + }, + { + type: "error", + name: "RetrievedIncorrectRegisteredTransceivers", + inputs: [ + { + name: "retrieved", + type: "uint256", + internalType: "uint256", + }, + { + name: "registered", + type: "uint256", + internalType: "uint256", + }, + ], + }, + { + type: "error", + name: "StaticcallFailed", + inputs: [], + }, + { + type: "error", + name: "ThresholdTooHigh", + inputs: [ + { + name: "threshold", + type: "uint256", + internalType: "uint256", + }, + { + name: "transceivers", + type: "uint256", + internalType: "uint256", + }, + ], + }, + { + type: "error", + name: "TooManyTransceivers", + inputs: [], + }, + { + type: "error", + name: "TransceiverAlreadyAttestedToMessage", + inputs: [ + { + name: "nttManagerMessageHash", + type: "bytes32", + internalType: "bytes32", + }, + ], + }, + { + type: "error", + name: "TransceiverAlreadyEnabled", + inputs: [ + { + name: "transceiver", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "TransferAmountHasDust", + inputs: [ + { + name: "amount", + type: "uint256", + internalType: "uint256", + }, + { + name: "dust", + type: "uint256", + internalType: "uint256", + }, + ], + }, + { + type: "error", + name: "UndefinedRateLimiting", + inputs: [], + }, + { + type: "error", + name: "UnexpectedDeployer", + inputs: [ + { + name: "expectedOwner", + type: "address", + internalType: "address", + }, + { + name: "owner", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "UnexpectedMsgValue", + inputs: [], + }, + { + type: "error", + name: "ZeroAmount", + inputs: [], + }, + { + type: "error", + name: "ZeroThreshold", + inputs: [], + }, +] as const; + +const _bytecode = + "0x61016034620005af57601f6200634338819003918201601f19168301916001600160401b03831184841017620005625780849260a094604052833981010312620005af578051906001600160a01b0382168203620005af576020810151916002831015620005af5760408201519161ffff83168303620005af576060810151906001600160401b03821690818303620005af576080015180159182158203620005af5715809281620005a6575b5082156200058a575b505062000578576080527f8561949d1c6242cee5c5a5aeb6b9c190ee611d7742fcec65d9e5b1341ea04d8954620001147e758a264b9bdbe3295fe36bd6ff7abaa122f48bf70e90af04a1b8a32d21e4e15460ff8360081c1614620005b4565b7ffd6568c039679b3b7cc93c26c41d9379b7b1bec1677120493b467688302cb11f5460005b60ff8360081c168110620003dd57505060005b60ff8260081c168110620003565750604060ff6200016d92161115620005b4565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805460ff8160401c1662000344576002600160401b03196001600160401b03821601620002f8575b50503060a05260c0526101009182526101209081526101404681523360e05260405191615d2193846200062285396080518481816114a401528181611b0a01528181611f8e015281816129ac0152818161337b01528181614ca5015281816154d1015281816155640152818161568c015281816158730152615925015260a051846139c9015260c05184818161029001528181610519015281816105660152818161289801528181612f7401528181613b0b01528181613d830152818161403d015261442b015260e05184611c4f0152518381816104b00152818161200701528181612133015281816128e601528181613a9301528181613e0801526140be01525182818161134501528181611e480152818161294f0152818161463d015261521101525181818161044e01528181613a45015281816142ca0152614d3c0152f35b6001600160401b0319166001600160401b039081179091556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a13880620001b6565b60405163f92ee8a960e01b8152600490fd5b6001808201808311620003c7575b60ff8460081c1681106200037d5750506001016200014c565b8190620003c06200038e85620005d2565b90546003906200039e85620005d2565b60018060a01b03915490841b1c169260018060a01b03921b1c161415620005b4565b0162000364565b634e487b7160e01b600052601160045260246000fd5b620003e881620005d2565b9054600382901b81901c6001600160a01b031660009081527f49bca747e973430e858f2f5de357b8dba36ea6d375b81bdb5d53dfaabf0b3a7f60205260409081902090519291906001600160401b036060850190811190851117620005625760608401604052546200048b60ff821615801592838752602087019360ff808360081c1615928315875260101c16908160408a01529262000545575b5050620005b4565b60018060401b03600160ff6040870151161b87161615159051151592600092835b60ff8a60081c168110620004fb575b505050826001959492620004d9620004f495620004e29414620005b4565b151514620005b4565b60ff60408188169201511610620005b4565b0162000139565b6200050681620005d2565b9054600391821b1c6001600160a01b039081169185901b84901c16146200053057600101620004ac565b5060019350849150829050620004d9620004bb565b9091508162000558575b50388062000483565b905015386200054f565b634e487b7160e01b600052604160045260246000fd5b60405163e543ef0560e01b8152600490fd5b159150816200059d575b503880620000b5565b90503862000594565b925038620000ac565b600080fd5b15620005bc57565b634e487b7160e01b600052600160045260246000fd5b7e758a264b9bdbe3295fe36bd6ff7abaa122f48bf70e90af04a1b8a32d21e4e180548210156200060b5760005260206000200190600090565b634e487b7160e01b600052603260045260246000fdfe6080604052600436101561001257600080fd5b6000803560e01c80630271725014612c29578063036de8af14612b9e5780630677df5414612b7f5780630900f01014612718578063186ce612146126e857806319017175146126b25780631f97c9a8146124c0578063203e4a9b146121bd57806323d75e3114612177578063295a52121461211d578063396c16b7146120e15780633b97e856146120c65780633f4ba83a146120525780634b4fd03b14611ff4578063689f90c314611fb257806374aa7bfc14611f6e5780637c91863414611df85780638129fc1c14611bc35780638413bcba14611aa75780638456cb5914611a2a57806386e11ffa14611a0557806389c619dd146119a55780638da5cb5b1461196f5780638e3ba8c9146119385780638fd3ab80146117f95780639057412d1461167c578063961b94d01461161e57806397c35146146113695780639a8a05921461132a5780639d782454146111125780639f86029c14610e075780639fd0506d14610dd1578063b150fc5514610c29578063b187bd2614610bfb578063b293f97f14610b65578063b4d591bb14610aa4578063c0b07bde14610a5e578063c128d170146109e2578063d788c14714610957578063da4856a114610924578063e5a9860314610878578063e75235b81461084a578063f2fde38b1461070b578063f5cfec18146106e8578063f7514fbc146102bf578063fc0c546a1461027a5763fd96063c1461022257600080fd5b346102775760203660031901126102775760606102406004356132d9565b6040805182516001600160481b031681526020808401516001600160401b031690820152918101516001600160a01b031690820152f35b80fd5b50346102775780600319360112610277576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b5034610277576020366003190112610277576004356001600160401b03811681036106e4576102ec613a0a565b6002600080516020615bac83398151915254146106d2576001600160401b038116600052600080516020615c6c83398151915260205260406000206040519061033482612cf9565b8054825260046001916001810154602085015261ffff60028201546001600160481b03811660408701526001600160401b038160481c16606087015260881c16608085015260018060a01b0360038201541660a0850152016040518092869083549361039f85612ed6565b80855294600181169081156106ae575060011461066f575b50506103c592500382612d65565b60c08201526001600160401b036060820151161561064e5760a08101516001600160a01b03163381036106215750606061049160407ff80e572ae1b63e2449629b6c7d783add85c36473926f216077f17ee002bcfd07936001600160401b038616600052600080516020615c6c833981519152602052610447826000206131f8565b01516104727f0000000000000000000000000000000000000000000000000000000000000000614bd5565b61047a612f4e565b906001600160401b0360ff82169160081c16614a65565b926001600160401b0360405191168152336020820152836040820152a17f0000000000000000000000000000000000000000000000000000000000000000600281101561060b578061055b575060405163a9059cbb60e01b602082015233602482015260448101919091526105469061051781606481015b03601f198101835282612d65565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166153bb565b6001600080516020615c8c8339815191525580f35b600181036105ef57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b156105ea576040516340c10f1960e01b815233600482015260248101929092526000908290604490829084905af180156105de576105cf575b50610546565b6105d890612ce6565b386105c9565b6040513d6000823e3d90fd5b600080fd5b6040516366001a8960e01b815260ff9091166004820152602490fd5b634e487b7160e01b600052602160045260246000fd5b60405163ceb40a8560e01b81523360048201526001600160a01b03919091166024820152604490fd5b0390fd5b604051635feafa3160e11b81526001600160401b0383166004820152602490fd5b8852602088208892505b84831061069357506103c5935050810160200138806103b7565b81935090816020925483858901015201910190918492610679565b915050602092506103c594915060ff191682840152151560051b82010138806103b7565b6040516309e3d0f360e11b8152600490fd5b5080fd5b503461027757806003193601126102775760206107036132c2565b604051908152f35b5034610277576020366003190112610277576001600160a01b03600435818116908181036108155761074c9061073f61346d565b61074761346d565b614964565b7f3031d39df71efbb605646fc51d7571499445af538fa6dd17ce8c07e8118ed97891825460ff600080516020615c0c833981519152541680820361082c575050908391825b8454811015610828578460005281817f357eda4c1707ce60b55a439f3dc12fcacea5ca0fd863e2fc179a916cf05fccd1015416803b1561082457848091602460405180948193632c7b84dd60e11b83528960048401525af1908115610819578591610801575b5050600101610791565b61080a90612ce6565b6108155783386107f7565b8380fd5b6040513d87823e3d90fd5b8480fd5b8380f35b604492506040519163d2a13a2960e01b835260048301526024820152fd5b5034610277578060031936011261027757602060ff600080516020615b2c8339815191525416604051908152f35b50346102775760203660031901126102775760043560ff8116908181036105ea576108a161346d565b8115610912577f2a855b929b9a53c6fb5b5ed248b27e502b709c088e036a5aa17620c8fc5085a99161090c60ff92600080516020615b2c833981519152805493851985161790556108f061394e565b6040805160ff9490951684168552921660208401528291820190565b0390a180f35b60405163831761d760e01b8152600490fd5b50346102775761093336612de8565b906002600080516020615bac83398151915254146106d2576109549261326f565b80f35b50346102775760203660031901126102775761ffff610974612c7c565b61097c612fde565b5016600052600080516020615c2c8339815191526020526109de6109a36040600020613045565b6040519182918291909160406001600160401b038160608401956001600160481b038082511686526020820151166020860152015116910152565b0390f35b50346102775760203660031901126102775761ffff90610a00612c7c565b906020604051610a0f81612d2f565b828152015216600052600080516020615b0c83398151915260205260408060002060ff8251610a3d81612d2f565b60208260018554958685520154169101908152835192835251166020820152f35b50346102775780600319360112610277576109de604051610a7e81612d2f565b60058152640322e312e360dc1b6020820152604051918291602083526020830190612cc1565b50346102775780600319360112610277576040518091600080516020615bec83398151915290815480845260208094019081938352600080516020615b4c83398151915290835b818110610b485750505084610b01910385612d65565b60405193838594850191818652518092526040850193925b828110610b2857505050500390f35b83516001600160a01b031685528695509381019392810192600101610b19565b82546001600160a01b031684529286019260019283019201610aeb565b5060c036600319011261027757610b7a612c8d565b906084359182151583036106e45760a4356001600160401b03928382116102775750610baa903690600401612da1565b610bb2613a0a565b6002600080516020615bac83398151915254146106d257602093610be0926064359060443590600435614021565b6001600080516020615c8c8339815191525560405191168152f35b503461027757806003193601126102775760206002600080516020615bac8339815191525414604051908152f35b503461027757806003193601126102775760405180600080516020615bec83398151915280548084526020809401918552600080516020615b4c83398151915290855b818110610db45750505081610c82910382612d65565b8051610c8d816130b5565b91610c9b6040519384612d65565b818352610ca7826130b5565b601f1901855b818110610d98575050845b828110610d19575050506040519180830190808452825180925280604085019301945b828110610ce85784840385f35b85518051151585528083015115158584015260409081015160ff169085015294810194606090930192600101610cdb565b9294926001906001600160a01b03610d31828561325b565b5116600052600080516020615c4c8339815191528652604060002060405190610d5982612d14565b5460ff9081811615158352818160081c1615158984015260101c166040820152610d83828961325b565b52610d8e818861325b565b5001949294610cb8565b8590610da5979597612fde565b82828a01015201959395610cad565b82546001600160a01b031684529285019260019283019201610c6c565b5034610277578060031936011261027757600080516020615cac833981519152546040516001600160a01b039091168152602090f35b5034610277576020806003193601126106e4576004356001600160a01b03818116929183810361082457610e3961346d565b83156111005783600052600080516020615c4c8339815191529081845260ff928360406000205416156110e757856000528285528360406000205460081c16156110ce578560005282855260406000209261ff001993848154169055600080516020615c0c833981519152938454868160081c169182156110ba5761ff0060001980940160081b169116178555600080516020615bcc8339815191528054926001600160401b03908a6000528952600193610f0a8260018b60406000205460101c161b1983161692821683106134a6565b6001600160401b0319161790558892600080516020615bec8339815191528054928b5b848110610fc2575b5050505050509260409492610f7d8293610f707f697a3853515b88013ad432f29f53d406debc9509ed6d9313dcfe115250fcd18f99976134a6565b610f78614af8565b615020565b5460081c16600080516020615b2c8339815191529081548381168210610fb4575b50505416908351928352820152a161095461394e565b60ff19161781553880610f9e565b838c610fcd83613291565b929054600393841b1c1614610fe457508501610f2d565b9596509091938281019081116110a657906110128461100561103094613291565b905490891b1c1691613291565b90919060018060a01b038084549260031b9316831b921b1916179055565b8254801561109257946040999794610f7d948a9894610f70947f697a3853515b88013ad432f29f53d406debc9509ed6d9313dcfe115250fcd18f9e9c99019261107884613291565b81939154921b1b1916905555949799849799839750610f35565b634e487b7160e01b8c52603160045260248cfd5b634e487b7160e01b8d52601160045260248dfd5b634e487b7160e01b8b52601160045260248bfd5b6040516307d86e9160e21b815260048101879052602490fd5b604051630d583f4760e41b815260048101879052602490fd5b604051632f44bd7760e01b8152600490fd5b50346102775761112136612de8565b9033600052600080516020615c4c83398151915260209080825260ff60406000205460081c161561131257600080516020615bac8339815191529160028354146106d25761ffff861680600052600080516020615b0c833981519152825284604060002054036112f4575060405163b3f07bbd60e01b8152918183806111ab898b60048401614861565b038173__$93083e246e55d56d98f3df2872cd16bfd0$__5af49283156112e95788936112ba575b5033600052815260ff60406000205460101c166111ef818461307f565b6112a157606061128093927f35a2101eaac94b493e0dfca061f9a7f087913fde8678e7cde0aca9897edba0e5926001600160401b03858c52600080516020615b6c833981519152835260408c2090610100600160481b03825491806001861b16908360081c161760081b1690610100600160481b0319161790556040519185835233908301526040820152a1612e69565b611288578480f35b546002146106d2576112999261326f565b388080808480f35b604051631089c4a160e11b815260048101849052602490fd5b9092508181813d83116112e2575b6112d28183612d65565b810103126105ea575191386111d2565b503d6112c8565b6040513d8a823e3d90fd5b6044908560405191635788c0fd60e11b835260048301526024820152fd5b60405163a0ae911d60e01b8152336004820152602490fd5b5034610277578060031936011261027757602060405161ffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b506020366003190112610277576001600160401b03600435166004350361027757611392613a0a565b6002600080516020615bac83398151915254146106d2576001600160401b0360043516600052600080516020615c6c833981519152602052604060002090604051916113dd83612cf9565b805483526001810154602084015261ffff60028201546001600160481b03811660408601526001600160401b038160481c16606086015260881c16608084015260018060a01b0360038201541660a08401526040518281939060048401549361144585612ed6565b80855294600181169081156115fa57506001146115b5575b505061146b92500382612d65565b60c08201526001600160401b03606082015116156115935761149a6001600160401b0360608301511642612fd1565b6001600160401b037f0000000000000000000000000000000000000000000000000000000000000000161161155d5761153a6020916001600160401b0360043516600052600080516020615c6c83398151915283526114fc60406000206131f8565b6040810151608082015182518584015160a085015160c090950151946001600160a01b031693909261ffff16906001600160481b03166004356142c2565b6001600080516020615c8c833981519152556001600160401b0360405191168152f35b6001600160401b0360606044920151166040519063c06cf05f60e01b82526001600160401b036004351660048301526024820152fd5b6024604051635feafa3160e11b81526001600160401b03600435166004820152fd5b60049193949250018252602082205b8183106115de57505090602061146b92820101388061145d565b60209193508060019154838588010152019101909183926115c4565b9150506020925061146b94915060ff191682840152151560051b820101388061145d565b50606036600319011261027757611633612c8d565b60443561163e613a0a565b6002600080516020615bac83398151915254146106d2576020918161153a926040519261166a84612d2f565b60018452853681860137600435613d67565b503461027757604036600319011261027757611696612c7c565b6024356001600160401b0381116117f5576116b5903690600401612da1565b91604051918290600080516020615bec833981519152828154918287526020809701908652600080516020615b4c83398151915292865b888282106117d65750505061170392500383612d65565b8261172d8351966040519788928392635b10743960e11b8452604060048501526044840190612cc1565b906024830152038173__$93083e246e55d56d98f3df2872cd16bfd0$__5af49081156117cb5783949561176694926117a7575b50613c0f565b604051926040840160408552835180915285606086019401915b8181106117935750505082938301520390f35b825185529386019391860191600101611780565b6117c49192503d8087833e6117bc8183612d65565b81019061310e565b9038611760565b6040513d85823e3d90fd5b85546001600160a01b03168452600195860195889550930192016116ec565b8280fd5b50346102775780600319360112610277576118126139c6565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0080546001600160401b038082169060018201918183116119225760ff8460401c16908115611915575b5061190357600160401b911680926001600160481b03191617179081835560ff7f7487ca88d037ca20519908b1ee7556206bef53bce0226a348750cb9d4f688e4e5416156118f1577fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2926020926118d161394e565b6118d9614af8565b68ff000000000000000019169055604051908152a180f35b604051632866815360e11b8152600490fd5b60405163f92ee8a960e01b8152600490fd5b905081831611153861185c565b634e487b7160e01b600052601160045260246000fd5b50346102775760403660031901126102775760243560ff811681036105ea5761196560209160043561307f565b6040519015158152f35b5034610277578060031936011261027757600080516020615b8c833981519152546040516001600160a01b039091168152602090f35b5034610277576020366003190112610277576119fa6001600160401b036020926040600080516020615bcc83398151915254916004358152600080516020615b6c8339815191528652205460081c1616613b96565b60ff60405191168152f35b5034610277578060031936011261027757611a1e612fde565b506109de6109a3612ffd565b5034610277578060031936011261027757600080516020615b8c83398151915254611a5d906001600160a01b031661341a565b600080516020615bac83398151915260028154146106d257600290557f0e2fb031ee032dc02d8011dc50b816eb450cf856abd8261680dac74f72165bd2602060405160018152a180f35b503461027757602036600319011261027757600435611ac4613a0a565b6002600080516020615bac83398151915254146106d257611ae4816132d9565b602081016001600160401b03908181511615611baa57611b078282511642612fd1565b827f00000000000000000000000000000000000000000000000000000000000000001611611b88578385527f4e8909a01183a67951f5a6147d6e76ed02ea890c72afea01a9edee91edc609b8602052604080862086815560010186905583015183518691610546916001600160481b0316906001600160a01b031687613a3a565b516040516301cb739d60e71b8152600481019490945216602483015250604490fd5b604051630301bcaf60e61b815260048101859052602490fd5b508060031936011261027757611bd76139c6565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805460ff8160401c1615906001600160401b03811680159081611df0575b6001149081611de6575b159081611ddd575b506119035767ffffffffffffffff198116600117835581611dbe575b50611c4d61537a565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0381163303611d95575034611d8357611c8c61537a565b611c9461537a565b611c9c61537a565b6001600080516020615bac83398151915255600080516020615cac83398151915280546001600160a01b03191633179055611cd561537a565b611cdd61537a565b611ce633614964565b611cee61537a565b611cf661537a565b6001600080516020615c8c83398151915255611d2d610100600160481b0360ff611d26611d21612f4e565b614ac0565b1617613757565b611d3561394e565b611d3d614af8565b611d45575080f35b68ff00000000000000001981541690557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a180f35b60405163bd28e88960e01b8152600490fd5b604051636345072160e11b81526001600160a01b03919091166004820152336024820152604490fd5b68ffffffffffffffffff19166801000000000000000117825538611c44565b90501538611c28565b303b159150611c20565b839150611c16565b503461027757608036600319011261027757611e12612c7c565b6024356044359060ff82168092036105ea57611e2c61346d565b61ffff92838116938415611f5c578215611f4a578315611f38577f0000000000000000000000000000000000000000000000000000000000000000168414611f26577f1456404e7f41f35c3daac941bb50bad417a66275c3040061b4287d787719599d926080928560005260ff600080516020615b0c8339815191529384602052611f0960406000209183600160405194611ec686612d2f565b8054865201541696602084019788528a6000526020526001604060002086815501868519825416179055611f04611efb612f4e565b806064356134db565b613528565b51935116604051938452602084015260408301526060820152a280f35b60405163101b8f9560e11b8152600490fd5b60405163ade64f0b60e01b8152600490fd5b60405163f839a0cb60e01b8152600490fd5b60405163100b0f2760e11b8152600490fd5b503461027757806003193601126102775760206040516001600160401b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b5034610277578060031936011261027757602060ff7f5443fea4dc453d96b81ce55b62e11a4094cc4cbb8a360956a7253cfdb42506cb54166040519015158152f35b50346102775780600319360112610277577f000000000000000000000000000000000000000000000000000000000000000090600282101561203e5760208260ff60405191168152f35b634e487b7160e01b81526021600452602490fd5b503461027757806003193601126102775761206b61346d565b600080516020615bac83398151915260028154036120b457600190557fe11c2112add17fb763d3bd59f63b10429c3e11373da4fb8ef6725107a2fdc4b06020604051838152a180f35b604051637e38d1d360e11b8152600490fd5b503461027757806003193601126102775760206119fa612f4e565b50346102775760203660031901126102775760ff60406020926004358152600080516020615b6c83398151915284522054166040519015158152f35b50346102775780600319360112610277576040517f0000000000000000000000000000000000000000000000000000000000000000600281101561216357602092508152f35b634e487b7160e01b83526021600452602483fd5b503461027757806003193601126102775760206001600160401b037fad78307a8b51804c575f26039dcb87c58925afb3b7c08732f3b21b942aed7a765416604051908152f35b5034610277576020806003193601126106e4576004356001600160a01b03811691828203610815576121ed61346d565b82156111005782600052600080516020615c4c8339815191529182825260ff9081604060002054166000146123965784600052838352604060002061010061ff00198254161790555b600080516020615bec83398151915290815491600160401b831015612380578261101291600161226895019055613291565b600080516020615c0c83398151915292835461ff0061228b848360081c1661393d565b60081b169061ff00191617809455600080516020615bcc83398151915280546001600160401b0390818116918860005284875260018660406000205460101c161b1682179182146123675767ffffffffffffffff19161790557ff05962b5774c658e85ed80c91a75af9d66d2af2253dda480f90bce78aff5eda594606094909390929091612317614af8565b84600052825280600080516020615b2c833981519152805482811615612358575b5054169260405194855260081c16908301526040820152a161095461394e565b60ff1916600117815538612338565b604051638d68f84d60e01b815260048101899052602490fd5b634e487b7160e01b600052604160045260246000fd5b600080516020615c0c8339815191528281541660408110156124ae57604051906123bf82612d14565b6001825285820190600182526040830190815288600052878752604060002092511515918662ff000061ff0086549351151560081b16935160101b1693169062ffffff1916171717905580548361241781831661393d565b169060ff19161790557f3031d39df71efbb605646fc51d7571499445af538fa6dd17ce8c07e8118ed978805490600160401b8210156123805760018201808255821015612498576000527f357eda4c1707ce60b55a439f3dc12fcacea5ca0fd863e2fc179a916cf05fccd10180546001600160a01b03191686179055612236565b634e487b7160e01b600052603260045260246000fd5b60405163891684c360e01b8152600490fd5b5034610277576020366003190112610277576004356001600160401b0381168091036106e457606060c06040516124f681612cf9565b84815284602082015284604082015284838201528460808201528460a08201520152600052600080516020615c6c83398151915260205260406000206040519061253f82612cf9565b805482526001810154602083015261ffff60028201546001600160481b03811660408501526001600160401b038160481c16606085015260881c16608083015260018060a01b0360038201541660a0830152604051838194906004840154936125a785612ed6565b808552946001811690811561268e5750600114612649575b50506125cd92500383612d65565b60c081019182526109de6040519283926020845280516020850152602081015160408501526001600160481b0360408201511660608501526001600160401b03606082015116608085015261ffff60808201511660a085015260a0600180821b039101511660c08401525160e080840152610100830190612cc1565b60049193949250018252602082205b8183106126725750509060206125cd9282010138806125bf565b6020919350806001915483858901015201910190918492612658565b915050602092506125cd94915060ff191682840152151560051b82010138806125bf565b5034610277576020366003190112610277576126cc61346d565b6109546126e36126da612f4e565b806004356134db565b613757565b503461027757604036600319011261027757610954612705612c8d565b61270d61346d565b611f046126da612f4e565b5034610277576020806003193601126106e4576001600160a01b03600435818116908181036108245761274961346d565b6127516139c6565b3b15612b24577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b031916821790557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8480a27f7487ca88d037ca20519908b1ee7556206bef53bce0226a348750cb9d4f688e4e918254916127de60ff8416156134a6565b60ff199283166001178455303b156108245760405163011fa75760e71b8152858160048183305af18015612ad957612b11575b5060405163689f90c360e01b81528281600481305afa908115612ad9578691612ae4575b501561286d575b50507f5443fea4dc453d96b81ce55b62e11a4094cc4cbb8a360956a7253cfdb42506cb818154169055815416905580f35b604051637e062a3560e11b81528281600481305afa908115612ad9578691612a9b575b50816128c0927f0000000000000000000000000000000000000000000000000000000000000000169116146134a6565b6040516314ad290960e11b81528181600481305afa908115610819578591612a65575b507f0000000000000000000000000000000000000000000000000000000000000000906002821015612a51576002811015612a515761292291146134a6565b604051634d4502c960e11b81528181600481305afa8015610819578590612a1b575b612977915061ffff807f0000000000000000000000000000000000000000000000000000000000000000169116146134a6565b604051631d2a9eff60e21b8152908082600481305afa9081156108195785916129db575b506129d491506001600160401b03807f0000000000000000000000000000000000000000000000000000000000000000169116146134a6565b388061283c565b905081813d8311612a14575b6129f18183612d65565b8101031261081557516001600160401b0381168103610815576129d4903861299b565b503d6129e7565b508181813d8311612a4a575b612a318183612d65565b8101031261082457612a456129779161519c565b612944565b503d612a27565b634e487b7160e01b86526021600452602486fd5b90508181813d8311612a94575b612a7c8183612d65565b810103126108245751600281101561082457386128e3565b503d612a72565b90508281813d8311612ad2575b612ab28183612d65565b81010312612ace5751908082168203612ace57906128c0612890565b8580fd5b503d612aa8565b6040513d88823e3d90fd5b612b049150833d8511612b0a575b612afc8183612d65565b8101906134c3565b38612835565b503d612af2565b612b1d90959195612ce6565b9338612811565b60405162461bcd60e51b815260048101849052602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b5034610277576020366003190112610277576020611965600435612e69565b5034610277576020366003190112610277576004356001600160a01b03818116918290036117f557612be081600080516020615b8c833981519152541661341a565b600080516020615cac83398151915280546001600160a01b031981168417909155167f51c4874e0f23f262e04a38c51751336dde72126d67f53eb672aaff02996b3ef68380a380f35b503461027757602036600319011261027757610703610472612c77604060209461ffff612c54612c7c565b612c5c612fde565b50168152600080516020615c2c833981519152865220613045565b61336f565b6004359061ffff821682036105ea57565b6024359061ffff821682036105ea57565b60005b838110612cb15750506000910152565b8181015183820152602001612ca1565b90602091612cda81518092818552858086019101612c9e565b601f01601f1916010190565b6001600160401b03811161238057604052565b60e081019081106001600160401b0382111761238057604052565b606081019081106001600160401b0382111761238057604052565b604081019081106001600160401b0382111761238057604052565b60a081019081106001600160401b0382111761238057604052565b90601f801991011681019081106001600160401b0382111761238057604052565b6001600160401b03811161238057601f01601f191660200190565b81601f820112156105ea57803590612db882612d86565b92612dc66040519485612d65565b828452602083830101116105ea57816000926020809301838601378301015290565b90600319906060828401126105ea5760043561ffff811681036105ea579260243592604435916001600160401b03918284116105ea5760609084830301126105ea5760405192612e3784612d14565b806004013584526024810135602085015260448101359283116105ea57612e619201600401612da1565b604082015290565b6001600160401b039060ff612ec281600080516020615b2c8339815191525416938493600080516020615bcc8339815191525490600052600080516020615b6c83398151915260205260406000205460081c1616613b96565b1610159081612ecf575090565b9050151590565b90600182811c92168015612f06575b6020831014612ef057565b634e487b7160e01b600052602260045260246000fd5b91607f1691612ee5565b3d15612f3b573d90612f2182612d86565b91612f2f6040519384612d65565b82523d6000602084013e565b606090565b519060ff821682036105ea57565b600080604051602081019063313ce56760e01b825260048152612f7081612d2f565b51907f00000000000000000000000000000000000000000000000000000000000000005afa612f9d612f10565b9015612fbf576020818051810103126105ea576020612fbc9101612f40565b90565b604051631222cd8360e01b8152600490fd5b9190820391821161192257565b60405190612feb82612d14565b60006040838281528260208201520152565b6040519061300a82612d14565b8160406001600160401b03600080516020615ccc833981519152546001600160481b0380821685528160481c16602085015260901c16910152565b9060405161305281612d14565b60406001600160401b038294546001600160481b0380821685528160481c16602085015260901c16910152565b906001600160401b0391600052600080516020615b6c833981519152602052600160ff60406000205460081c92161b1616151590565b6001600160401b0381116123805760051b60200190565b81601f820112156105ea5780516130e281612d86565b926130f06040519485612d65565b818452602082840101116105ea57612fbc9160208085019101612c9e565b9060209081838203126105ea5782516001600160401b03938482116105ea57019080601f830112156105ea578151613145816130b5565b946040906131566040519788612d65565b828752858088019360051b860101948486116105ea57868101935b86851061318357505050505050505090565b84518381116105ea5782019084601f1983890301126105ea578451906131a882612d2f565b6131b38a8401612f40565b825285830151918583116105ea576131d2898c809695819601016130cc565b83820152815201940193613171565b8181106131ec575050565b600081556001016131e1565b60046000918281558260018201558260028201558260038201550161321d8154612ed6565b8061322757505050565b82601f8211600114613239575050555b565b9091808252613257601f60208420940160051c8401600185016131e1565b5555565b80518210156124985760209160051b010190565b91908161327c918461487c565b91909161328c57613237926151ab565b505050565b600080516020615bec833981519152805482101561249857600052600080516020615b4c8339815191520190600090565b6132ca612fde565b50612fbc610472612c77612ffd565b6132e1612fde565b506000527f4e8909a01183a67951f5a6147d6e76ed02ea890c72afea01a9edee91edc609b860205260406000206040519061331b82612d14565b80546001600160481b038116835260481c6001600160401b03166020830152600101546001600160a01b0316604082015290565b8115613359570490565b634e487b7160e01b600052601260045260246000fd5b6001600160401b0390817f000000000000000000000000000000000000000000000000000000000000000016918215613403576133f0828260ff936040610100600160481b03960151164203816133d4602085019889519383875160081c160261334f565b9160081c1601915160081c168082106000146133fc57506149d8565b9251169160081b161790565b90506149d8565b506020015160ff16610100600160481b0317919050565b600080516020615cac83398151915254336001600160a01b039182161415919082613460575b505061344857565b60405163e2a08e5d60e01b8152336004820152602490fd5b1633141590503880613440565b600080516020615b8c833981519152546001600160a01b0316330361348e57565b60405163118cdaa760e01b8152336004820152602490fd5b156134ad57565b634e487b7160e01b600052600160045260246000fd5b908160209103126105ea575180151581036105ea5790565b61351361350e60ff92610100600160481b0394956134f887614ac0565b90858116868316101561351e5750958691614a65565b6149d8565b92169160081b161790565b9050958691614a65565b9061ffff16906000828152600080516020615c2c8339815191526020526040812091825491613555612f4e565b926001600160481b0394858216956001600160401b0396878460081c169485158061374c575b15613633575050856136269460ff6040989561361086613617966135c28c7f739ed886fd81a3ddc9f4b327ab69152e513cd45b26fda0c73660eaca8e1193019f9d9a614ad2565b815467ffffffffffffffff60901b19918a169190911679ffffffffffffffff000000000000000000ffffffffffffffffff1990911617428c1660901b67ffffffffffffffff60901b16179055565b1690614a65565b9360ff82169160081c16614a65565b82519182526020820152a2565b61363f612c7785613045565b908761364b8185615808565b156136f45761365b91929361582a565b906136668284615808565b1590506136eb576136769161582a565b6136808682615808565b6136c957956136269460ff829561361086613617966136c460409d7f739ed886fd81a3ddc9f4b327ab69152e513cd45b26fda0c73660eaca8e1193019f9d9a614ad2565b6135c2565b604051631e74e8fb60e31b815290821660048201529085166024820152604490fd5b5060ff16613676565b926136ff919361582a565b9061370a8282615a3d565b89808360081c169160081c160191898311613738575060ff610100600160481b0391169160081b1617613676565b634e487b7160e01b81526011600452602490fd5b5060ff85161561357b565b600080516020615ccc833981519152805491613771612f4e565b916001600160481b0393848116916001600160401b0395868360081c1693841580613932575b1561383f5750856138329460ff6040989585613617957f7e3b0fc388be9d36273f66210aed83be975df3a9adfffa4c734033f498f362cd9c9a9754600160481b600160901b038960481b1690600160481b600160901b0319161782555b815479ffffffffffffffff000000000000000000ffffffffffffffffff1916908816174260901b67ffffffffffffffff60901b161790551690614a65565b82519182526020820152a1565b61384a612c77612ffd565b866000926138588282615808565b156138f05761386892935061582a565b6138728183615808565b156138e7576138809161582a565b61388a8682615808565b6136c957956138329460ff82957f7e3b0fc388be9d36273f66210aed83be975df3a9adfffa4c734033f498f362cd9a989561361795600160481b600160901b0360409c60481b16600160481b600160901b031984161782556137f4565b5060ff16613880565b6138f99161582a565b906139048282615a3d565b89808360081c169160081c160191898311613738575060ff610100600160481b0391169160081b1617613880565b5060ff841615613797565b60ff1660ff81146119225760010190565b60ff600080516020615b2c833981519152541660405161396d81612d2f565b60ff600080516020615c0c83398151915254818116835260081c168060208301528083116139a857505160ff166139a15750565b1561091257565b82604491604051916313c3d1b160e01b835260048301526024820152fd5b307f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146139f857565b604051633c64f99360e21b8152600490fd5b600080516020615c8c8339815191526002815414613a285760029055565b604051633ee5aeb560e01b8152600490fd5b9291613a69906104727f0000000000000000000000000000000000000000000000000000000000000000614bd5565b906000937f504e6efe18ab9eed10dc6501a417f5b12a2f7f2b1593aed9b89f9bce3cf29a918580a27f000000000000000000000000000000000000000000000000000000000000000093600285101561203e5784613afe575060405163a9059cbb60e01b60208201526001600160a01b0390911660248201526044810191909152909150613237906105178160648101610509565b9193600181036105ef57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690813b156117f5576040516340c10f1960e01b81526001600160a01b03919091166004820152602481019490945291929181908390604490829084905af1908115613b8a5750613b81575b50565b61323790612ce6565b604051903d90823e3d90fd5b670101010101010101670f0f0f0f0f0f0f0f60ff926755555555555555558160011c169003673333333333333333808260021c169116016001600160401b03670fffffffffffffff8260041c16911601160260381c1690565b9060406020612fbc9360ff81511684520151918160208201520190612cc1565b909291805191613c1e836130b5565b92604091613c2f6040519586612d65565b818552613c3b826130b5565b602090601f190136878301376000976000955b848710613c6057505050505050509190565b909192939495988685613cd9868d613c7f60018060a01b03918861325b565b511680600052600080516020615c4c8339815191528252613caa60ff866000205460101c168961325b565b51908551808095819463b5634c7360e01b835261ffff60049916898401526024998a8401526044830190613bef565b03915afa908115613d5c57908d91600091613d2a575b50613cfb81928d61325b565b528301809311613d175750506001909901959493929190613c4e565b601190634e487b7160e01b600052526000fd5b91508782813d8311613d55575b613d418183612d65565b810103126102775750518c90613cfb613cef565b503d613d37565b8a513d6000823e3d90fd5b9193929093600094831561400f578115613ffd578215613feb577f000000000000000000000000000000000000000000000000000000000000000095613dad3088614bfd565b60018060a01b03881690604098613df28a516323b872dd60e01b6020820152602499338b830152306044830152606482015260648152613dec81612d4a565b846153bb565b613e0582613e003084614bfd565b612fd1565b927f00000000000000000000000000000000000000000000000000000000000000006002811015613fd857600114613f56575b50505061ffff8316600052600080516020615b0c83398151915260205260ff6001896000200154168015613f4557613e79613e71612f4e565b9182846134db565b98613e956001600160401b039260ff8c16848d60081c16614a65565b808403613f1f5750507fad78307a8b51804c575f26039dcb87c58925afb3b7c08732f3b21b942aed7a769081549080821698818a14613f0d5750938787878b968e968e96613ef59a60018b0116906001600160401b031916179055614c5a565b613f0457612fbc9533946142c2565b50505091505090565b634e487b7160e01b8652601160045285fd5b60449189613f2e869384612fd1565b9151926338f831a560e11b84526004840152820152fd5b885163ade64f0b60e01b8152600490fd5b803b15610824578480918a8d5180948193630852cd8d60e31b83528960048401525af18015613fce57613fb9575b50613f90903090614bfd565b808203613f9d5780613e38565b60449250878a51926302156a8f60e01b84526004840152820152fd5b93613fc7613f909295612ce6565b9390613f84565b8b513d87823e3d90fd5b634e487b7160e01b865260216004528986fd5b60405163717f139360e11b8152600490fd5b604051634e46966960e11b8152600490fd5b604051631f2a200560e01b8152600490fd5b9493929190600093861561400f578215613ffd578315613feb577f0000000000000000000000000000000000000000000000000000000000000000966140673089614bfd565b9060018060a01b038916916040996140ad8b516323b872dd60e01b602082015260249433868301523060448301526064820152606481526140a781612d4a565b856153bb565b6140bb82613e003084614bfd565b937f00000000000000000000000000000000000000000000000000000000000000006002811015614263576001146141df575b50505061ffff8416600052600080516020615b0c83398151915260205260ff60018a6000200154169081156141ce57614130614128612f4e565b9283856134db565b9961414d6001600160401b03938c8560ff82169160081c16614a65565b8085036141bf5750507fad78307a8b51804c575f26039dcb87c58925afb3b7c08732f3b21b942aed7a769182549181831699828b146141ae575050938787878b968e968e96613ef59a60018b0116906001600160401b031916179055614c5a565b634e487b7160e01b81526011600452fd5b90604492613f2e869384612fd1565b895163ade64f0b60e01b8152600490fd5b803b1561425f57898091858e5180948193630852cd8d60e31b83528a60048401525af1801561425557614240575b50614219903090614bfd565b80820361422657806140ee565b6044928b51926302156a8f60e01b84526004840152820152fd5b9861424e614219929a612ce6565b989061420d565b8c513d8c823e3d90fd5b8980fd5b634e487b7160e01b8b526021600452848bfd5b906020828203126105ea5781516001600160401b0381116105ea57612fbc92016130cc565b9060606040612fbc9380518452602081015160208501520151918160408201520190612cc1565b9591906142ee7f0000000000000000000000000000000000000000000000000000000000000000614bd5565b604051928384600080516020615bec83398151915260208154938481520190600052600080516020615b4c8339815191529260005b81811061483f57505061433892500385612d65565b7f3031d39df71efbb605646fc51d7571499445af538fa6dd17ce8c07e8118ed978549084511561482d5761438b6000916040519384928392635b10743960e11b8452604060048501526044840190612cc1565b906024830152038173__$93083e246e55d56d98f3df2872cd16bfd0$__5af49081156105de57600091614812575b506143c5848285613c0f565b94908534106147f3576143d88634612fd1565b806147e4575b50606060806040516143ef81612d4a565b6000815260006020820152600060408201526000838201520152604051986144168a612d4a565b6001600160481b0385168a5260018060a01b037f00000000000000000000000000000000000000000000000000000000000000001660208b01528760408b015261ffff861660608b0152604051998a60208101106001600160401b0360208d0111176123805760806000918c60206144f19e01604052838152828201526040519c8d9283926315cfa3cb60e11b8452602060048501526001600160481b038151166024850152602081015160448501526040810151606485015261ffff6060820151166084850152015160a060a484015260c4830190612cc1565b038173__$93083e246e55d56d98f3df2872cd16bfd0$__5af4998a156105de5761456e9a6000928d9284926147c8575b506001600160401b036040519361453785612d14565b16835260018060a01b031660208301526040820152604051809b81926311692f3760e31b835260206004840152602483019061429b565b038173__$93083e246e55d56d98f3df2872cd16bfd0$__5af49889156105de576000996147a3575b5061ffff8516600052600080516020615b0c8339815191526020526040600020549282519284156147875760005b8481106146b0575050505050509161ffff6080926146057fe54e51e42099622516fa3b48e9733581c9dbdcb771cafb093f745a0532a359829561047a612f4e565b9260405193845260208401521660408201526001600160401b0387166060820152a3604051614685602282602081019461ffff60f01b7f000000000000000000000000000000000000000000000000000000000000000060f01b1686526146758151809260208686019101612c9e565b8101036002810184520182612d65565b5190207f3e6ae56314c6da8b461d872f41c6d0bb69317b9d0232805aaccfa45df1a16fa0600080a290565b6001600160a01b036146c2828461325b565b5116906146cf818661325b565b5182600052600080516020615c4c8339815191526020526146fb60ff60406000205460101c168661325b565b51833b156105ea57614741938f8f938d8c60009661475361ffff956040519b8c998a988997634b5b050560e01b895216600488015260a0602488015260a4870190613bef565b85810360031901604487015290612cc1565b916064840152608483015203925af19182156105de57600192614778575b50016145c4565b61478190612ce6565b38614771565b604051630ebc95af60e21b815261ffff88166004820152602490fd5b6147c19199503d806000833e6147b98183612d65565b810190614276565b9738614596565b6147dd9192503d8086833e6147b98183612d65565b9038614521565b6147ed90615495565b386143de565b6040516306a91e3760e51b815260048101879052346024820152604490fd5b61482791503d806000833e6117bc8183612d65565b386143b9565b6040516334e7b19560e11b8152600490fd5b84546001600160a01b0316835260019485019489945060209093019201614323565b60409061ffff612fbc9493168152816020820152019061429b565b60405163b3f07bbd60e01b8152919392602091839182916148a1919060048401614861565b038173__$93083e246e55d56d98f3df2872cd16bfd0$__5af49081156105de57600091614932575b506148d381612e69565b1561491a576148e181615163565b92836148ef57509150600090565b7f4069dff8c9df7e38d2867c0910bd96fd61787695e5380281148c04932d02bef2600080a360009190565b60249060405190630451c4fb60e41b82526004820152fd5b906020823d60201161495c575b8161494c60209383612d65565b81010312610277575051386148c9565b3d915061493f565b6001600160a01b039081169081156149bf57600080516020615b8c83398151915280546001600160a01b031981168417909155167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b604051631e4fbdf760e01b815260006004820152602490fd5b6001600160401b03908181116149ec571690565b60405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b6064820152608490fd5b9060ff8091169116039060ff821161192257565b60ff16604d811161192257600a0a90565b919060ff821660ff8216818114614ab9571115614a9857614a8d612fbc9392614a9292614a40565b614a54565b9061334f565b614a8d90614aa592614a40565b908181029181830414901517156119225790565b5050505090565b60ff811660081015612fbc5750600890565b90600160481b600160901b0382549160481b1690600160481b600160901b031916179055565b600080516020615c0c8339815191525460ff8160081c16614b29600080516020615bec8339815191525482146134a6565b60005b818110614bad575060005b818110614b50575050604060ff613237921611156134a6565b6001808201808311611922575b838110614b6e575050600101614b37565b8190614ba7614b7c85613291565b90546003916001600160a01b03919082614b9587613291565b905490861b1c16931b1c1614156134a6565b01614b5d565b80614bcf614bbc600193613291565b848060a01b0391549060031b1c16615020565b01614b2c565b468103614bdf5750565b604490604051906377d879fb60e01b82526004820152466024820152fd5b6040516370a0823160e01b602082019081526001600160a01b039093166024808301919091528152600092839291614c3481612d14565b51915afa614c40612f10565b9015612fbf576020818051810103126105ea576020015190565b9293949095979691614c6d611d21612f4e565b9889610100600160481b0360ff614c9861350e6001600160401b039e8f848816908860081c16614a65565b60081b91909116911617967f00000000000000000000000000000000000000000000000000000000000000008b161561501957614cd3612fde565b50614cdf612c77612ffd565b614ce98982615a3d565b8b808a60081c169160081c16105b811580615012575b614fec5781614fe4575b50614d2d57505050505050614d28929350614d23816154c7565b615559565b600090565b60049293949650614d609795977f0000000000000000000000000000000000000000000000000000000000000000614bd5565b614d686132c2565b956040958b87519116978882526020998a830152878201527ff33512b84e24a49905c26c6991942fc5a9652411769fc1e448f967cdb049f08a60603392a2855192614db284612cf9565b8352878301988952858301906001600160481b038093168252614e598c60608601814216815261ffff608088019416845260a087019533875260c08801998a528b600052600080516020615c6c8339815191528d528a600020975188556001809e5190890155600288019551166001600160481b03198654161785555116839067ffffffffffffffff60481b82549160481b169067ffffffffffffffff60481b1916179055565b51815461ffff60881b191660889190911b61ffff60881b16179055516003820180546001600160a01b0319166001600160a01b0392909216919091179055915180519098919092019190811161238057614eb38254612ed6565b601f8111614fa9575b5084601f8211600114614f245781907f69add1952a6a6b9cb86f04d05f0cb605cbb469a50ae916139d34495a9991481f979899600092614f19575b5050600019600383901b1c191690871b1790555b51908152a1612fbc34615495565b015190503880614ef7565b601f1982169883600052866000209960005b818110614f9457509188999a91847f69add1952a6a6b9cb86f04d05f0cb605cbb469a50ae916139d34495a9991481f9a959410614f7b575b505050811b019055614f0b565b015160001960f88460031b161c19169055388080614f6e565b828401518c559a89019a928801928801614f36565b614fd4908360005286600020601f840160051c810191888510614fda575b601f0160051c01906131e1565b38614ebc565b9091508190614fc7565b905038614d09565b604487614ff76132c2565b90604051916326fb55dd60e01b835260048301526024820152fd5b5080614cff565b6000614cf7565b9060018060a01b038092169182600052600080516020615c4c83398151915260205260406000206040519061505482612d14565b5460ff91615090838316158015938484526020840193604087808460081c1615938415885260101c1691019581875292615149575b50506134a6565b600080516020615bcc83398151915254956001600160401b036001976001868651161b161615159151151591600091600090600080516020615c0c8339815191525497878960081c16925b838110615111575b5050505061323796975091615107916150ff82879695146134a6565b1515146134a6565b51169116116134a6565b828261511c83613291565b90549060031b1c1614615130578b016150db565b5098998a995093508291506150ff9050846151076150e3565b9091508161515a575b503880615089565b90501538615152565b600052600080516020615b6c8339815191526020526040600020805460ff81166151955760ff19166001179055600090565b5050600190565b519061ffff821682036105ea57565b90604080910151916151db825193635399ded560e11b855260206004860152848060009384936024830190612cc1565b038173__$93083e246e55d56d98f3df2872cd16bfd0$__5af493841561536e5781946152c9575b505061ffff80606085015116907f0000000000000000000000000000000000000000000000000000000000000000168082036152ac57505081615268615246612f4e565b806152638188516001600160401b0360ff82169160081c16614a65565b6134db565b930151916001600160a01b03198316615295575081836152889286615680565b61328c5761323792613a3a565b5163033b960d60e41b815260048101839052602490fd5b60449250835191631ee5902560e11b835260048301526024820152fd5b909193503d8083833e6152dc8183612d65565b8101906020818303126117f55780516001600160401b0391828211610824570160a0818403126108155784519361531285612d4a565b81516001600160481b03811681036106e45785526020820151602086015285820151868601526153446060830161519c565b6060860152608082015192831161027757506153619291016130cc565b6080820152913880615202565b508251903d90823e3d90fd5b60ff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460401c16156153a957565b604051631afcd79f60e31b8152600490fd5b604051615419916001600160a01b03166153d482612d2f565b6000806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af1615413612f10565b91615a72565b8051908161542657505050565b82806154369383010191016134c3565b1561543e5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b600080808084335af16154a6612f10565b50156154af5750565b60249060405190630b288dc560e21b82526004820152fd5b6001600160401b037f00000000000000000000000000000000000000000000000000000000000000001615613b7e576154fe612fde565b5061550a612c77612ffd565b600160481b600160901b03615530600080516020615ccc8339815191529384549361582a565b60481b16906001600160401b0360901b4260901b1690600160481b600160d01b03191617179055565b6001600160401b03807f0000000000000000000000000000000000000000000000000000000000000000161561328c5761ffff61323793615598612fde565b5016600090808252600080516020615c2c833981519152806020526155c2612c7760408520613045565b91835260205260408220805467ffffffffffffffff60901b191642851660901b67ffffffffffffffff60901b161781559383906155ff8184615a3d565b60081c16838260081c160183811160001461566c5750610100600160481b0360ff615629856149d8565b92169160081b1617918084546001600160481b0381169361564a8587615a3d565b5060081c16908360081c1610600014615664575090614ad2565b905090614ad2565b60ff615629610100600160481b03926149d8565b90926001600160401b037f0000000000000000000000000000000000000000000000000000000000000000811615615801576156ba612fde565b5061ffff8516600052600080516020615c2c8339815191526020526156e5612c776040600020613045565b6156ef8582615a3d565b81808660081c169160081c16105b61571657505050615711614d289282615866565b615919565b7f7f63c9251d82a933210c2b6d0b0f116252c3c116788120e64e8e8215df6f31629450906001602094926157db6040519161575083612d14565b6001600160481b03958616835242811688840190815260a085901b859003958616604080860191825260008a81527f4e8909a01183a67951f5a6147d6e76ed02ea890c72afea01a9edee91edc609b88c522094518554925170ffffffffffffffffffffffffffffffffff19909316981697909717911660481b67ffffffffffffffff60481b16178255565b019151166bffffffffffffffffffffffff60a01b825416179055604051908152a1600190565b60006156fd565b906158138183615a3d565b6001600160401b03809160081c169160081c161190565b6158348282615a3d565b6001600160401b03809260081c16828260081c16039182116119225760ff610100600160481b0391169160081b161790565b906001600160401b0390817f0000000000000000000000000000000000000000000000000000000000000000161561328c576132379261ffff615913926158ab612fde565b501680600052600080516020615c2c833981519152806020526158d4612c776040600020613045565b60009283526020919091526040909120805467ffffffffffffffff60901b19164290951660901b67ffffffffffffffff60901b1694909417845561582a565b90614ad2565b6001600160401b0390817f00000000000000000000000000000000000000000000000000000000000000001615615a3957615952612fde565b5061595e612c77612ffd565b90600160481b600160901b03600080516020615ccc83398151915293845493816001600160401b0360901b4260901b16946159998184615a3d565b60081c16828260081c1601828111600014615a255750610100600160481b0360ff6159c3846149d8565b92169160081b1617906001600160481b038516906159e18284615a3d565b80856001600160401b0360901b1988161760081c16908360081c1610600014615a1e57505b60481b1691600160481b600160d01b03191617179055565b9050615a06565b60ff6159c3610100600160481b03926149d8565b5050565b60ff9182169116818103615a4f575050565b604051635ce6db6160e11b815260ff918216600482015291166024820152604490fd5b91929015615ad45750815115615a86575090565b3b15615a8f5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015615ae75750805190602001fd5b60405162461bcd60e51b81526020600482015290819061064a906024830190612cc156feebcc9f646b0f459ff8f387587d536b0af3484cf442e1577400f322334e7d1ef047028352a8b3feae1a85fba43bc13f990568bb1637dce33d3dbfd791a0808b7f6c3cb3f3ae91330f31ba2bc0ff8855fc834fb66dc27e8e0b1a398617dabaa5a668dfeeddfa5e4e9adceec01a3aba274bdcbab3f6ac9956417a4332f2b08abdda9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930064bacf405c5d7f563d3ba5252584a52c37e4fee380fd825b10666c27b8258022fd6568c039679b3b7cc93c26c41d9379b7b1bec1677120493b467688302cb11f00758a264b9bdbe3295fe36bd6ff7abaa122f48bf70e90af04a1b8a32d21e4e18561949d1c6242cee5c5a5aeb6b9c190ee611d7742fcec65d9e5b1341ea04d89efb21dcaedea63b55c44882f329622e13a8d0f5b947b3a372826208a9003da1549bca747e973430e858f2f5de357b8dba36ea6d375b81bdb5d53dfaabf0b3a7f852fa0677fef8612c6c15b518c9fa56761e9ed15cfd5c6e5399e5467985ac7ed9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00bfa91572ce1e5fe8776a160d3b1f862e83f5ee2c080a7423b4761602a3ad12497c25289a27ec8c9be54d4a154cf80490d69bda989cdb8328232e08fea9220420a26469706673582212207d10b7c9c2bbe9ee0fe44d8d6984d62986713b4ba2945b244c17633e90adf2cb64736f6c63430008180033"; + +type NttManagerConstructorParams = + | [linkLibraryAddresses: NttManagerLibraryAddresses, signer?: Signer] + | ConstructorParameters; + +const isSuperArgs = ( + xs: NttManagerConstructorParams +): xs is ConstructorParameters => { + return ( + typeof xs[0] === "string" || + (Array.isArray as (arg: any) => arg is readonly any[])(xs[0]) || + "_isInterface" in xs[0] + ); +}; + +export class NttManager__factory extends ContractFactory { + constructor(...args: NttManagerConstructorParams) { + if (isSuperArgs(args)) { + super(...args); + } else { + const [linkLibraryAddresses, signer] = args; + super( + _abi, + NttManager__factory.linkBytecode(linkLibraryAddresses), + signer + ); + } + } + + static linkBytecode( + linkLibraryAddresses: NttManagerLibraryAddresses + ): string { + let linkedBytecode = _bytecode; + + linkedBytecode = linkedBytecode.replace( + new RegExp("__\\$93083e246e55d56d98f3df2872cd16bfd0\\$__", "g"), + linkLibraryAddresses[ + "src/libraries/TransceiverStructs.sol:TransceiverStructs" + ] + .replace(/^0x/, "") + .toLowerCase() + ); + + return linkedBytecode; + } + + override getDeployTransaction( + _token: AddressLike, + _mode: BigNumberish, + _chainId: BigNumberish, + _rateLimitDuration: BigNumberish, + _skipRateLimiting: boolean, + overrides?: NonPayableOverrides & { from?: string } + ): Promise { + return super.getDeployTransaction( + _token, + _mode, + _chainId, + _rateLimitDuration, + _skipRateLimiting, + overrides || {} + ); + } + override deploy( + _token: AddressLike, + _mode: BigNumberish, + _chainId: BigNumberish, + _rateLimitDuration: BigNumberish, + _skipRateLimiting: boolean, + overrides?: NonPayableOverrides & { from?: string } + ) { + return super.deploy( + _token, + _mode, + _chainId, + _rateLimitDuration, + _skipRateLimiting, + overrides || {} + ) as Promise< + NttManager & { + deploymentTransaction(): ContractTransactionResponse; + } + >; + } + override connect(runner: ContractRunner | null): NttManager__factory { + return super.connect(runner) as NttManager__factory; + } + + static readonly bytecode = _bytecode; + static readonly abi = _abi; + static createInterface(): NttManagerInterface { + return new Interface(_abi) as NttManagerInterface; + } + static connect(address: string, runner?: ContractRunner | null): NttManager { + return new Contract(address, _abi, runner) as unknown as NttManager; + } +} + +export interface NttManagerLibraryAddresses { + ["src/libraries/TransceiverStructs.sol:TransceiverStructs"]: string; +} diff --git a/evm/ts/src/ethers-contracts/2_1_0/factories/WormholeTransceiver__factory.ts b/evm/ts/src/ethers-contracts/2_1_0/factories/WormholeTransceiver__factory.ts new file mode 100644 index 000000000..01d48d895 --- /dev/null +++ b/evm/ts/src/ethers-contracts/2_1_0/factories/WormholeTransceiver__factory.ts @@ -0,0 +1,1173 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { + Contract, + ContractFactory, + ContractTransactionResponse, + Interface, +} from "ethers"; +import type { + Signer, + BigNumberish, + AddressLike, + ContractDeployTransaction, + ContractRunner, +} from "ethers"; +import type { NonPayableOverrides } from "../common.js"; +import type { + WormholeTransceiver, + WormholeTransceiverInterface, +} from "../WormholeTransceiver.js"; + +const _abi = [ + { + type: "constructor", + inputs: [ + { + name: "nttManager", + type: "address", + internalType: "address", + }, + { + name: "wormholeCoreBridge", + type: "address", + internalType: "address", + }, + { + name: "_consistencyLevel", + type: "uint8", + internalType: "uint8", + }, + { + name: "_customConsistencyLevel", + type: "uint8", + internalType: "uint8", + }, + { + name: "_additionalBlocks", + type: "uint16", + internalType: "uint16", + }, + { + name: "_customConsistencyLevelAddress", + type: "address", + internalType: "address", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "WORMHOLE_TRANSCEIVER_VERSION", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "additionalBlocks", + inputs: [], + outputs: [ + { + name: "", + type: "uint16", + internalType: "uint16", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "consistencyLevel", + inputs: [], + outputs: [ + { + name: "", + type: "uint8", + internalType: "uint8", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "customConsistencyLevel", + inputs: [], + outputs: [ + { + name: "", + type: "uint8", + internalType: "uint8", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "customConsistencyLevelAddress", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "encodeWormholeTransceiverInstruction", + inputs: [ + { + name: "instruction", + type: "tuple", + internalType: + "struct IWormholeTransceiver.WormholeTransceiverInstruction", + components: [ + { + name: "shouldSkipRelayerSend", + type: "bool", + internalType: "bool", + }, + ], + }, + ], + outputs: [ + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "getMigratesImmutables", + inputs: [], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getNttManagerOwner", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getNttManagerToken", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getTransceiverType", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "getWormholePeer", + inputs: [ + { + name: "chainId", + type: "uint16", + internalType: "uint16", + }, + ], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "initialize", + inputs: [], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "isPaused", + inputs: [], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "isVAAConsumed", + inputs: [ + { + name: "hash", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "migrate", + inputs: [], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "nttManager", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "nttManagerToken", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "owner", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "parseWormholeTransceiverInstruction", + inputs: [ + { + name: "encoded", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "instruction", + type: "tuple", + internalType: + "struct IWormholeTransceiver.WormholeTransceiverInstruction", + components: [ + { + name: "shouldSkipRelayerSend", + type: "bool", + internalType: "bool", + }, + ], + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "pauser", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "quoteDeliveryPrice", + inputs: [ + { + name: "targetChain", + type: "uint16", + internalType: "uint16", + }, + { + name: "instruction", + type: "tuple", + internalType: "struct TransceiverStructs.TransceiverInstruction", + components: [ + { + name: "index", + type: "uint8", + internalType: "uint8", + }, + { + name: "payload", + type: "bytes", + internalType: "bytes", + }, + ], + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "receiveMessage", + inputs: [ + { + name: "encodedMessage", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "sendMessage", + inputs: [ + { + name: "recipientChain", + type: "uint16", + internalType: "uint16", + }, + { + name: "instruction", + type: "tuple", + internalType: "struct TransceiverStructs.TransceiverInstruction", + components: [ + { + name: "index", + type: "uint8", + internalType: "uint8", + }, + { + name: "payload", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "nttManagerMessage", + type: "bytes", + internalType: "bytes", + }, + { + name: "recipientNttManagerAddress", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "refundAddress", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "setWormholePeer", + inputs: [ + { + name: "peerChainId", + type: "uint16", + internalType: "uint16", + }, + { + name: "peerContract", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "transferOwnership", + inputs: [ + { + name: "newOwner", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "transferPauserCapability", + inputs: [ + { + name: "newPauser", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "transferTransceiverOwnership", + inputs: [ + { + name: "newOwner", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "upgrade", + inputs: [ + { + name: "newImplementation", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "wormhole", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract ICoreBridge", + }, + ], + stateMutability: "view", + }, + { + type: "event", + name: "AdminChanged", + inputs: [ + { + name: "previousAdmin", + type: "address", + indexed: false, + internalType: "address", + }, + { + name: "newAdmin", + type: "address", + indexed: false, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "BeaconUpgraded", + inputs: [ + { + name: "beacon", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Initialized", + inputs: [ + { + name: "version", + type: "uint64", + indexed: false, + internalType: "uint64", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "NotPaused", + inputs: [ + { + name: "notPaused", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "OwnershipTransferred", + inputs: [ + { + name: "previousOwner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newOwner", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Paused", + inputs: [ + { + name: "paused", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "PauserTransferred", + inputs: [ + { + name: "oldPauser", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newPauser", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ReceivedMessage", + inputs: [ + { + name: "digest", + type: "bytes32", + indexed: false, + internalType: "bytes32", + }, + { + name: "emitterChainId", + type: "uint16", + indexed: false, + internalType: "uint16", + }, + { + name: "emitterAddress", + type: "bytes32", + indexed: false, + internalType: "bytes32", + }, + { + name: "sequence", + type: "uint64", + indexed: false, + internalType: "uint64", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "RelayingInfo", + inputs: [ + { + name: "relayingType", + type: "uint8", + indexed: false, + internalType: "uint8", + }, + { + name: "refundAddress", + type: "bytes32", + indexed: false, + internalType: "bytes32", + }, + { + name: "deliveryPayment", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SendTransceiverMessage", + inputs: [ + { + name: "recipientChain", + type: "uint16", + indexed: false, + internalType: "uint16", + }, + { + name: "message", + type: "tuple", + indexed: false, + internalType: "struct TransceiverStructs.TransceiverMessage", + components: [ + { + name: "sourceNttManagerAddress", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "recipientNttManagerAddress", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "nttManagerPayload", + type: "bytes", + internalType: "bytes", + }, + { + name: "transceiverPayload", + type: "bytes", + internalType: "bytes", + }, + ], + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetWormholePeer", + inputs: [ + { + name: "chainId", + type: "uint16", + indexed: false, + internalType: "uint16", + }, + { + name: "peerContract", + type: "bytes32", + indexed: false, + internalType: "bytes32", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Upgraded", + inputs: [ + { + name: "implementation", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "CallerNotNttManager", + inputs: [ + { + name: "caller", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "CallerNotRelayer", + inputs: [ + { + name: "caller", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "CannotRenounceTransceiverOwnership", + inputs: [ + { + name: "currentOwner", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "CannotTransferTransceiverOwnership", + inputs: [ + { + name: "currentOwner", + type: "address", + internalType: "address", + }, + { + name: "newOwner", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "InvalidBoolVal", + inputs: [ + { + name: "val", + type: "uint8", + internalType: "uint8", + }, + ], + }, + { + type: "error", + name: "InvalidFork", + inputs: [ + { + name: "evmChainId", + type: "uint256", + internalType: "uint256", + }, + { + name: "blockChainId", + type: "uint256", + internalType: "uint256", + }, + ], + }, + { + type: "error", + name: "InvalidInitialization", + inputs: [], + }, + { + type: "error", + name: "InvalidPauser", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "InvalidVaa", + inputs: [ + { + name: "reason", + type: "string", + internalType: "string", + }, + ], + }, + { + type: "error", + name: "InvalidWormholeChainIdZero", + inputs: [], + }, + { + type: "error", + name: "InvalidWormholePeer", + inputs: [ + { + name: "chainId", + type: "uint16", + internalType: "uint16", + }, + { + name: "peerAddress", + type: "bytes32", + internalType: "bytes32", + }, + ], + }, + { + type: "error", + name: "InvalidWormholePeerZeroAddress", + inputs: [], + }, + { + type: "error", + name: "LengthMismatch", + inputs: [ + { + name: "encodedLength", + type: "uint256", + internalType: "uint256", + }, + { + name: "expectedLength", + type: "uint256", + internalType: "uint256", + }, + ], + }, + { + type: "error", + name: "NotInitializing", + inputs: [], + }, + { + type: "error", + name: "NotMigrating", + inputs: [], + }, + { + type: "error", + name: "OnlyDelegateCall", + inputs: [], + }, + { + type: "error", + name: "OutOfBounds", + inputs: [ + { + name: "offset", + type: "uint256", + internalType: "uint256", + }, + { + name: "length", + type: "uint256", + internalType: "uint256", + }, + ], + }, + { + type: "error", + name: "OwnableInvalidOwner", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "OwnableUnauthorizedAccount", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "PeerAlreadySet", + inputs: [ + { + name: "chainId", + type: "uint16", + internalType: "uint16", + }, + { + name: "peerAddress", + type: "bytes32", + internalType: "bytes32", + }, + ], + }, + { + type: "error", + name: "ReentrancyGuardReentrantCall", + inputs: [], + }, + { + type: "error", + name: "RequireContractIsNotPaused", + inputs: [], + }, + { + type: "error", + name: "RequireContractIsPaused", + inputs: [], + }, + { + type: "error", + name: "TransferAlreadyCompleted", + inputs: [ + { + name: "vaaHash", + type: "bytes32", + internalType: "bytes32", + }, + ], + }, + { + type: "error", + name: "UnexpectedAdditionalMessages", + inputs: [], + }, + { + type: "error", + name: "UnexpectedDeployer", + inputs: [ + { + name: "deployer", + type: "address", + internalType: "address", + }, + { + name: "caller", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "UnexpectedRecipientNttManagerAddress", + inputs: [ + { + name: "recipientNttManagerAddress", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "expectedRecipientNttManagerAddress", + type: "bytes32", + internalType: "bytes32", + }, + ], + }, + { + type: "error", + name: "UnexpectedVersion", + inputs: [ + { + name: "version", + type: "uint8", + internalType: "uint8", + }, + ], + }, + { + type: "error", + name: "VerificationFailed", + inputs: [], + }, +] as const; + +const _bytecode = + "0x6101c06040818152346200027f5760c08262002a488038038091620000258285620002eb565b8339810103126200027f576200003b8262000325565b906020916200004c83850162000325565b906200005a8386016200033a565b9462000069606082016200033a565b9460808201519161ffff831683036200027f5760a06200008a910162000325565b927ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0080549060ff82891c16620002da578392919083906001600160401b03906002600160401b03198285160162000297575b505030608052505060a08190528651637e062a3560e11b81526001600160a01b039390918290600490829087165afa9182156200028c5760009262000249575b505060c0523360e052610180931683526101a09346855261010096875261012095865261014091825261016092835251946126fe96876200034a88396080518761250b015260a05187818161050001528181610fb801528181611709015281816117da01528181611ab601528181611ca30152612344015260c05187818161104e01528181611cf50152612014015260e05187610ec001525186818161097d0152818161107b0152818161151a015281816118ae0152611d9d0152518581816112440152611aff015251848181610bcc015261126e015251838181610aad015261120e015251828181610213015281816107f90152818161085401528181610a1e01528181610dba0152818161113301528181611548015281816118dd0152611d47015251816101b80152f35b90809250813d831162000284575b620002638183620002eb565b810103126200027f57620002779062000325565b38806200011c565b600080fd5b503d62000257565b87513d6000823e3d90fd5b6001600160401b0319909316811790925588519182527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d291a138828180620000dc565b875163f92ee8a960e01b8152600490fd5b601f909101601f19168101906001600160401b038211908210176200030f57604052565b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036200027f57565b519060ff821682036200027f5756fe608080604052600436101561001357600080fd5b600090813560e01c908163036de8af14611f33575080630900f01014611b235780630b4a1e891461163b57806324cf258614611ae557806324fb21db14611aa057806348b330d614611a5a5780634b5b05051461175057806358f709ba146116e157806366152efc14611682578063689f90c314611640578063694977d71461163b5780637ab564031461140e57806380eb3239146113c05780638129fc1c14610e2f57806381e8ec7f14610de957806384acd1bb14610da45780638da5cb5b14610d6e5780638fd3ab8014610c45578063935dec0714610bf05780639d592c4c14610bb15780639fd0506d14610b69578063a0926b2a14610b1c578063b187bd2614610adc578063b25b2f7514610a97578063b5634c73146109ce578063d8d28418146109a1578063e8dfd50814610963578063f2fde38b1461092a5763f953cec71461016057600080fd5b346105b95760203660031901126105b9576001600160401b03600435116105b9573660236004350112156105b9576001600160401b0360043560040135116105b957366024600435600401356004350101116105b9577f000000000000000000000000000000000000000000000000000000000000000046810361090c575060016024600435013560f81c036106ca57604051637ca8cbad60e11b8152600480356025013560e01c9082015281816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156105bc5782916108f2575b5063ffffffff602082015116428110901515166107e3575b518051906006916001600382821b04016029600435013560f81c106107c6576102a760426029600435013560f81c0260060160043560040135602460043501612678565b908160405191823720845260208420916001859486915b6029600435013560f81c831061072557876102f4603960426029600435013560f81c020160043560040135602460043501612678565b600435602981013560f81c60420201603281013560f01c60009081527f48c66ef0992b4bcc14f2551075db9459fc23bf706abb76034f1c66c1ba28468460205260409020549193929160349091013590036106e9576004356024013560f81c6001036106af5761038360426029600435013560f81c026005015b60010160043560040135602460043501612678565b908160405191823720825260208220908183527f5e6aacb3f16e5b01c8b072a0ab4c38e919266014a45db863ee64a4580fb3e7e28060205260ff6040852054166106965782845260209081526040808520805460ff191660011790558051938452600435602981013560f81c60420201603281013560f01c928501929092526034820135908401526054013560c01c6060808401919091529183918591606491907ff6fc529540981400dc64edf649eb5e2e0eb5812a27f8c81bac2c1d317e71a5f090608090a1848060405161045881612091565b8681528660208201528160408201520152846040805161047781612076565b86815286602082015201526040519687938492630453806b60e11b84526309945ff160e41b600485015260406024850152816044850152848401378181018301859052601f01601f1916810103018173__$93083e246e55d56d98f3df2872cd16bfd0$__5af480156105bc57829383916105e9575b508351602090940151936001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168086036105cb57849550803b156105c75784928360409361059885519788968795869463275e091560e21b8652603260426029600435013560f81c0260043501013560f01c60048701526024860152826044860152805160648601526020810151608486015201519060a484015260c48301906121cd565b03925af180156105bc576105a95750f35b6105b290612048565b6105b95780f35b80fd5b6040513d84823e3d90fd5b8480fd5b60449086604051916339dee99160e11b835260048301526024820152fd5b9350503d8083853e6105fb81856120c7565b8301926040818503126106925780516001600160401b03811161068e57846106249183016123f3565b906020810151906001600160401b0382116105c7570193828582031261068e576040519461065186612076565b80518652602081015160208701526040810151906001600160401b03821161068a5761067e92910161226a565b604085015292846104ec565b8580fd5b8380fd5b8280fd5b604051632d30ec0360e21b815260048101849052602490fd5b6004356024013560f81c6002036106ca57610383603861036e565b60246040516335f6bc6b60e11b815281600435013560f81c6004820152fd5b604051633cd8e72b60e11b8152603260048035602981013560f81c604202019182013560f01c9083015260340135602482015280604481010390fd5b6042826004350192019660208960806040518a815260ff601b606589013560f81c011684820152602587013560408201526045870135606082015282805260015afa156107d857885160018060a01b036020611fe0602487013560f31c1688010151169060018060a01b031614159186602485013560f81c101591602485013560f81c11171517176107c6576024013560f81c9460019190910190866102be565b60405163439cc0cd60e01b8152600490fd5b6040513d8a823e3d90fd5b50604051631cfe795160e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156105bc5782916108b4575b50604051637ca8cbad60e11b815263ffffffff91909116600482015281816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156105bc578291610892575b50610263565b6108ae91503d8084833e6108a681836120c7565b810190612576565b3861088c565b90506020813d6020116108ea575b816108cf602093836120c7565b810103126108e6576108e090612565565b38610831565b5080fd5b3d91506108c2565b61090691503d8084833e6108a681836120c7565b3861024b565b604490604051906377d879fb60e01b82526004820152466024820152fd5b50346105b95760203660031901126105b9576004356001600160a01b03811681036108e6576109609061095b61245c565b6123c0565b80f35b50346105b957806003193601126105b957602060405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346105b957806003193601126105b95760206109bc61232f565b6040516001600160a01b039091168152f35b50346105b95760403660031901126105b9576109e861214a565b506024356001600160401b0381116108e657610a0890369060040161215b565b50604051631a90a21960e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156105bc578291610a61575b602082604051908152f35b90506020813d602011610a8f575b81610a7c602093836120c7565b810103126108e657602091505138610a56565b3d9150610a6f565b50346105b957806003193601126105b9576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346105b957806003193601126105b957602060027f64bacf405c5d7f563d3ba5252584a52c37e4fee380fd825b10666c27b82580225414604051908152f35b50346105b957806003193601126105b957610b65604051610b3c816120ac565b6008815267776f726d686f6c6560c01b60208201526040519182916020835260208301906121cd565b0390f35b50346105b957806003193601126105b9577fbfa91572ce1e5fe8776a160d3b1f862e83f5ee2c080a7423b4761602a3ad1249546040516001600160a01b039091168152602090f35b50346105b957806003193601126105b957602060405161ffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346105b95760203660031901126105b95761ffff610c0d61214a565b166000527f48c66ef0992b4bcc14f2551075db9459fc23bf706abb76034f1c66c1ba2846846020526020604060002054604051908152f35b50346105b957806003193601126105b957610c5e612508565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0080546001600160401b038082166001810190828211610d5a5760ff8460401c16908115610d4d575b50610d3b571660ff7f7487ca88d037ca20519908b1ee7556206bef53bce0226a348750cb9d4f688e4e541615610d29577fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d292602092680100000000000000008360ff60401b199268ffffffffffffffffff19161717169055604051908152a180f35b604051632866815360e11b8152600490fd5b60405163f92ee8a960e01b8152600490fd5b9050828216111538610ca7565b634e487b7160e01b86526011600452602486fd5b50346105b957806003193601126105b9576000805160206126a9833981519152546040516001600160a01b039091168152602090f35b50346105b957806003193601126105b9576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346105b957806003193601126105b957610b65604051610e09816120ac565b60058152640322e312e360dc1b60208201526040519182916020835260208301906121cd565b50806003193601126105b957610e43612508565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805460ff90818160401c1615906001600160401b0390818116801590816113b8575b60011490816113ae575b1590816113a5575b50610d3b5767ffffffffffffffff198116600117855582611386575b506001600160a01b03907f00000000000000000000000000000000000000000000000000000000000000008216338190036113685750610ef2612637565b610efa612637565b60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055610fa6610f2961232f565b610f31612637565b610f39612637565b610f41612637565b60017f64bacf405c5d7f563d3ba5252584a52c37e4fee380fd825b10666c27b8258022557fbfa91572ce1e5fe8776a160d3b1f862e83f5ee2c080a7423b4761602a3ad124980546001600160a01b03191633179055610f9e612637565b61095b612637565b604051634b4fd03b60e01b81526020947f00000000000000000000000000000000000000000000000000000000000000008416918681600481865afa90811561135d578991611340575b50604051631dcbf42b60e11b8152908782600481875afa918215611335578a92611306575b506040519460a08601908111868210176112f057604052639c23bd3b60e01b8552878501938452826040860191168152826060860191877f00000000000000000000000000000000000000000000000000000000000000001683528160808801941684527f0000000000000000000000000000000000000000000000000000000000000000958c60cb84891614611209575b506040516301529f6160e21b815297516001600160e01b03191660048901525160248801525116604486015251606485015251166084830152868260a48173__$93083e246e55d56d98f3df2872cd16bfd0$__5af49283156111fe5761112d93869389916111dc575b506040518095819482936358cd21bf60e11b8452600484016122f3565b039134907f0000000000000000000000000000000000000000000000000000000000000000165af180156111d1576111a4575b50611169578280f35b7fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29160ff60401b19815416905560405160018152a138808280f35b6111c390833d85116111ca575b6111bb81836120c7565b8101906122d4565b5038611160565b503d6111b1565b6040513d87823e3d90fd5b6111f891503d808b833e6111f081836120c7565b8101906122af565b38611110565b6040513d89823e3d90fd5b9250887f000000000000000000000000000000000000000000000000000000000000000016803b1561068e5760405163ca23addf60e01b81527f000000000000000000000000000000000000000000000000000000000000000060f01b60ff60f01b167f000000000000000000000000000000000000000000000000000000000000000060e01b61ffff60e01b1617600160f81b176004820152939081908590602490829084905af19384156112e35787946112c6575b506110a7565b6112d291929450612048565b6112df5784918c386112c0565b8b80fd5b50604051903d90823e3d90fd5b634e487b7160e01b600052604160045260246000fd5b611327919250883d8a1161132e575b61131f81836120c7565b81019061254c565b9038611015565b503d611315565b6040513d8c823e3d90fd5b6113579150873d891161132e5761131f81836120c7565b38610ff0565b6040513d8b823e3d90fd5b60449060405190636345072160e11b82526004820152336024820152fd5b68ffffffffffffffffff19166801000000000000000117845538610eb4565b90501538610e98565b303b159150610e90565b849150610e86565b50346105b95760203660031901126105b95760ff604060209260043581527f5e6aacb3f16e5b01c8b072a0ab4c38e919266014a45db863ee64a4580fb3e7e284522054166040519015158152f35b5060403660031901126105b95761142361214a565b60243561142e61245c565b61ffff91828116801561162957821561161757806000527f48c66ef0992b4bcc14f2551075db9459fc23bf706abb76034f1c66c1ba28468490602091808352604060002054806115f35750816000528252836040600020556040519461149386612076565b630c7e33e160e11b86528286019182526040808701868152905163077650fb60e51b815296516001600160e01b03191660048801529151166024860152516044850152848460648173__$93083e246e55d56d98f3df2872cd16bfd0$__5af49384156111d15761154394829187916115d9575b50604051809681926358cd21bf60e11b83527f000000000000000000000000000000000000000000000000000000000000000090600484016122f3565b0381347f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af19384156111d1577fa559263ee060c7a2560843b3a064ff0376c9753ae3e2449b595a3b615d326466946115bb575b50506040805161ffff9290921682526020820192909252a180f35b816115d192903d106111ca576111bb81836120c7565b5038806115a0565b6115ed91503d8089833e6111f081836120c7565b38611506565b60405163b55eeae960e01b815261ffff861660048201526024810191909152604490fd5b60405163137063ef60e11b8152600490fd5b604051630f7662c960e21b8152600490fd5b611ffe565b50346105b957806003193601126105b957602060ff7f5443fea4dc453d96b81ce55b62e11a4094cc4cbb8a360956a7253cfdb42506cb54166040519015158152f35b50346105b95760203660031901126105b9576040516116a08161205b565b6004358015159182820361068e57610b659350526040519060f81b6020820152600181526116cd816120ac565b6040519182916020835260208301906121cd565b50346105b95760203660031901126105b9576004356001600160a01b038082168203610692577f000000000000000000000000000000000000000000000000000000000000000016330361173857610960906124b2565b60405163c5aa615360e01b8152336004820152602490fd5b5060031960a0368201126108e65761176661214a565b6001600160401b03906024358281116105c75761178790369060040161215b565b506044358281116105c7576117a0903690600401612103565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00916002835414611a4857600283556001600160a01b03917f000000000000000000000000000000000000000000000000000000000000000083163303611738576118578791611866604051986118168a61205b565b848a526040516304616c8f60e21b81526309945ff160e41b600482015233602482015260648035604483015260a090820152998a94859460a48601906121cd565b918483030160848501526121cd565b038173__$93083e246e55d56d98f3df2872cd16bfd0$__5af480156119dd57869487916119e8575b506118d79394955060405180936358cd21bf60e11b8252818060209788957f000000000000000000000000000000000000000000000000000000000000000090600484016122f3565b039134907f0000000000000000000000000000000000000000000000000000000000000000165af180156119dd576001957f79376a0dc6cbfe6f6f8f89ad24c262a8c6233f8df181d3fe5abb2e2442e8c7389461ffff946119b9936119c0575b507fc3192e083c87c556db539f071d8a298869f487e951327b5616a6f85ae3da958e60606040518b81528b84820152346040820152a160405194859416845260408185015281516040850152810151606084015260606119a5604083015160808087015260c08601906121cd565b910151838203603f190160a08501526121cd565b0390a15580f35b6119d690823d84116111ca576111bb81836120c7565b5038611937565b6040513d88823e3d90fd5b939450503d8087873e6119fb81876120c7565b850194604081870312611a44578051848111611a405786611a1d9183016123f3565b956020820151948511611a40576118d794611a38920161226a565b85949361188e565b8780fd5b8680fd5b604051633ee5aeb560e01b8152600490fd5b50346105b95760203660031901126105b957600435906001600160401b0382116105b9576020611a95611a903660048601612103565b6121f2565b604051905115158152f35b50346105b957806003193601126105b9576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346105b957806003193601126105b957602060405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346105b9576020806003193601126108e6576001600160a01b03600435818116908181036105c757611b5461245c565b611b5c612508565b3b15611ed8577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b031916821790557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8480a27f7487ca88d037ca20519908b1ee7556206bef53bce0226a348750cb9d4f688e4e91825491611be960ff841615612495565b60ff199283166001178455303b156105c75760405163011fa75760e71b8152858160048183305af180156119dd57611ec5575b5060405163689f90c360e01b81528281600481305afa9081156119dd578691611e8f575b5015611c78575b50507f5443fea4dc453d96b81ce55b62e11a4094cc4cbb8a360956a7253cfdb42506cb818154169055815416905580f35b6040516324fb21db60e01b81528281600481305afa80156119dd578690611e59575b611cca915082167f0000000000000000000000000000000000000000000000000000000000000000831614612495565b604051630b4a1e8960e01b81528281600481305afa80156119dd578690611e23575b611d1c915082167f0000000000000000000000000000000000000000000000000000000000000000831614612495565b6040516384acd1bb60e01b81528281600481305afa9081156119dd578691611de9575b5081611d6f927f000000000000000000000000000000000000000000000000000000000000000016911614612495565b604051631d1bfaa160e31b81528181600481305afa9081156111d157611dc5928692611dcc575b505060ff807f000000000000000000000000000000000000000000000000000000000000000016911614612495565b3880611c47565b611de29250803d1061132e5761131f81836120c7565b3880611d96565b90508281813d8311611e1c575b611e0081836120c7565b8101031261068a575190808216820361068a5790611d6f611d3f565b503d611df6565b508281813d8311611e52575b611e3981836120c7565b8101031261068a57611e4d611d1c9161231b565b611cec565b503d611e2f565b508281813d8311611e88575b611e6f81836120c7565b8101031261068a57611e83611cca9161231b565b611c9a565b503d611e65565b90508281813d8311611ebe575b611ea681836120c7565b8101031261068a5751801515810361068a5738611c40565b503d611e9c565b611ed190959195612048565b9338611c1c565b60405162461bcd60e51b815260048101849052602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b9050346108e65760203660031901126108e6576001600160a01b03600435818116929083900361068e57816000805160206126a98339815191525416917fbfa91572ce1e5fe8776a160d3b1f862e83f5ee2c080a7423b4761602a3ad124991825491821693338514159081611ff3575b50611fde57506001600160a01b031916831790557f51c4874e0f23f262e04a38c51751336dde72126d67f53eb672aaff02996b3ef68380a380f35b63e2a08e5d60e01b8152336004820152602490fd5b905033141538611fa3565b34612043576000366003190112612043576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b600080fd5b6001600160401b0381116112f057604052565b602081019081106001600160401b038211176112f057604052565b606081019081106001600160401b038211176112f057604052565b608081019081106001600160401b038211176112f057604052565b604081019081106001600160401b038211176112f057604052565b90601f801991011681019081106001600160401b038211176112f057604052565b6001600160401b0381116112f057601f01601f191660200190565b81601f820112156120435780359061211a826120e8565b9261212860405194856120c7565b8284526020838301011161204357816000926020809301838601378301015290565b6004359061ffff8216820361204357565b91906040838203126120435760405190612174826120ac565b8193803560ff811681036120435783526020810135916001600160401b038311612043576020926121a59201612103565b910152565b60005b8381106121bd5750506000910152565b81810151838201526020016121ad565b906020916121e6815180928185528580860191016121aa565b601f01601f1916010190565b90604051916122008361205b565b60008352828151156122655750600181015160fe60ff8216911661224d5715158352516001810361222e5750565b604490604051906355c5b3e360e11b8252600482015260016024820152fd5b6024906040519063f7a37b0760e01b82526004820152fd5b925050565b81601f82011215612043578051612280816120e8565b9261228e60405194856120c7565b81845260208284010111612043576122ac91602080850191016121aa565b90565b906020828203126120435781516001600160401b038111612043576122ac920161226a565b9081602091031261204357516001600160401b03811681036120435790565b9060ff612314604092959495600085526060602086015260608501906121cd565b9416910152565b51906001600160a01b038216820361204357565b604051638da5cb5b60e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156123b457600091612380575090565b90506020813d6020116123ac575b8161239b602093836120c7565b81010312612043576122ac9061231b565b3d915061238e565b6040513d6000823e3d90fd5b6001600160a01b038116156123da576123d8906124b2565b565b604051631e4fbdf760e01b815260006004820152602490fd5b9190608083820312612043576040519061240c82612091565b819380518352602081015160208401526040810151916001600160401b0392838111612043578161243e91840161226a565b60408501526060820151928311612043576060926121a5920161226a565b6000805160206126a9833981519152546001600160a01b0316330361247d57565b60405163118cdaa760e01b8152336004820152602490fd5b1561249c57565b634e487b7160e01b600052600160045260246000fd5b6000805160206126a983398151915280546001600160a01b039283166001600160a01b0319821681179092559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b307f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161461253a57565b604051633c64f99360e21b8152600490fd5b90816020910312612043575160ff811681036120435790565b519063ffffffff8216820361204357565b60209081818403126120435780516001600160401b039182821161204357019060408285031261204357604051936125ad856120ac565b825182811161204357830181601f820112156120435780519283116112f0578260051b90604051936125e1878401866120c7565b845285808501928201019283116120435791858094929593015b8181106126185750506126119350855201612565565b9082015290565b9193809193956126278461231b565b81520191019185939194926125fb565b60ff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460401c161561266657565b604051631afcd79f60e31b8152600490fd5b9291909283821161268a578101920390565b6044828560405191633d71388b60e21b835260048301526024820152fdfe9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300a26469706673582212202c1f80484806c1e164d6ff0d10338a636a001bddd641ea2558ece4848b1c2cb964736f6c63430008180033"; + +type WormholeTransceiverConstructorParams = + | [linkLibraryAddresses: WormholeTransceiverLibraryAddresses, signer?: Signer] + | ConstructorParameters; + +const isSuperArgs = ( + xs: WormholeTransceiverConstructorParams +): xs is ConstructorParameters => { + return ( + typeof xs[0] === "string" || + (Array.isArray as (arg: any) => arg is readonly any[])(xs[0]) || + "_isInterface" in xs[0] + ); +}; + +export class WormholeTransceiver__factory extends ContractFactory { + constructor(...args: WormholeTransceiverConstructorParams) { + if (isSuperArgs(args)) { + super(...args); + } else { + const [linkLibraryAddresses, signer] = args; + super( + _abi, + WormholeTransceiver__factory.linkBytecode(linkLibraryAddresses), + signer + ); + } + } + + static linkBytecode( + linkLibraryAddresses: WormholeTransceiverLibraryAddresses + ): string { + let linkedBytecode = _bytecode; + + linkedBytecode = linkedBytecode.replace( + new RegExp("__\\$93083e246e55d56d98f3df2872cd16bfd0\\$__", "g"), + linkLibraryAddresses[ + "src/libraries/TransceiverStructs.sol:TransceiverStructs" + ] + .replace(/^0x/, "") + .toLowerCase() + ); + + return linkedBytecode; + } + + override getDeployTransaction( + nttManager: AddressLike, + wormholeCoreBridge: AddressLike, + _consistencyLevel: BigNumberish, + _customConsistencyLevel: BigNumberish, + _additionalBlocks: BigNumberish, + _customConsistencyLevelAddress: AddressLike, + overrides?: NonPayableOverrides & { from?: string } + ): Promise { + return super.getDeployTransaction( + nttManager, + wormholeCoreBridge, + _consistencyLevel, + _customConsistencyLevel, + _additionalBlocks, + _customConsistencyLevelAddress, + overrides || {} + ); + } + override deploy( + nttManager: AddressLike, + wormholeCoreBridge: AddressLike, + _consistencyLevel: BigNumberish, + _customConsistencyLevel: BigNumberish, + _additionalBlocks: BigNumberish, + _customConsistencyLevelAddress: AddressLike, + overrides?: NonPayableOverrides & { from?: string } + ) { + return super.deploy( + nttManager, + wormholeCoreBridge, + _consistencyLevel, + _customConsistencyLevel, + _additionalBlocks, + _customConsistencyLevelAddress, + overrides || {} + ) as Promise< + WormholeTransceiver & { + deploymentTransaction(): ContractTransactionResponse; + } + >; + } + override connect( + runner: ContractRunner | null + ): WormholeTransceiver__factory { + return super.connect(runner) as WormholeTransceiver__factory; + } + + static readonly bytecode = _bytecode; + static readonly abi = _abi; + static createInterface(): WormholeTransceiverInterface { + return new Interface(_abi) as WormholeTransceiverInterface; + } + static connect( + address: string, + runner?: ContractRunner | null + ): WormholeTransceiver { + return new Contract( + address, + _abi, + runner + ) as unknown as WormholeTransceiver; + } +} + +export interface WormholeTransceiverLibraryAddresses { + ["src/libraries/TransceiverStructs.sol:TransceiverStructs"]: string; +} diff --git a/evm/ts/src/ethers-contracts/2_1_0/factories/index.ts b/evm/ts/src/ethers-contracts/2_1_0/factories/index.ts new file mode 100644 index 000000000..719b3f2b8 --- /dev/null +++ b/evm/ts/src/ethers-contracts/2_1_0/factories/index.ts @@ -0,0 +1,5 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export { NttManager__factory } from "./NttManager__factory.js"; +export { WormholeTransceiver__factory } from "./WormholeTransceiver__factory.js"; diff --git a/evm/ts/src/ethers-contracts/2_1_0/index.ts b/evm/ts/src/ethers-contracts/2_1_0/index.ts new file mode 100644 index 000000000..48078a607 --- /dev/null +++ b/evm/ts/src/ethers-contracts/2_1_0/index.ts @@ -0,0 +1,8 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export type { NttManager } from "./NttManager.js"; +export type { WormholeTransceiver } from "./WormholeTransceiver.js"; +export * as factories from "./factories/index.js"; +export { NttManager__factory } from "./factories/NttManager__factory.js"; +export { WormholeTransceiver__factory } from "./factories/WormholeTransceiver__factory.js"; diff --git a/evm/ts/src/ethers-contracts/index.ts b/evm/ts/src/ethers-contracts/index.ts index 4d3013806..8c80a7f2b 100644 --- a/evm/ts/src/ethers-contracts/index.ts +++ b/evm/ts/src/ethers-contracts/index.ts @@ -3,6 +3,7 @@ import * as __1_0_0 from "./1_0_0/index.js"; import * as __1_1_0 from "./1_1_0/index.js"; import * as __1_3_1 from "./1_3_1/index.js"; import * as __2_0_0 from "./2_0_0/index.js"; +import * as __2_1_0 from "./2_1_0/index.js"; const _0_1_0 = { NttManager: { @@ -49,4 +50,13 @@ const _2_0_0 = { }, }; -export { _0_1_0, _1_0_0, _1_1_0, _1_3_1, _2_0_0 }; +const _2_1_0 = { + NttManager: { + connect: __2_1_0.NttManager__factory.connect, + }, + NttTransceiver: { + connect: __2_1_0.WormholeTransceiver__factory.connect, + }, +}; + +export { _0_1_0, _1_0_0, _1_1_0, _1_3_1, _2_0_0, _2_1_0 }; From 2c0cfb971efcf5c720481ff43fc20db8ff69a4d9 Mon Sep 17 00:00:00 2001 From: Guido De Vita Date: Wed, 25 Mar 2026 15:13:25 +0000 Subject: [PATCH 2/2] fix(evm): use registered transceiver count in quoteDeliveryPrice quoteDeliveryPrice passed enabledTransceivers.length to parseTransceiverInstructions, causing index out of bounds after removing a transceiver. Use registered count instead, matching the correct pattern in _transferEntryPoint. --- evm/src/NttManager/ManagerBase.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evm/src/NttManager/ManagerBase.sol b/evm/src/NttManager/ManagerBase.sol index f8919247f..c5e9227b8 100644 --- a/evm/src/NttManager/ManagerBase.sol +++ b/evm/src/NttManager/ManagerBase.sol @@ -108,7 +108,7 @@ abstract contract ManagerBase is TransceiverStructs.TransceiverInstruction[] memory instructions = TransceiverStructs.parseTransceiverInstructions( - transceiverInstructions, enabledTransceivers.length + transceiverInstructions, _getRegisteredTransceiversStorage().length ); return _quoteDeliveryPrice(recipientChain, instructions, enabledTransceivers);