@across-protocol/contracts 5.0.26 → 5.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/README.md +4 -0
  2. package/contracts/chain-adapters/CrossDomainEnabled.sol +1 -1
  3. package/contracts/external/interfaces/IAcrossV5Executor.sol +14 -0
  4. package/contracts/external/interfaces/IAcrossV5ExecutorAdapter.sol +14 -0
  5. package/contracts/external/interfaces/IGateway.sol +25 -0
  6. package/contracts/interfaces/ICounterfactualBeacon.sol +25 -16
  7. package/contracts/interfaces/ICounterfactualBeaconBase.sol +30 -0
  8. package/contracts/interfaces/ICounterfactualDeposit.sol +30 -0
  9. package/contracts/interfaces/ICounterfactualDepositFactory.sol +33 -54
  10. package/contracts/interfaces/SpokePoolPeripheryInterface.sol +16 -4
  11. package/contracts/interfaces/V5SpokePoolInterface.sol +71 -0
  12. package/contracts/libraries/HyperCoreLib.sol +114 -30
  13. package/contracts/libraries/PeripherySigningLib.sol +56 -0
  14. package/contracts/libraries/SafeTransferERC20.sol +4 -0
  15. package/contracts/periphery/SpokePoolPeriphery.sol +81 -19
  16. package/contracts/periphery/Tron_SpokePoolPeriphery.sol +52 -0
  17. package/contracts/periphery/counterfactual/AdminWithdrawManager.sol +12 -4
  18. package/contracts/periphery/counterfactual/CounterfactualBeacon.sol +28 -1
  19. package/contracts/periphery/counterfactual/CounterfactualBeaconBase.sol +11 -11
  20. package/contracts/periphery/counterfactual/CounterfactualDeposit.sol +6 -16
  21. package/contracts/periphery/counterfactual/CounterfactualDepositCCTP.sol +9 -5
  22. package/contracts/periphery/counterfactual/CounterfactualDepositFactory.sol +3 -5
  23. package/contracts/periphery/counterfactual/CounterfactualDepositOFT.sol +6 -3
  24. package/contracts/periphery/counterfactual/CounterfactualDepositSpokePool.sol +24 -8
  25. package/contracts/periphery/counterfactual/CounterfactualDepositVanillaCCTP.sol +28 -12
  26. package/contracts/periphery/counterfactual/CounterfactualImplementationBase.sol +8 -7
  27. package/contracts/periphery/counterfactual/CounterfactualNonces.sol +52 -0
  28. package/contracts/periphery/mintburn/HyperCoreFlowExecutor.sol +7 -1
  29. package/contracts/periphery/mintburn/SwapHandler.sol +8 -7
  30. package/contracts/spoke-pools/Arbitrum_SpokePool.sol +10 -2
  31. package/contracts/spoke-pools/Cher_SpokePool.sol +4 -2
  32. package/contracts/spoke-pools/Ethereum_SpokePool.sol +4 -2
  33. package/contracts/spoke-pools/Lens_SpokePool.sol +7 -2
  34. package/contracts/spoke-pools/Linea_SpokePool.sol +4 -2
  35. package/contracts/spoke-pools/Lisk_SpokePool.sol +4 -2
  36. package/contracts/spoke-pools/OP_SpokePool.sol +4 -2
  37. package/contracts/spoke-pools/Ovm_SpokePool.sol +7 -5
  38. package/contracts/spoke-pools/Polygon_SpokePool.sol +10 -2
  39. package/contracts/spoke-pools/SpokePool.sol +181 -25
  40. package/contracts/spoke-pools/Tron_SpokePool.sol +4 -2
  41. package/contracts/spoke-pools/Universal_SpokePool.sol +10 -2
  42. package/contracts/spoke-pools/ZkSync_SpokePool.sol +7 -2
  43. package/contracts/test/MockGateway.sol +33 -0
  44. package/contracts/test/MockSpokePool.sol +4 -1
  45. package/contracts/test/MockSpokePoolV2.sol +1 -1
  46. package/contracts/tron/TronCounterfactualImports.sol +2 -0
  47. package/contracts/tron/TronPeripheryImports.sol +5 -2
  48. package/dist/broadcast/deployed-addresses.json +606 -447
  49. package/dist/evm/artifacts/AcrossConfigStore.sol/AcrossConfigStore.json +1 -1
  50. package/dist/evm/artifacts/AcrossEventEmitter.sol/AcrossEventEmitter.json +1 -1
  51. package/dist/evm/artifacts/AcrossMerkleDistributor.sol/AcrossMerkleDistributor.json +1 -1
  52. package/dist/evm/artifacts/AcrossMessageHandlerMock.sol/AcrossMessageHandlerMock.json +1 -1
  53. package/dist/evm/artifacts/AdapterStore.sol/AdapterStore.json +1 -1
  54. package/dist/evm/artifacts/AdapterStore.sol/MessengerTypes.json +1 -1
  55. package/dist/evm/artifacts/Address.sol/Address.json +1 -1
  56. package/dist/evm/artifacts/AddressConverters.sol/Bytes32ToAddress.json +1 -1
  57. package/dist/evm/artifacts/AdminRelayTokensAdapter.sol/AdminRelayTokensAdapter.json +1 -1
  58. package/dist/evm/artifacts/AdminWithdrawManager.sol/AdminWithdrawManager.json +1 -1
  59. package/dist/evm/artifacts/ArbitrumMocks.sol/ArbitrumMockErc20GatewayRouter.json +1 -1
  60. package/dist/evm/artifacts/ArbitrumMocks.sol/Inbox.json +1 -1
  61. package/dist/evm/artifacts/ArbitrumMocks.sol/L2GatewayRouter.json +1 -1
  62. package/dist/evm/artifacts/Arbitrum_Adapter.sol/Arbitrum_Adapter.json +1 -1
  63. package/dist/evm/artifacts/Arbitrum_CustomGasToken_Adapter.sol/Arbitrum_CustomGasToken_Adapter.json +1 -1
  64. package/dist/evm/artifacts/Arbitrum_Forwarder.sol/Arbitrum_Forwarder.json +1 -1
  65. package/dist/evm/artifacts/Arbitrum_RescueAdapter.sol/Arbitrum_RescueAdapter.json +1 -1
  66. package/dist/evm/artifacts/Arbitrum_SendTokensAdapter.sol/Arbitrum_SendTokensAdapter.json +1 -1
  67. package/dist/evm/artifacts/Arbitrum_SpokePool.sol/Arbitrum_SpokePool.json +1 -1
  68. package/dist/evm/artifacts/Arbitrum_WithdrawalHelper.sol/Arbitrum_WithdrawalHelper.json +1 -1
  69. package/dist/evm/artifacts/Base_Adapter.sol/Base_Adapter.json +1 -1
  70. package/dist/evm/artifacts/BeaconProxy.sol/BeaconProxy.json +1 -1
  71. package/dist/evm/artifacts/BondToken.sol/BondToken.json +1 -1
  72. package/dist/evm/artifacts/BytesLib.sol/BytesLib.json +1 -1
  73. package/dist/evm/artifacts/Cher_SpokePool.sol/Cher_SpokePool.json +1 -1
  74. package/dist/evm/artifacts/CircleCCTPAdapter.sol/CircleDomainIds.json +1 -1
  75. package/dist/evm/artifacts/Constants.sol/Constants.json +1 -1
  76. package/dist/evm/artifacts/Constants.sol/OptimisticOracleConstraints.json +1 -1
  77. package/dist/evm/artifacts/Constants.sol/OracleInterfaces.json +1 -1
  78. package/dist/evm/artifacts/CoreExecution.sol/CoreExecution.json +1 -1
  79. package/dist/evm/artifacts/CoreSimulatorLib.sol/HypeSystemContract.json +1 -1
  80. package/dist/evm/artifacts/CoreState.sol/CoreState.json +1 -1
  81. package/dist/evm/artifacts/CoreView.sol/CoreView.json +1 -1
  82. package/dist/evm/artifacts/CoreWriterLib.sol/CoreWriterLib.json +1 -1
  83. package/dist/evm/artifacts/CoreWriterSim.sol/CoreWriterSim.json +1 -1
  84. package/dist/evm/artifacts/CounterfactualBeacon.sol/CounterfactualBeacon.json +1 -1
  85. package/dist/evm/artifacts/CounterfactualBeaconBase.sol/CounterfactualBeaconBase.json +1 -1
  86. package/dist/evm/artifacts/CounterfactualBeaconBootstrap.sol/CounterfactualBeaconBootstrap.json +1 -1
  87. package/dist/evm/artifacts/CounterfactualConfig.sol/CounterfactualConfig.json +1 -1
  88. package/dist/evm/artifacts/CounterfactualDeposit.sol/CounterfactualDeposit.json +1 -1
  89. package/dist/evm/artifacts/CounterfactualDepositCCTP.sol/CounterfactualDepositCCTP.json +1 -1
  90. package/dist/evm/artifacts/CounterfactualDepositFactory.sol/CounterfactualDepositFactory.json +1 -1
  91. package/dist/evm/artifacts/CounterfactualDepositFactoryTron.sol/CounterfactualDepositFactoryTron.json +1 -1
  92. package/dist/evm/artifacts/CounterfactualDepositOFT.sol/CounterfactualDepositOFT.json +1 -1
  93. package/dist/evm/artifacts/CounterfactualDepositSpokePool.sol/CounterfactualDepositSpokePool.json +1 -1
  94. package/dist/evm/artifacts/CounterfactualDepositSpokePoolTr.sol/CounterfactualDepositSpokePoolTr.json +1 -1
  95. package/dist/evm/artifacts/CounterfactualDepositVanillaCCTP.sol/CounterfactualDepositVanillaCCTP.json +1 -1
  96. package/dist/evm/artifacts/CounterfactualNonces.sol/CounterfactualNonces.json +1 -0
  97. package/dist/evm/artifacts/Create2.sol/Create2.json +1 -1
  98. package/dist/evm/artifacts/CrossDomainEnabled.sol/CrossDomainEnabled.json +1 -1
  99. package/dist/evm/artifacts/DeployedAddresses.sol/DeployedAddresses.json +1 -1
  100. package/dist/evm/artifacts/DeploymentUtils.sol/DeploymentUtils.json +1 -1
  101. package/dist/evm/artifacts/DoctorWho_Adapter.sol/DoctorWho_Adapter.json +1 -1
  102. package/dist/evm/artifacts/DonationBox.sol/DonationBox.json +1 -1
  103. package/dist/evm/artifacts/DstOFTHandler.sol/DstOFTHandler.json +1 -1
  104. package/dist/evm/artifacts/ECDSA.sol/ECDSA.json +1 -1
  105. package/dist/evm/artifacts/ERC1155.sol/ERC1155.json +1 -1
  106. package/dist/evm/artifacts/ERC1967Proxy.sol/ERC1967Proxy.json +1 -1
  107. package/dist/evm/artifacts/ERC1967Utils.sol/ERC1967Utils.json +1 -1
  108. package/dist/evm/artifacts/ERC20.sol/ERC20.json +1 -1
  109. package/dist/evm/artifacts/Errors.sol/Errors.json +1 -1
  110. package/dist/evm/artifacts/Ethereum_Adapter.sol/Ethereum_Adapter.json +1 -1
  111. package/dist/evm/artifacts/Ethereum_RescueAdapter.sol/Ethereum_RescueAdapter.json +1 -1
  112. package/dist/evm/artifacts/Ethereum_SpokePool.sol/Ethereum_SpokePool.json +1 -1
  113. package/dist/evm/artifacts/ExpandedERC20.sol/ExpandedERC20.json +1 -1
  114. package/dist/evm/artifacts/ExpandedERC20WithBlacklist.sol/ExpandedERC20WithBlacklist.json +1 -1
  115. package/dist/evm/artifacts/HLConstants.sol/HLConstants.json +1 -1
  116. package/dist/evm/artifacts/HLConversions.sol/HLConversions.json +1 -1
  117. package/dist/evm/artifacts/HubPool.sol/HubPool.json +1 -1
  118. package/dist/evm/artifacts/HubPoolStore.sol/HubPoolStore.json +1 -1
  119. package/dist/evm/artifacts/HubPoolTestBase.sol/HubPoolTestBase.json +1 -1
  120. package/dist/evm/artifacts/HubPoolTestBase.sol/MockAddressWhitelist.json +1 -1
  121. package/dist/evm/artifacts/HubPoolTestBase.sol/MockFinder.json +1 -1
  122. package/dist/evm/artifacts/HubPoolTestBase.sol/MockIdentifierWhitelist.json +1 -1
  123. package/dist/evm/artifacts/HubPoolTestBase.sol/MockLpTokenFactory.json +1 -1
  124. package/dist/evm/artifacts/HubPoolTestBase.sol/MockOptimisticOracle.json +1 -1
  125. package/dist/evm/artifacts/HubPoolTestBase.sol/MockStore.json +1 -1
  126. package/dist/evm/artifacts/HyperCore.sol/HyperCore.json +1 -1
  127. package/dist/evm/artifacts/HyperCoreFlowExecutor.sol/HyperCoreFlowExecutor.json +1 -1
  128. package/dist/evm/artifacts/HyperCoreLib.sol/HyperCoreLib.json +1 -1
  129. package/dist/evm/artifacts/HyperliquidDepositHandler.sol/HyperliquidDepositHandler.json +1 -1
  130. package/dist/evm/artifacts/IAcrossV5Executor.sol/IAcrossV5Executor.json +1 -0
  131. package/dist/evm/artifacts/IAcrossV5ExecutorAdapter.sol/IAcrossV5ExecutorAdapter.json +1 -0
  132. package/dist/evm/artifacts/ICounterfactualBeacon.sol/ICounterfactualBeacon.json +1 -1
  133. package/dist/evm/artifacts/ICounterfactualBeaconBase.sol/ICounterfactualBeaconBase.json +1 -0
  134. package/dist/evm/artifacts/ICounterfactualDeposit.sol/ICounterfactualDeposit.json +1 -1
  135. package/dist/evm/artifacts/ICounterfactualDepositFactory.sol/ICounterfactualDepositFactory.json +1 -1
  136. package/dist/evm/artifacts/IGateway.sol/IGateway.json +1 -0
  137. package/dist/evm/artifacts/Lens_SpokePool.sol/Lens_SpokePool.json +1 -1
  138. package/dist/evm/artifacts/LibVariable.sol/LibVariable.json +1 -1
  139. package/dist/evm/artifacts/LineaMocks.sol/MockL2MessageService.json +1 -1
  140. package/dist/evm/artifacts/LineaMocks.sol/MockL2TokenBridge.json +1 -1
  141. package/dist/evm/artifacts/Linea_Adapter.sol/Linea_Adapter.json +1 -1
  142. package/dist/evm/artifacts/Linea_SpokePool.sol/Linea_SpokePool.json +1 -1
  143. package/dist/evm/artifacts/Lisk_Adapter.sol/Lisk_Adapter.json +1 -1
  144. package/dist/evm/artifacts/Lisk_SpokePool.sol/Lisk_SpokePool.json +1 -1
  145. package/dist/evm/artifacts/Lockable.sol/Lockable.json +1 -1
  146. package/dist/evm/artifacts/LpTokenFactory.sol/LpTokenFactory.json +1 -1
  147. package/dist/evm/artifacts/Merkle.sol/Merkle.json +1 -1
  148. package/dist/evm/artifacts/MerkleDistributor.sol/MerkleDistributor.json +1 -1
  149. package/dist/evm/artifacts/MerkleLibTest.sol/MerkleLibTest.json +1 -1
  150. package/dist/evm/artifacts/MerkleProof.sol/MerkleProof.json +1 -1
  151. package/dist/evm/artifacts/MinimalLZOptions.sol/MinimalLZOptions.json +1 -1
  152. package/dist/evm/artifacts/MintableERC1155.sol/MintableERC1155.json +1 -1
  153. package/dist/evm/artifacts/MockBedrockStandardBridge.sol/MockBedrockCrossDomainMessenger.json +1 -1
  154. package/dist/evm/artifacts/MockBedrockStandardBridge.sol/MockBedrockL1StandardBridge.json +1 -1
  155. package/dist/evm/artifacts/MockBedrockStandardBridge.sol/MockBedrockL2StandardBridge.json +1 -1
  156. package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMessageTransmitter.json +1 -1
  157. package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMessenger.json +1 -1
  158. package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMessengerV2.json +1 -1
  159. package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMinter.json +1 -1
  160. package/dist/evm/artifacts/MockCaller.sol/MockCaller.json +1 -1
  161. package/dist/evm/artifacts/MockERC1271.sol/MockERC1271.json +1 -1
  162. package/dist/evm/artifacts/MockERC20.sol/MintableERC20.json +1 -1
  163. package/dist/evm/artifacts/MockERC20.sol/MockERC20.json +1 -1
  164. package/dist/evm/artifacts/MockEndpoint.sol/MockEndpoint.json +1 -1
  165. package/dist/evm/artifacts/MockGateway.sol/MockGateway.json +1 -0
  166. package/dist/evm/artifacts/MockHubPool.sol/MockHubPool.json +1 -1
  167. package/dist/evm/artifacts/MockOFTMessenger.sol/MockOFTMessenger.json +1 -1
  168. package/dist/evm/artifacts/MockPermit2.sol/MockPermit2.json +1 -1
  169. package/dist/evm/artifacts/MockPermit2.sol/Permit2EIP712.json +1 -1
  170. package/dist/evm/artifacts/MockPermit2.sol/SignatureVerification.json +1 -1
  171. package/dist/evm/artifacts/MockSpokePool.sol/MockSpokePool.json +1 -1
  172. package/dist/evm/artifacts/MockSpokePoolV2.sol/MockSpokePoolV2.json +1 -1
  173. package/dist/evm/artifacts/MockTronUSDT.sol/MockTronUSDT.json +1 -1
  174. package/dist/evm/artifacts/MockZkStackBridgeHub.sol/MockBridgeHub.json +1 -1
  175. package/dist/evm/artifacts/Mock_Adapter.sol/Mock_Adapter.json +1 -1
  176. package/dist/evm/artifacts/Mock_Adapter.sol/Mock_Bridge.json +1 -1
  177. package/dist/evm/artifacts/Mode_Adapter.sol/Mode_Adapter.json +1 -1
  178. package/dist/evm/artifacts/MultiCaller.sol/MultiCaller.json +1 -1
  179. package/dist/evm/artifacts/MultiCallerUpgradeable.sol/MultiCallerUpgradeable.json +1 -1
  180. package/dist/evm/artifacts/Multicall3.sol/Multicall3.json +1 -1
  181. package/dist/evm/artifacts/MulticallHandler.sol/MulticallHandler.json +1 -1
  182. package/dist/evm/artifacts/OFTTransportAdapter.sol/OFTTransportAdapter.json +1 -1
  183. package/dist/evm/artifacts/OFTTransportAdapterWithStore.sol/OFTTransportAdapterWithStore.json +1 -1
  184. package/dist/evm/artifacts/OP_Adapter.sol/OP_Adapter.json +1 -1
  185. package/dist/evm/artifacts/OP_SpokePool.sol/OP_SpokePool.json +1 -1
  186. package/dist/evm/artifacts/Ovm_Forwarder.sol/Ovm_Forwarder.json +1 -1
  187. package/dist/evm/artifacts/Ovm_SpokePool.sol/Ovm_SpokePool.json +1 -1
  188. package/dist/evm/artifacts/Ovm_WithdrawalHelper.sol/Ovm_WithdrawalHelper.json +1 -1
  189. package/dist/evm/artifacts/PeripherySigningLib.sol/PeripherySigningLib.json +1 -1
  190. package/dist/evm/artifacts/PermissionedMulticallHandler.sol/PermissionedMulticallHandler.json +1 -1
  191. package/dist/evm/artifacts/PolygonERC20Test.sol/PolygonERC20Test.json +1 -1
  192. package/dist/evm/artifacts/PolygonMocks.sol/DepositManagerMock.json +1 -1
  193. package/dist/evm/artifacts/PolygonMocks.sol/FxStateSenderMock.json +1 -1
  194. package/dist/evm/artifacts/PolygonMocks.sol/PolygonERC20Mock.json +1 -1
  195. package/dist/evm/artifacts/PolygonMocks.sol/PolygonERC20PredicateMock.json +1 -1
  196. package/dist/evm/artifacts/PolygonMocks.sol/PolygonRegistryMock.json +1 -1
  197. package/dist/evm/artifacts/PolygonMocks.sol/RootChainManagerMock.json +1 -1
  198. package/dist/evm/artifacts/PolygonTokenBridger.sol/PolygonTokenBridger.json +1 -1
  199. package/dist/evm/artifacts/Polygon_Adapter.sol/Polygon_Adapter.json +1 -1
  200. package/dist/evm/artifacts/Polygon_SpokePool.sol/Polygon_SpokePool.json +1 -1
  201. package/dist/evm/artifacts/PrecompileLib.sol/PrecompileLib.json +1 -1
  202. package/dist/evm/artifacts/PrecompileSim.sol/PrecompileSim.json +1 -1
  203. package/dist/evm/artifacts/ProxyAdmin.sol/ProxyAdmin.json +1 -1
  204. package/dist/evm/artifacts/Router_Adapter.sol/Router_Adapter.json +1 -1
  205. package/dist/evm/artifacts/SP1AutoVerifier.sol/SP1AutoVerifier.json +1 -1
  206. package/dist/evm/artifacts/SP1Helios.sol/SP1Helios.json +1 -1
  207. package/dist/evm/artifacts/SP1MockVerifier.sol/SP1MockVerifier.json +1 -1
  208. package/dist/evm/artifacts/SafeCast.sol/SafeCast.json +1 -1
  209. package/dist/evm/artifacts/SafeERC20.sol/SafeERC20.json +1 -1
  210. package/dist/evm/artifacts/ShortStrings.sol/ShortStrings.json +1 -1
  211. package/dist/evm/artifacts/Solana_Adapter.sol/Solana_Adapter.json +1 -1
  212. package/dist/evm/artifacts/SpokePool.sol/SpokePool.json +1 -1
  213. package/dist/evm/artifacts/SpokePoolPeriphery.sol/SpokePoolPeriphery.json +1 -1
  214. package/dist/evm/artifacts/SpokePoolPeriphery.sol/SwapProxy.json +1 -1
  215. package/dist/evm/artifacts/SpokePoolVerifier.sol/SpokePoolVerifier.json +1 -1
  216. package/dist/evm/artifacts/SponsoredCCTPDstPeriphery.sol/SponsoredCCTPDstPeriphery.json +1 -1
  217. package/dist/evm/artifacts/SponsoredCCTPSrcPeriphery.sol/SponsoredCCTPSrcPeriphery.json +1 -1
  218. package/dist/evm/artifacts/SponsoredOFTSrcPeriphery.sol/SponsoredOFTSrcPeriphery.json +1 -1
  219. package/dist/evm/artifacts/StdConfig.sol/StdConfig.json +1 -1
  220. package/dist/evm/artifacts/Strings.sol/Strings.json +1 -1
  221. package/dist/evm/artifacts/SwapHandler.sol/SwapHandler.json +1 -1
  222. package/dist/evm/artifacts/Timer.sol/Timer.json +1 -1
  223. package/dist/evm/artifacts/TransferProxy.sol/TransferProxy.json +1 -1
  224. package/dist/evm/artifacts/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +1 -1
  225. package/dist/evm/artifacts/TronMulticallHandler.sol/TronMulticallHandler.json +1 -1
  226. package/dist/evm/artifacts/TronTransferLib.sol/TronTransferLib.json +1 -1
  227. package/dist/evm/artifacts/Tron_SpokePool.sol/Tron_SpokePool.json +1 -1
  228. package/dist/evm/artifacts/Tron_SpokePoolPeriphery.sol/Tron_SpokePoolPeriphery.json +1 -0
  229. package/dist/evm/artifacts/Tron_SpokePoolPeriphery.sol/Tron_SwapProxy.json +1 -0
  230. package/dist/evm/artifacts/Universal_Adapter.sol/Universal_Adapter.json +1 -1
  231. package/dist/evm/artifacts/Universal_SpokePool.sol/Universal_SpokePool.json +1 -1
  232. package/dist/evm/artifacts/UpgradeableBeacon.sol/UpgradeableBeacon.json +1 -1
  233. package/dist/evm/artifacts/V5SpokePoolInterface.sol/V5SpokePoolInterface.json +1 -0
  234. package/dist/evm/artifacts/WETH9.sol/WETH9.json +1 -1
  235. package/dist/evm/artifacts/WithdrawImplementation.sol/WithdrawImplementation.json +1 -1
  236. package/dist/evm/artifacts/WithdrawImplementationTron.sol/WithdrawImplementationTron.json +1 -1
  237. package/dist/evm/artifacts/ZkStack_Adapter.sol/ZkStack_Adapter.json +1 -1
  238. package/dist/evm/artifacts/ZkStack_CustomGasToken_Adapter.sol/ZkStack_CustomGasToken_Adapter.json +1 -1
  239. package/dist/evm/artifacts/ZkSyncMocks.sol/MockL2Eth.json +1 -1
  240. package/dist/evm/artifacts/ZkSyncMocks.sol/MockZkBridge.json +1 -1
  241. package/dist/evm/artifacts/ZkSync_SpokePool.sol/ZkSync_SpokePool.json +1 -1
  242. package/dist/evm/artifacts/Zora_Adapter.sol/Zora_Adapter.json +1 -1
  243. package/dist/evm/artifacts/eraVM_EIP7702.sol/SimpleContract.json +1 -1
  244. package/dist/evm/artifacts/eraVM_EIP7702.sol/SpokePoolEIP7702Test.json +1 -1
  245. package/dist/evm/artifacts/eraVM_EIP7702.sol/TestableMockSpokePool.json +1 -1
  246. package/dist/src/consts.d.ts +2 -0
  247. package/dist/src/consts.js +18 -47
  248. package/dist/src/svm/assets/idl/svm_spoke.json +9 -4
  249. package/dist/src/svm/assets/svm_spoke.d.ts +9 -4
  250. package/dist/src/svm/clients/SvmSpoke/errors/svmSpoke.d.ts +3 -1
  251. package/dist/src/svm/clients/SvmSpoke/errors/svmSpoke.js +4 -1
  252. package/dist/src/types/svm.d.ts +44 -0
  253. package/dist/target/types/svm_spoke.d.ts +9 -4
  254. package/package.json +12 -6
  255. package/contracts/chain-adapters/Blast_Adapter.sol +0 -127
  256. package/contracts/chain-adapters/Blast_RescueAdapter.sol +0 -47
  257. package/contracts/chain-adapters/Boba_Adapter.sol +0 -78
  258. package/contracts/chain-adapters/Optimism_Adapter.sol +0 -118
  259. package/contracts/chain-adapters/PolygonZkEVM_Adapter.sol +0 -75
  260. package/contracts/chain-adapters/Scroll_Adapter.sol +0 -144
  261. package/contracts/external/interfaces/IPolygonZkEVMBridge.sol +0 -40
  262. package/contracts/hub-pool/Blast_DaiRetriever.sol +0 -59
  263. package/contracts/hub-pool/PermissionSplitterProxy.sol +0 -128
  264. package/contracts/spoke-pools/Blast_SpokePool.sol +0 -161
  265. package/contracts/spoke-pools/Boba_SpokePool.sol +0 -45
  266. package/contracts/spoke-pools/Ink_SpokePool.sol +0 -72
  267. package/contracts/spoke-pools/Optimism_SpokePool.sol +0 -66
  268. package/contracts/spoke-pools/PolygonZkEVM_SpokePool.sol +0 -217
  269. package/contracts/spoke-pools/Scroll_SpokePool.sol +0 -153
  270. package/contracts/spoke-pools/WorldChain_SpokePool.sol +0 -72
  271. package/contracts/test/MockBlastUsdYieldManager.sol +0 -20
  272. package/contracts/test/MockOptimism_SpokePool.sol +0 -22
  273. package/contracts/test/PolygonZkEVMMocks.sol +0 -72
  274. package/contracts/test/ScrollMocks.sol +0 -109
  275. package/dist/evm/artifacts/Blast_Adapter.sol/Blast_Adapter.json +0 -1
  276. package/dist/evm/artifacts/Blast_Adapter.sol/IL1ERC20Bridge.json +0 -1
  277. package/dist/evm/artifacts/Blast_DaiRetriever.sol/Blast_DaiRetriever.json +0 -1
  278. package/dist/evm/artifacts/Blast_DaiRetriever.sol/USDYieldManager.json +0 -1
  279. package/dist/evm/artifacts/Blast_RescueAdapter.sol/Blast_RescueAdapter.json +0 -1
  280. package/dist/evm/artifacts/Blast_SpokePool.sol/Blast_SpokePool.json +0 -1
  281. package/dist/evm/artifacts/Blast_SpokePool.sol/IBlast.json +0 -1
  282. package/dist/evm/artifacts/Blast_SpokePool.sol/IERC20Rebasing.json +0 -1
  283. package/dist/evm/artifacts/Blast_SpokePool.sol/IUSDBL2Bridge.json +0 -1
  284. package/dist/evm/artifacts/Boba_Adapter.sol/Boba_Adapter.json +0 -1
  285. package/dist/evm/artifacts/Boba_SpokePool.sol/Boba_SpokePool.json +0 -1
  286. package/dist/evm/artifacts/IL1ERC20Gateway.sol/IL1ERC20Gateway.json +0 -1
  287. package/dist/evm/artifacts/IL1ETHGateway.sol/IL1ETHGateway.json +0 -1
  288. package/dist/evm/artifacts/IL1GatewayRouter.sol/IL1GatewayRouter.json +0 -1
  289. package/dist/evm/artifacts/IL1ScrollMessenger.sol/IL1ScrollMessenger.json +0 -1
  290. package/dist/evm/artifacts/IL2ERC20Gateway.sol/IL2ERC20Gateway.json +0 -1
  291. package/dist/evm/artifacts/IL2ETHGateway.sol/IL2ETHGateway.json +0 -1
  292. package/dist/evm/artifacts/IL2GasPriceOracle.sol/IL2GasPriceOracle.json +0 -1
  293. package/dist/evm/artifacts/IL2GatewayRouter.sol/IL2GatewayRouter.json +0 -1
  294. package/dist/evm/artifacts/IPolygonZkEVMBridge.sol/IPolygonZkEVMBridge.json +0 -1
  295. package/dist/evm/artifacts/IScrollMessenger.sol/IScrollMessenger.json +0 -1
  296. package/dist/evm/artifacts/Ink_SpokePool.sol/Ink_SpokePool.json +0 -1
  297. package/dist/evm/artifacts/MockBlastUsdYieldManager.sol/MockBlastUsdYieldManager.json +0 -1
  298. package/dist/evm/artifacts/MockOptimism_SpokePool.sol/MockOptimism_SpokePool.json +0 -1
  299. package/dist/evm/artifacts/Optimism_Adapter.sol/Optimism_Adapter.json +0 -1
  300. package/dist/evm/artifacts/Optimism_Adapter.sol/SynthetixBridgeToOptimism.json +0 -1
  301. package/dist/evm/artifacts/Optimism_SpokePool.sol/Optimism_SpokePool.json +0 -1
  302. package/dist/evm/artifacts/Optimism_SpokePool.sol/SynthetixBridgeToBase.json +0 -1
  303. package/dist/evm/artifacts/PermissionSplitterProxy.sol/PermissionSplitterProxy.json +0 -1
  304. package/dist/evm/artifacts/PolygonZkEVMMocks.sol/MockPolygonZkEVMBridge.json +0 -1
  305. package/dist/evm/artifacts/PolygonZkEVM_Adapter.sol/PolygonZkEVM_Adapter.json +0 -1
  306. package/dist/evm/artifacts/PolygonZkEVM_SpokePool.sol/IBridgeMessageReceiver.json +0 -1
  307. package/dist/evm/artifacts/PolygonZkEVM_SpokePool.sol/PolygonZkEVM_SpokePool.json +0 -1
  308. package/dist/evm/artifacts/ScrollMocks.sol/MockScrollL2GatewayRouter.json +0 -1
  309. package/dist/evm/artifacts/ScrollMocks.sol/MockScrollMessenger.json +0 -1
  310. package/dist/evm/artifacts/Scroll_Adapter.sol/Scroll_Adapter.json +0 -1
  311. package/dist/evm/artifacts/Scroll_SpokePool.sol/IL2GatewayRouterExtended.json +0 -1
  312. package/dist/evm/artifacts/Scroll_SpokePool.sol/Scroll_SpokePool.json +0 -1
  313. package/dist/evm/artifacts/WorldChain_SpokePool.sol/WorldChain_SpokePool.json +0 -1
@@ -0,0 +1,52 @@
1
+ // SPDX-License-Identifier: BUSL-1.1
2
+ pragma solidity ^0.8.0;
3
+
4
+ /**
5
+ * @title CounterfactualNonces
6
+ * @notice Shared single-use nonce tracking for counterfactual signatures that nothing else consumes:
7
+ * the SpokePool and Vanilla CCTP leaf implementations (no periphery) and `AdminWithdrawManager`
8
+ * signed withdrawals.
9
+ * @dev The mapping lives in `address(this)`'s storage under an ERC-7201 namespaced slot. For leaf
10
+ * implementations that is **each proxy's storage** (they run under the proxy's delegatecall, so
11
+ * nonces are per-clone, like the dispatcher's `activeRoot`); for a singleton like
12
+ * `AdminWithdrawManager` it is the contract's own storage. The namespace is shared by every
13
+ * contract using this mixin, so within one storage context a nonce is single-use across all of
14
+ * them — nonces are random 32 bytes chosen by the off-chain signer, so collisions are a non-issue.
15
+ * The namespace cannot collide with the dispatcher's.
16
+ *
17
+ * Deliberately exposes NO `usedNonces` getter: inherited by a leaf implementation it would enter
18
+ * the impl's public ABI but read the impl's own, never-written storage (always false) — a
19
+ * misleading ABI entry. Off-chain, check consumption via
20
+ * `eth_getStorageAt(target, keccak256(abi.encode(nonce, NONCES_STORAGE_LOCATION)))` (target = the
21
+ * proxy for leaf-impl nonces, the manager for withdraw nonces), or simulate and look for
22
+ * `InvalidNonce`.
23
+ * **Every future implementation version MUST preserve this ERC-7201 storage layout.**
24
+ * @custom:security-contact bugs@across.to
25
+ */
26
+ abstract contract CounterfactualNonces {
27
+ /// @custom:storage-location erc7201:across.counterfactual.nonces.storage
28
+ struct NoncesStorage {
29
+ mapping(bytes32 => bool) usedNonces;
30
+ }
31
+
32
+ // keccak256(abi.encode(uint256(keccak256("across.counterfactual.nonces.storage")) - 1)) & ~bytes32(uint256(0xff))
33
+ bytes32 private constant NONCES_STORAGE_LOCATION =
34
+ 0x6620ce368f04f685aa0153e5e3347c828611b4776c1dc36e5c44b4db1be22600;
35
+
36
+ /// @dev The signature's nonce was already consumed in this storage context (replay).
37
+ error InvalidNonce();
38
+
39
+ /// @dev Consume `nonce` on this proxy; reverts `InvalidNonce` if already used. Call after signature
40
+ /// verification and before any external interaction.
41
+ function _useNonce(bytes32 nonce) internal {
42
+ NoncesStorage storage $ = _getNoncesStorage();
43
+ if ($.usedNonces[nonce]) revert InvalidNonce();
44
+ $.usedNonces[nonce] = true;
45
+ }
46
+
47
+ function _getNoncesStorage() private pure returns (NoncesStorage storage $) {
48
+ assembly {
49
+ $.slot := NONCES_STORAGE_LOCATION
50
+ }
51
+ }
52
+ }
@@ -992,7 +992,13 @@ contract HyperCoreFlowExecutor is AccessControlUpgradeable, AuthorizedFundedFlow
992
992
  uint128 cloid
993
993
  ) external onlyRole(PERMISSIONED_BOT_ROLE) {
994
994
  FinalTokenInfo memory finalTokenInfo = _getExistingFinalTokenInfo(finalToken);
995
- finalTokenInfo.swapHandler.submitSpotLimitOrder(finalTokenInfo, priceX1e8, sizeX1e8, cloid);
995
+ finalTokenInfo.swapHandler.submitSpotLimitOrder(
996
+ finalTokenInfo.spotIndex,
997
+ finalTokenInfo.isBuy,
998
+ priceX1e8,
999
+ sizeX1e8,
1000
+ cloid
1001
+ );
996
1002
 
997
1003
  emit SubmittedLimitOrder(finalToken, priceX1e8, sizeX1e8, cloid);
998
1004
  }
@@ -1,9 +1,9 @@
1
- //SPDX-License-Identifier: Unlicense
1
+ // SPDX-License-Identifier: BUSL-1.1
2
2
  pragma solidity ^0.8.0;
3
- import { IERC20 } from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol";
4
- import { SafeERC20 } from "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol";
3
+
4
+ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
5
+ import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
5
6
  import { HyperCoreLib } from "../../libraries/HyperCoreLib.sol";
6
- import { FinalTokenInfo } from "./Structs.sol";
7
7
 
8
8
  contract SwapHandler {
9
9
  // See https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#asset
@@ -46,14 +46,15 @@ contract SwapHandler {
46
46
  }
47
47
 
48
48
  function submitSpotLimitOrder(
49
- FinalTokenInfo memory finalTokenInfo,
49
+ uint32 spotIndex,
50
+ bool isBuy,
50
51
  uint64 limitPriceX1e8,
51
52
  uint64 sizeX1e8,
52
53
  uint128 cloid
53
54
  ) external onlyParentHandler {
54
55
  HyperCoreLib.submitLimitOrder(
55
- finalTokenInfo.spotIndex + SPOT_MARKET_INDEX_OFFSET,
56
- finalTokenInfo.isBuy,
56
+ spotIndex + SPOT_MARKET_INDEX_OFFSET,
57
+ isBuy,
57
58
  limitPriceX1e8,
58
59
  sizeX1e8,
59
60
  false,
@@ -29,9 +29,17 @@ contract Arbitrum_SpokePool is SpokePool, CircleCCTPAdapter {
29
29
  IERC20 _l2Usdc,
30
30
  ITokenMessenger _cctpTokenMessenger,
31
31
  uint32 _oftDstEid,
32
- uint256 _oftFeeCap
32
+ uint256 _oftFeeCap,
33
+ address _gateway
33
34
  )
34
- SpokePool(_wrappedNativeTokenAddress, _depositQuoteTimeBuffer, _fillDeadlineBuffer, _oftDstEid, _oftFeeCap)
35
+ SpokePool(
36
+ _wrappedNativeTokenAddress,
37
+ _depositQuoteTimeBuffer,
38
+ _fillDeadlineBuffer,
39
+ _oftDstEid,
40
+ _oftFeeCap,
41
+ _gateway
42
+ )
35
43
  CircleCCTPAdapter(_l2Usdc, _cctpTokenMessenger, CircleDomainIds.Ethereum)
36
44
  {} // solhint-disable-line no-empty-blocks
37
45
 
@@ -22,14 +22,16 @@ contract Cher_SpokePool is Ovm_SpokePool {
22
22
  uint32 _depositQuoteTimeBuffer,
23
23
  uint32 _fillDeadlineBuffer,
24
24
  IERC20 _l2Usdc,
25
- ITokenMessenger _cctpTokenMessenger
25
+ ITokenMessenger _cctpTokenMessenger,
26
+ address _gateway
26
27
  )
27
28
  Ovm_SpokePool(
28
29
  _wrappedNativeTokenAddress,
29
30
  _depositQuoteTimeBuffer,
30
31
  _fillDeadlineBuffer,
31
32
  _l2Usdc,
32
- _cctpTokenMessenger
33
+ _cctpTokenMessenger,
34
+ _gateway
33
35
  )
34
36
  {} // solhint-disable-line no-empty-blocks
35
37
 
@@ -15,7 +15,8 @@ contract Ethereum_SpokePool is SpokePool, OwnableUpgradeable {
15
15
  constructor(
16
16
  address _wrappedNativeTokenAddress,
17
17
  uint32 _depositQuoteTimeBuffer,
18
- uint32 _fillDeadlineBuffer
18
+ uint32 _fillDeadlineBuffer,
19
+ address _gateway
19
20
  )
20
21
  SpokePool(
21
22
  _wrappedNativeTokenAddress,
@@ -23,7 +24,8 @@ contract Ethereum_SpokePool is SpokePool, OwnableUpgradeable {
23
24
  _fillDeadlineBuffer,
24
25
  // Ethereum_SpokePool does not use OFT messaging; setting destination eid and fee cap to 0
25
26
  0,
26
- 0
27
+ 0,
28
+ _gateway
27
29
  )
28
30
  {} // solhint-disable-line no-empty-blocks
29
31
 
@@ -7,6 +7,9 @@ import "./ZkSync_SpokePool.sol";
7
7
  * @notice Lens specific SpokePool. Wrapper around the ZkSync_SpokePool contract.
8
8
  * @dev Resources for compiling and deploying ZkSync contracts: https://docs.zksync.io/build/tooling/foundry/overview
9
9
  * @custom:security-contact bugs@across.to
10
+ * @dev This contract intentionally has no initializer of its own. Proxies are initialized via the
11
+ * inherited ZkSync_SpokePool.initialize, which the OZ missing-initializer heuristic does not recognize.
12
+ * @custom:oz-upgrades-unsafe-allow missing-initializer
10
13
  */
11
14
  contract Lens_SpokePool is ZkSync_SpokePool {
12
15
  /// @custom:oz-upgrades-unsafe-allow constructor
@@ -17,7 +20,8 @@ contract Lens_SpokePool is ZkSync_SpokePool {
17
20
  uint256 _l1ChainId,
18
21
  ITokenMessenger _cctpTokenMessenger,
19
22
  uint32 _depositQuoteTimeBuffer,
20
- uint32 _fillDeadlineBuffer
23
+ uint32 _fillDeadlineBuffer,
24
+ address _gateway
21
25
  )
22
26
  ZkSync_SpokePool(
23
27
  _wrappedNativeTokenAddress,
@@ -26,7 +30,8 @@ contract Lens_SpokePool is ZkSync_SpokePool {
26
30
  _l1ChainId,
27
31
  _cctpTokenMessenger,
28
32
  _depositQuoteTimeBuffer,
29
- _fillDeadlineBuffer
33
+ _fillDeadlineBuffer,
34
+ _gateway
30
35
  )
31
36
  {}
32
37
  }
@@ -52,7 +52,8 @@ contract Linea_SpokePool is SpokePool, CircleCCTPAdapter {
52
52
  uint32 _depositQuoteTimeBuffer,
53
53
  uint32 _fillDeadlineBuffer,
54
54
  IERC20 _l2Usdc,
55
- ITokenMessenger _cctpTokenMessenger
55
+ ITokenMessenger _cctpTokenMessenger,
56
+ address _gateway
56
57
  )
57
58
  SpokePool(
58
59
  _wrappedNativeTokenAddress,
@@ -60,7 +61,8 @@ contract Linea_SpokePool is SpokePool, CircleCCTPAdapter {
60
61
  _fillDeadlineBuffer,
61
62
  // Linea_SpokePool does not use OFT messaging; setting destination eid and fee cap to 0
62
63
  0,
63
- 0
64
+ 0,
65
+ _gateway
64
66
  )
65
67
  CircleCCTPAdapter(_l2Usdc, _cctpTokenMessenger, CircleDomainIds.Ethereum)
66
68
  {} // solhint-disable-line no-empty-blocks
@@ -22,14 +22,16 @@ contract Lisk_SpokePool is Ovm_SpokePool {
22
22
  uint32 _depositQuoteTimeBuffer,
23
23
  uint32 _fillDeadlineBuffer,
24
24
  IERC20 _l2Usdc,
25
- ITokenMessenger _cctpTokenMessenger
25
+ ITokenMessenger _cctpTokenMessenger,
26
+ address _gateway
26
27
  )
27
28
  Ovm_SpokePool(
28
29
  _wrappedNativeTokenAddress,
29
30
  _depositQuoteTimeBuffer,
30
31
  _fillDeadlineBuffer,
31
32
  _l2Usdc,
32
- _cctpTokenMessenger
33
+ _cctpTokenMessenger,
34
+ _gateway
33
35
  )
34
36
  {} // solhint-disable-line no-empty-blocks
35
37
 
@@ -16,14 +16,16 @@ contract OP_SpokePool is Ovm_SpokePool {
16
16
  uint32 _depositQuoteTimeBuffer,
17
17
  uint32 _fillDeadlineBuffer,
18
18
  IERC20 _l2Usdc,
19
- ITokenMessenger _cctpTokenMessenger
19
+ ITokenMessenger _cctpTokenMessenger,
20
+ address _gateway
20
21
  )
21
22
  Ovm_SpokePool(
22
23
  _wrappedNativeTokenAddress,
23
24
  _depositQuoteTimeBuffer,
24
25
  _fillDeadlineBuffer,
25
26
  _l2Usdc,
26
- _cctpTokenMessenger
27
+ _cctpTokenMessenger,
28
+ _gateway
27
29
  )
28
30
  {} // solhint-disable-line no-empty-blocks
29
31
 
@@ -29,7 +29,8 @@ interface IL2ERC20Bridge {
29
29
  }
30
30
 
31
31
  /**
32
- * @notice OVM specific SpokePool. Uses OVM cross-domain-enabled logic to implement admin only access to functions. * Optimism, Base, and Boba each implement this spoke pool and set their chain specific contract addresses for l2Eth and l2Weth.
32
+ * @notice OVM specific SpokePool. Uses OVM cross-domain-enabled logic to implement admin only access to functions.
33
+ * OP stack chains each implement this spoke pool and set their chain specific contract addresses for l2Eth and l2Weth.
33
34
  * @custom:security-contact bugs@across.to
34
35
  */
35
36
  contract Ovm_SpokePool is SpokePool, CircleCCTPAdapter {
@@ -70,7 +71,8 @@ contract Ovm_SpokePool is SpokePool, CircleCCTPAdapter {
70
71
  uint32 _depositQuoteTimeBuffer,
71
72
  uint32 _fillDeadlineBuffer,
72
73
  IERC20 _l2Usdc,
73
- ITokenMessenger _cctpTokenMessenger
74
+ ITokenMessenger _cctpTokenMessenger,
75
+ address _gateway
74
76
  )
75
77
  SpokePool(
76
78
  _wrappedNativeTokenAddress,
@@ -78,7 +80,8 @@ contract Ovm_SpokePool is SpokePool, CircleCCTPAdapter {
78
80
  _fillDeadlineBuffer,
79
81
  // Ovm_SpokePool does not use OFT messaging; setting destination eid and fee cap to 0
80
82
  0,
81
- 0
83
+ 0,
84
+ _gateway
82
85
  )
83
86
  CircleCCTPAdapter(_l2Usdc, _cctpTokenMessenger, CircleDomainIds.Ethereum)
84
87
  {} // solhint-disable-line no-empty-blocks
@@ -90,8 +93,7 @@ contract Ovm_SpokePool is SpokePool, CircleCCTPAdapter {
90
93
  * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
91
94
  * @param _withdrawalRecipient Address which receives token withdrawals. Can be changed by admin. For Spoke Pools on L2, this will
92
95
  * likely be the hub pool.
93
- * @param _l2Eth Address of L2 ETH token. Usually should be Lib_PreeployAddresses.OVM_ETH but sometimes this can
94
- * be different, like with Boba which flips the WETH and OVM_ETH addresses.
96
+ * @param _l2Eth Address of L2 ETH token, typically Lib_PredeployAddresses.OVM_ETH.
95
97
  */
96
98
  function __OvmSpokePool_init(
97
99
  uint32 _initialDepositId,
@@ -84,9 +84,17 @@ contract Polygon_SpokePool is IFxMessageProcessor, SpokePool, CircleCCTPAdapter
84
84
  IERC20 _l2Usdc,
85
85
  ITokenMessenger _cctpTokenMessenger,
86
86
  uint32 _oftDstEid,
87
- uint256 _oftFeeCap
87
+ uint256 _oftFeeCap,
88
+ address _gateway
88
89
  )
89
- SpokePool(_wrappedNativeTokenAddress, _depositQuoteTimeBuffer, _fillDeadlineBuffer, _oftDstEid, _oftFeeCap)
90
+ SpokePool(
91
+ _wrappedNativeTokenAddress,
92
+ _depositQuoteTimeBuffer,
93
+ _fillDeadlineBuffer,
94
+ _oftDstEid,
95
+ _oftFeeCap,
96
+ _gateway
97
+ )
90
98
  CircleCCTPAdapter(_l2Usdc, _cctpTokenMessenger, CircleDomainIds.Ethereum)
91
99
  {} // solhint-disable-line no-empty-blocks
92
100
 
@@ -14,6 +14,10 @@ import "../libraries/AddressConverters.sol";
14
14
  import { SafeTransferERC20 } from "../libraries/SafeTransferERC20.sol";
15
15
  import { IOFT, SendParam, MessagingFee } from "../interfaces/IOFT.sol";
16
16
  import { OFTTransportAdapter } from "../libraries/OFTTransportAdapter.sol";
17
+ import { V5SpokePoolInterface } from "../interfaces/V5SpokePoolInterface.sol";
18
+ import { IGateway } from "../external/interfaces/IGateway.sol";
19
+ import { IAcrossV5Executor } from "../external/interfaces/IAcrossV5Executor.sol";
20
+ import { IAcrossV5ExecutorAdapter } from "../external/interfaces/IAcrossV5ExecutorAdapter.sol";
17
21
 
18
22
  import "@openzeppelin/contracts-upgradeable-v4/token/ERC20/IERC20Upgradeable.sol";
19
23
  import "@openzeppelin/contracts-upgradeable-v4/token/ERC20/utils/SafeERC20Upgradeable.sol";
@@ -34,6 +38,7 @@ import "@openzeppelin/contracts-v4/utils/math/SignedMath.sol";
34
38
  */
35
39
  abstract contract SpokePool is
36
40
  V3SpokePoolInterface,
41
+ V5SpokePoolInterface,
37
42
  SpokePoolInterface,
38
43
  UUPSUpgradeable,
39
44
  ReentrancyGuardUpgradeable,
@@ -41,6 +46,8 @@ abstract contract SpokePool is
41
46
  EIP712CrossChainUpgradeable,
42
47
  IDestinationSettler,
43
48
  OFTTransportAdapter,
49
+ IAcrossV5Executor,
50
+ IAcrossV5ExecutorAdapter,
44
51
  SafeTransferERC20
45
52
  {
46
53
  // Restrict the `using` attachment to `safeTransferFrom` only. All `safeTransfer` calls must go
@@ -145,6 +152,10 @@ abstract contract SpokePool is
145
152
  /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
146
153
  uint32 public immutable fillDeadlineBuffer;
147
154
 
155
+ // Across V5 Gateway whose live execution context authenticates and parameterizes V5 fills.
156
+ /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
157
+ IGateway public immutable gateway;
158
+
148
159
  uint256 public constant MAX_TRANSFER_SIZE = 1e36;
149
160
 
150
161
  bytes32 public constant UPDATE_BYTES32_DEPOSIT_DETAILS_HASH =
@@ -172,6 +183,11 @@ abstract contract SpokePool is
172
183
  // EIP-7702 prefix for delegated wallets.
173
184
  bytes3 internal constant EIP7702_PREFIX = 0xef0100;
174
185
 
186
+ // Magic prefix tagging a deposit message as an Across V5 witness: `message = V5_MAGIC_PREFIX || stepId`,
187
+ // where stepId is the Merkle root of the Gateway execution allowed to consume the deposit. V5-tagged
188
+ // deposits are only consumable through the Gateway-context-checked V5 fill entrypoints.
189
+ bytes32 public constant V5_MAGIC_PREFIX = keccak256("AcrossV5MessagePrefix.V1");
190
+
175
191
  /****************************************
176
192
  * EVENTS *
177
193
  ****************************************/
@@ -229,6 +245,7 @@ abstract contract SpokePool is
229
245
  * into the future from the block time of the deposit.
230
246
  * @param _oftDstEid destination endpoint id for OFT messaging
231
247
  * @param _oftFeeCap fee cap in native token when paying for cross-chain OFT transfers
248
+ * @param _gateway Across V5 Gateway address. Set to address(0) to deploy with V5 fills disabled.
232
249
  */
233
250
  /// @custom:oz-upgrades-unsafe-allow constructor
234
251
  constructor(
@@ -236,11 +253,13 @@ abstract contract SpokePool is
236
253
  uint32 _depositQuoteTimeBuffer,
237
254
  uint32 _fillDeadlineBuffer,
238
255
  uint32 _oftDstEid,
239
- uint256 _oftFeeCap
256
+ uint256 _oftFeeCap,
257
+ address _gateway
240
258
  ) OFTTransportAdapter(_oftDstEid, _oftFeeCap) {
241
259
  wrappedNativeToken = WETH9Interface(_wrappedNativeTokenAddress);
242
260
  depositQuoteTimeBuffer = _depositQuoteTimeBuffer;
243
261
  fillDeadlineBuffer = _fillDeadlineBuffer;
262
+ gateway = IGateway(_gateway);
244
263
  _disableInitializers();
245
264
  }
246
265
 
@@ -289,6 +308,15 @@ abstract contract SpokePool is
289
308
  _;
290
309
  }
291
310
 
311
+ // Quarantines V5-tagged deposits from non-V5 settlement paths (regular fills, updated fills, slow-fill
312
+ // requests and executions). V5 deposits commit to a Gateway execution witness in `message` and are only
313
+ // consumable through the V5 entrypoints that check it; without this guard the witness binding would be
314
+ // bypassable.
315
+ modifier nonV5Fill(bytes memory message) {
316
+ if (_isV5Message(message)) revert V5FillOnly();
317
+ _;
318
+ }
319
+
292
320
  /**************************************
293
321
  * ADMIN FUNCTIONS *
294
322
  **************************************/
@@ -959,15 +987,8 @@ abstract contract SpokePool is
959
987
  V3RelayData memory relayData,
960
988
  uint256 repaymentChainId,
961
989
  bytes32 repaymentAddress
962
- ) public override nonReentrant unpausedFills {
963
- // Exclusivity deadline is inclusive and is the latest timestamp that the exclusive relayer has sole right
964
- // to fill the relay.
965
- if (
966
- _fillIsExclusive(relayData.exclusivityDeadline, uint32(getCurrentTime())) &&
967
- relayData.exclusiveRelayer.toAddress() != msg.sender
968
- ) {
969
- revert NotExclusiveRelayer();
970
- }
990
+ ) public override nonReentrant unpausedFills nonV5Fill(relayData.message) {
991
+ _requireExclusiveFiller(relayData.exclusivityDeadline, relayData.exclusiveRelayer, msg.sender);
971
992
 
972
993
  V3RelayExecutionParams memory relayExecution = V3RelayExecutionParams({
973
994
  relay: relayData,
@@ -1003,6 +1024,69 @@ abstract contract SpokePool is
1003
1024
  fillRelay(convertedRelayData, repaymentChainId, msg.sender.toBytes32());
1004
1025
  }
1005
1026
 
1027
+ /**
1028
+ * @notice Fills a V5 deposit as the entire Across V5 Gateway execution (spoke-as-executor mode: the user's
1029
+ * path commits the SpokePool itself as the executor, so the Gateway calls this entrypoint directly).
1030
+ * @dev Because the committed input is a fixed struct — a submitter can parse the complete execution
1031
+ * semantics before calling `Gateway.execute()` — this mode (and only this mode) pulls the output tokens
1032
+ * from the Gateway's current submitter, using the same standing approval relayers already hold for
1033
+ * `fillRelay`. The fill is terminal: after delivering to the committed recipient, a committed callback
1034
+ * message (if any) triggers the contract recipient's `handleV3AcrossMessage` hook with the submitter
1035
+ * reported as relayer, and nothing else runs.
1036
+ * @param message Path-committed `abi.encode(V5FillInput)`: the user's acceptance bounds (recipient, output
1037
+ * token, minimum output amount, callback message).
1038
+ * @param executorMessage Submitter-supplied `abi.encode(V5FillJit)`: the deposit's relay data, passed
1039
+ * verbatim, and repayment fields.
1040
+ */
1041
+ function executeAcrossV5(
1042
+ bytes calldata message,
1043
+ bytes calldata executorMessage
1044
+ ) external payable override nonReentrant {
1045
+ if (msg.sender != address(gateway)) revert V5NotGateway();
1046
+ // Fills never accept native value — the V3 fill entrypoints are not even payable. This entrypoint is
1047
+ // payable only because the V5 executor interface requires it, so reject any value rather than strand it.
1048
+ if (msg.value > 0) revert V5UnusedMsgValue();
1049
+
1050
+ _fillV5(
1051
+ abi.decode(message, (V5FillInput)),
1052
+ abi.decode(executorMessage, (V5FillJit)),
1053
+ gateway.currentSubmitter()
1054
+ );
1055
+ }
1056
+
1057
+ /**
1058
+ * @notice Fills a V5 deposit as one step inside an Across V5 Gateway execution (spoke-as-adapter mode: the
1059
+ * SpokePool is a funding-adapter target invoked mid-sequence by the executor running the user's committed
1060
+ * commands).
1061
+ * @dev Callable only by the committed executor of the live Gateway execution. Output tokens are always
1062
+ * pulled from `msg.sender` — the executing contract's own balance, funded by the Gateway or by earlier
1063
+ * steps — never from a standing submitter allowance, so a submitter executing a command sequence they
1064
+ * don't fully understand risks only what that execution was explicitly funded with. The fill has no
1065
+ * trailing call after delivery: anything that should happen next is expressed as later steps of the
1066
+ * committed sequence.
1067
+ * @param input Tape-committed `abi.encode(V5FillInput)`: the user's acceptance bounds (recipient, output
1068
+ * token, minimum output amount; no callback message may be committed).
1069
+ * @param jitData Submitter-supplied `abi.encode(V5FillJit)`: the deposit's relay data, passed verbatim,
1070
+ * and repayment fields.
1071
+ */
1072
+ function adapterExecuteAcrossV5(
1073
+ bytes calldata input,
1074
+ bytes calldata jitData
1075
+ ) external payable override nonReentrant {
1076
+ // Check that a Gateway execution is active and that the caller is its committed executor, directly.
1077
+ // For closed executors (only callable through the Gateway), this means `input` is committed in the
1078
+ // user's path rather than chosen by whoever gained control mid-execution.
1079
+ if (msg.sender != gateway.currentExecutor()) revert V5NotCurrentExecutor();
1080
+ // Fills never accept native value — the V3 fill entrypoints are not even payable. This entrypoint is
1081
+ // payable only because the V5 adapter interface requires it, so reject any value rather than strand it.
1082
+ if (msg.value > 0) revert V5UnusedMsgValue();
1083
+
1084
+ V5FillInput memory fillInput = abi.decode(input, (V5FillInput));
1085
+ if (fillInput.message.length != 0) revert V5CallbackNotAllowed();
1086
+
1087
+ _fillV5(fillInput, abi.decode(jitData, (V5FillJit)), msg.sender);
1088
+ }
1089
+
1006
1090
  /**
1007
1091
  * @notice Identical to fillV3Relay except that the relayer wants to use a depositor's updated output amount,
1008
1092
  * recipient, and/or message. The relayer should only use this function if they can supply a message signed
@@ -1029,15 +1113,8 @@ abstract contract SpokePool is
1029
1113
  bytes32 updatedRecipient,
1030
1114
  bytes calldata updatedMessage,
1031
1115
  bytes calldata depositorSignature
1032
- ) public override nonReentrant unpausedFills {
1033
- // Exclusivity deadline is inclusive and is the latest timestamp that the exclusive relayer has sole right
1034
- // to fill the relay.
1035
- if (
1036
- _fillIsExclusive(relayData.exclusivityDeadline, uint32(getCurrentTime())) &&
1037
- relayData.exclusiveRelayer.toAddress() != msg.sender
1038
- ) {
1039
- revert NotExclusiveRelayer();
1040
- }
1116
+ ) public override nonReentrant unpausedFills nonV5Fill(relayData.message) {
1117
+ _requireExclusiveFiller(relayData.exclusivityDeadline, relayData.exclusiveRelayer, msg.sender);
1041
1118
 
1042
1119
  V3RelayExecutionParams memory relayExecution = V3RelayExecutionParams({
1043
1120
  relay: relayData,
@@ -1077,7 +1154,9 @@ abstract contract SpokePool is
1077
1154
  * slow filled. If any of the params are missing or different from the origin chain deposit,
1078
1155
  * then Across will not include a slow fill for the intended deposit.
1079
1156
  */
1080
- function requestSlowFill(V3RelayData calldata relayData) public override nonReentrant unpausedFills {
1157
+ function requestSlowFill(
1158
+ V3RelayData calldata relayData
1159
+ ) public override nonReentrant unpausedFills nonV5Fill(relayData.message) {
1081
1160
  uint32 currentTime = uint32(getCurrentTime());
1082
1161
  // If a depositor has set an exclusivity deadline, then only the exclusive relayer should be able to
1083
1162
  // fast fill within this deadline. Moreover, the depositor should expect to get *fast* filled within
@@ -1164,7 +1243,7 @@ abstract contract SpokePool is
1164
1243
  V3SlowFill calldata slowFillLeaf,
1165
1244
  uint32 rootBundleId,
1166
1245
  bytes32[] calldata proof
1167
- ) public override nonReentrant {
1246
+ ) public override nonReentrant nonV5Fill(slowFillLeaf.relayData.message) {
1168
1247
  V3RelayData memory relayData = slowFillLeaf.relayData;
1169
1248
 
1170
1249
  _preExecuteLeafHook(relayData.outputToken.toAddress());
@@ -1566,9 +1645,71 @@ abstract contract SpokePool is
1566
1645
  return bytes3(account.code) == EIP7702_PREFIX;
1567
1646
  }
1568
1647
 
1648
+ // Exclusivity deadline is inclusive and is the latest timestamp that the exclusive relayer has sole right
1649
+ // to fill the relay. `filler` is msg.sender for V3 fills and the Gateway's current submitter for V5 fills.
1650
+ function _requireExclusiveFiller(
1651
+ uint32 exclusivityDeadline,
1652
+ bytes32 exclusiveRelayer,
1653
+ address filler
1654
+ ) internal view {
1655
+ if (_fillIsExclusive(exclusivityDeadline, uint32(getCurrentTime())) && exclusiveRelayer.toAddress() != filler) {
1656
+ revert NotExclusiveRelayer();
1657
+ }
1658
+ }
1659
+
1660
+ /**
1661
+ * @notice Shared core of both V5 fill modes: validates the committed acceptance bounds against the
1662
+ * submitter-supplied relay data, binds the fill to the live Gateway execution, and settles it through the
1663
+ * standard fill pipeline (fill-status ledger, FilledRelay event, token transfer, optional callback).
1664
+ * @dev The supplied relay data is hashed verbatim, so every `V5FillInput` commitment must be explicitly
1665
+ * checked against it here — recipient, output token, the output-amount floor, and the witness
1666
+ * `message == V5_MAGIC_PREFIX || gateway.currentStepId()`. The witness check makes the relay hash only
1667
+ * match a real deposit if that deposit committed to the root being executed; marking that hash filled is
1668
+ * the replay protection. The unchecked relay-data fields are competition parameters the submitter proves
1669
+ * by paying: a wrong value yields a hash matching no real deposit, forfeiting the refund. Exclusivity is
1670
+ * judged against the Gateway's current submitter in both modes: identity for relayer competition is
1671
+ * decoupled from where funds are pulled.
1672
+ * @param fillInput Deposit-committed acceptance bounds.
1673
+ * @param fillJit Submitter-supplied relay data and repayment fields.
1674
+ * @param payer Address the output tokens are pulled from: the Gateway's current submitter (executor mode)
1675
+ * or msg.sender, the executing tape's own balance (adapter mode).
1676
+ */
1677
+ function _fillV5(V5FillInput memory fillInput, V5FillJit memory fillJit, address payer) internal unpausedFills {
1678
+ V3RelayData memory relayData = fillJit.relayData;
1679
+ if (
1680
+ relayData.recipient != fillInput.recipient ||
1681
+ relayData.outputToken != fillInput.outputToken ||
1682
+ keccak256(relayData.message) != keccak256(abi.encodePacked(V5_MAGIC_PREFIX, gateway.currentStepId()))
1683
+ ) revert V5CommitmentMismatch();
1684
+ if (relayData.outputAmount < fillInput.minOutputAmount) revert V5OutputAmountTooLow();
1685
+ _requireExclusiveFiller(relayData.exclusivityDeadline, relayData.exclusiveRelayer, gateway.currentSubmitter());
1686
+
1687
+ V3RelayExecutionParams memory relayExecution = V3RelayExecutionParams({
1688
+ relay: relayData,
1689
+ relayHash: getV3RelayHash(relayData),
1690
+ updatedOutputAmount: relayData.outputAmount,
1691
+ updatedRecipient: relayData.recipient,
1692
+ updatedMessage: fillInput.message,
1693
+ repaymentChainId: fillJit.repaymentChainId
1694
+ });
1695
+
1696
+ _fillRelay(relayExecution, fillJit.repaymentAddress, false, payer);
1697
+ }
1698
+
1569
1699
  // @param relayer: relayer who is actually credited as filling this deposit. Can be different from
1570
1700
  // exclusiveRelayer if passed exclusivityDeadline or if slow fill.
1571
1701
  function _fillRelayV3(V3RelayExecutionParams memory relayExecution, bytes32 relayer, bool isSlowFill) internal {
1702
+ _fillRelay(relayExecution, relayer, isSlowFill, msg.sender);
1703
+ }
1704
+
1705
+ // @param payer: address that fast-fill output tokens are pulled from. Always msg.sender for V3 fills; V5
1706
+ // fills pull from the Gateway's current submitter (executor mode) or the executing tape (adapter mode).
1707
+ function _fillRelay(
1708
+ V3RelayExecutionParams memory relayExecution,
1709
+ bytes32 relayer,
1710
+ bool isSlowFill,
1711
+ address payer
1712
+ ) internal {
1572
1713
  V3RelayData memory relayData = relayExecution.relay;
1573
1714
 
1574
1715
  if (relayData.fillDeadline < getCurrentTime()) revert ExpiredFillDeadline();
@@ -1599,7 +1740,7 @@ abstract contract SpokePool is
1599
1740
  fillStatuses[relayHash] = uint256(FillStatus.Filled);
1600
1741
 
1601
1742
  _emitFilledRelayEvent(relayExecution, relayData, relayer, fillType);
1602
- _transferTokensToRecipient(relayExecution, relayData, isSlowFill);
1743
+ _transferTokensToRecipient(relayExecution, relayData, payer, isSlowFill);
1603
1744
  }
1604
1745
 
1605
1746
  /**
@@ -1643,11 +1784,14 @@ abstract contract SpokePool is
1643
1784
  * @notice Transfers tokens to the recipient based on the relay execution parameters.
1644
1785
  * @param relayExecution The relay execution parameters.
1645
1786
  * @param relayData The relay data.
1787
+ * @param payer Address fast-fill output tokens are pulled from; also reported as the relayer to the
1788
+ * recipient's handleV3AcrossMessage hook. Unused for the slow-fill transfer, which pays out of reserves.
1646
1789
  * @param isSlowFill Whether this is a slow fill execution.
1647
1790
  */
1648
1791
  function _transferTokensToRecipient(
1649
1792
  V3RelayExecutionParams memory relayExecution,
1650
1793
  V3RelayData memory relayData,
1794
+ address payer,
1651
1795
  bool isSlowFill
1652
1796
  ) internal {
1653
1797
  address outputToken = relayData.outputToken.toAddress();
@@ -1661,12 +1805,12 @@ abstract contract SpokePool is
1661
1805
  // recipient wants wrappedNativeToken, then we can assume that wrappedNativeToken is already in the
1662
1806
  // contract, otherwise we'll need the user to send wrappedNativeToken to this contract. Regardless, we'll
1663
1807
  // need to unwrap it to native token before sending to the user.
1664
- if (!isSlowFill) IERC20Upgradeable(outputToken).safeTransferFrom(msg.sender, address(this), amountToSend);
1808
+ if (!isSlowFill) IERC20Upgradeable(outputToken).safeTransferFrom(payer, address(this), amountToSend);
1665
1809
  _unwrapwrappedNativeTokenTo(payable(recipientToSend), amountToSend);
1666
1810
  // Else, this is a normal ERC20 token. Send to recipient.
1667
1811
  } else {
1668
1812
  // Note: Similar to note above, send token directly from the contract to the user in the slow relay case.
1669
- if (!isSlowFill) IERC20Upgradeable(outputToken).safeTransferFrom(msg.sender, recipientToSend, amountToSend);
1813
+ if (!isSlowFill) IERC20Upgradeable(outputToken).safeTransferFrom(payer, recipientToSend, amountToSend);
1670
1814
  else _safeTransfer(outputToken, recipientToSend, amountToSend);
1671
1815
  }
1672
1816
 
@@ -1675,7 +1819,7 @@ abstract contract SpokePool is
1675
1819
  AcrossMessageHandler(recipientToSend).handleV3AcrossMessage(
1676
1820
  outputToken,
1677
1821
  amountToSend,
1678
- msg.sender,
1822
+ payer,
1679
1823
  updatedMessage
1680
1824
  );
1681
1825
  }
@@ -1686,6 +1830,18 @@ abstract contract SpokePool is
1686
1830
  return exclusivityDeadline >= currentTime;
1687
1831
  }
1688
1832
 
1833
+ // Returns true if `message` is V5-tagged (starts with V5_MAGIC_PREFIX), meaning the deposit is consumable
1834
+ // only through the V5 fill entrypoints.
1835
+ function _isV5Message(bytes memory message) internal pure returns (bool) {
1836
+ if (message.length < 32) return false;
1837
+ bytes32 header;
1838
+ // solhint-disable-next-line no-inline-assembly
1839
+ assembly {
1840
+ header := mload(add(message, 32))
1841
+ }
1842
+ return header == V5_MAGIC_PREFIX;
1843
+ }
1844
+
1689
1845
  // Helper for emitting message hash. For easier easier human readability we return bytes32(0) for empty message.
1690
1846
  function _hashNonEmptyMessage(bytes memory message) internal pure returns (bytes32) {
1691
1847
  if (message.length == 0) return bytes32(0);