@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
@@ -5,6 +5,7 @@ import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
5
5
  import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
6
6
  import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
7
7
  import { ICounterfactualDeposit } from "../../interfaces/ICounterfactualDeposit.sol";
8
+ import { CounterfactualNonces } from "./CounterfactualNonces.sol";
8
9
  import { WithdrawParams } from "./WithdrawImplementation.sol";
9
10
 
10
11
  /**
@@ -12,10 +13,12 @@ import { WithdrawParams } from "./WithdrawImplementation.sol";
12
13
  * @notice Manages admin withdrawals from counterfactual deposit clones via two paths:
13
14
  * 1. Direct withdraw — trusted `directWithdrawer` calls clone.execute() with arbitrary submitterData
14
15
  * 2. Signed withdraw — anyone can trigger with a `signer` signature; recipient is forced to the user
15
- * @dev Set this contract's address as `admin` in withdrawal merkle leaves.
16
+ * @dev Set this contract's address as `admin` in withdrawal merkle leaves. Signed withdrawals carry a
17
+ * signed single-use `nonce` consumed in this contract's own storage (`CounterfactualNonces` — this
18
+ * is a plain singleton, no delegatecall), so a signature can't be replayed against a re-funded clone.
16
19
  * @custom:security-contact bugs@across.to
17
20
  */
18
- contract AdminWithdrawManager is Ownable, EIP712 {
21
+ contract AdminWithdrawManager is Ownable, EIP712, CounterfactualNonces {
19
22
  /// @notice Emitted when the direct withdrawer address is updated.
20
23
  /// @param directWithdrawer The new direct withdrawer address.
21
24
  event DirectWithdrawerUpdated(address indexed directWithdrawer);
@@ -30,7 +33,7 @@ contract AdminWithdrawManager is Ownable, EIP712 {
30
33
 
31
34
  /// @notice EIP-712 typehash for signed withdraw messages.
32
35
  bytes32 public constant SIGNED_WITHDRAW_TYPEHASH =
33
- keccak256("SignedWithdraw(address depositAddress,address token,uint256 amount,uint256 deadline)");
36
+ keccak256("SignedWithdraw(address depositAddress,address token,uint256 amount,bytes32 nonce,uint256 deadline)");
34
37
 
35
38
  /// @notice Address authorized to call `directWithdraw` without a signature.
36
39
  address public directWithdrawer;
@@ -76,6 +79,7 @@ contract AdminWithdrawManager is Ownable, EIP712 {
76
79
  * @param token Token to withdraw.
77
80
  * @param amount Amount to withdraw.
78
81
  * @param proof Merkle proof for the withdrawal leaf.
82
+ * @param nonce Signed single-use nonce; reverts `InvalidNonce` if already consumed.
79
83
  * @param deadline Timestamp after which the signature is no longer valid.
80
84
  * @param signature EIP-712 signature from `signer`.
81
85
  */
@@ -86,13 +90,17 @@ contract AdminWithdrawManager is Ownable, EIP712 {
86
90
  address token,
87
91
  uint256 amount,
88
92
  bytes32[] calldata proof,
93
+ bytes32 nonce,
89
94
  uint256 deadline,
90
95
  bytes calldata signature
91
96
  ) external {
92
97
  if (block.timestamp > deadline) revert SignatureExpired();
93
98
 
94
- bytes32 structHash = keccak256(abi.encode(SIGNED_WITHDRAW_TYPEHASH, depositAddress, token, amount, deadline));
99
+ bytes32 structHash = keccak256(
100
+ abi.encode(SIGNED_WITHDRAW_TYPEHASH, depositAddress, token, amount, nonce, deadline)
101
+ );
95
102
  if (ECDSA.recover(_hashTypedDataV4(structHash), signature) != signer) revert InvalidSignature();
103
+ _useNonce(nonce);
96
104
 
97
105
  address to = abi.decode(params, (WithdrawParams)).user;
98
106
  ICounterfactualDeposit(depositAddress).execute(implementation, params, abi.encode(token, to, amount), proof);
@@ -23,8 +23,18 @@ struct CounterfactualChainConfig {
23
23
  /// another OFT token is a beacon upgrade adding another getter.
24
24
  address oftSrcPeriphery;
25
25
  uint32 oftSrcEid;
26
+ /// @dev Native (Circle-issued or chain-canonical) USDC. Distinct from `usdce` below.
26
27
  address usdc;
28
+ /// @dev Bridged USDC.e where it exists as a token distinct from `usdc` — its own input token with its
29
+ /// own getter/cap, NOT a fallback filling the `usdc` slot. SpokePool routes only (no CCTP burn
30
+ /// path for bridged USDC).
31
+ address usdce;
27
32
  address usdt;
33
+ address wbtc;
34
+ /// @dev Canonical WETH ERC-20 on this chain — an input token like `usdc`/`usdt`/`wbtc`, distinct from
35
+ /// `wrappedNativeToken` (the wrapped GAS token, e.g. WBNB/WPOL; identical to WETH only on ETH-gas
36
+ /// chains). Lets leaves route actual WETH on chains whose native asset is not ETH.
37
+ address weth;
28
38
  /// @dev Per-(token, bridge) execution-fee caps, in input-token units. A leaf names which to enforce via
29
39
  /// a `bytes4` selector (its `maxExecutionFeeGetter`). Illustrative set — add more as routes need them.
30
40
  /// For SpokePool this is the fixed component of the fee cap (added to the leaf's `maxFeeBps` term).
@@ -34,8 +44,10 @@ struct CounterfactualChainConfig {
34
44
  uint256 usdcCctpMaxFeeBps;
35
45
  uint256 usdtOftMaxExecutionFee;
36
46
  uint256 usdcSpokePoolMaxExecutionFee;
47
+ uint256 usdceSpokePoolMaxExecutionFee;
37
48
  uint256 usdtSpokePoolMaxExecutionFee;
38
49
  uint256 wethSpokePoolMaxExecutionFee;
50
+ uint256 wbtcSpokePoolMaxExecutionFee;
39
51
  }
40
52
 
41
53
  /**
@@ -54,7 +66,7 @@ struct CounterfactualChainConfig {
54
66
  * configuration change and is **not subject to audit** — only changes to the base's *logic* are audited.
55
67
  * @custom:security-contact bugs@across.to
56
68
  */
57
- contract CounterfactualBeacon is CounterfactualBeaconBase {
69
+ contract CounterfactualBeacon is CounterfactualBeaconBase, ICounterfactualBeacon {
58
70
  /// @inheritdoc ICounterfactualBeacon
59
71
  address public immutable signer;
60
72
  /// @inheritdoc ICounterfactualBeacon
@@ -76,8 +88,14 @@ contract CounterfactualBeacon is CounterfactualBeaconBase {
76
88
  /// @inheritdoc ICounterfactualBeacon
77
89
  address public immutable usdc;
78
90
  /// @inheritdoc ICounterfactualBeacon
91
+ address public immutable usdce;
92
+ /// @inheritdoc ICounterfactualBeacon
79
93
  address public immutable usdt;
80
94
  /// @inheritdoc ICounterfactualBeacon
95
+ address public immutable wbtc;
96
+ /// @inheritdoc ICounterfactualBeacon
97
+ address public immutable weth;
98
+ /// @inheritdoc ICounterfactualBeacon
81
99
  uint256 public immutable usdcCctpMaxExecutionFee;
82
100
  /// @inheritdoc ICounterfactualBeacon
83
101
  uint256 public immutable usdcCctpMaxFeeBps;
@@ -86,9 +104,13 @@ contract CounterfactualBeacon is CounterfactualBeaconBase {
86
104
  /// @inheritdoc ICounterfactualBeacon
87
105
  uint256 public immutable usdcSpokePoolMaxExecutionFee;
88
106
  /// @inheritdoc ICounterfactualBeacon
107
+ uint256 public immutable usdceSpokePoolMaxExecutionFee;
108
+ /// @inheritdoc ICounterfactualBeacon
89
109
  uint256 public immutable usdtSpokePoolMaxExecutionFee;
90
110
  /// @inheritdoc ICounterfactualBeacon
91
111
  uint256 public immutable wethSpokePoolMaxExecutionFee;
112
+ /// @inheritdoc ICounterfactualBeacon
113
+ uint256 public immutable wbtcSpokePoolMaxExecutionFee;
92
114
 
93
115
  /// @param config The chain-specific configuration baked into this implementation (see
94
116
  /// `CounterfactualChainConfig`). Each field becomes an immutable, named getter.
@@ -103,13 +125,18 @@ contract CounterfactualBeacon is CounterfactualBeaconBase {
103
125
  oftSrcPeriphery = config.oftSrcPeriphery;
104
126
  oftSrcEid = config.oftSrcEid;
105
127
  usdc = config.usdc;
128
+ usdce = config.usdce;
106
129
  usdt = config.usdt;
130
+ wbtc = config.wbtc;
131
+ weth = config.weth;
107
132
  usdcCctpMaxExecutionFee = config.usdcCctpMaxExecutionFee;
108
133
  usdcCctpMaxFeeBps = config.usdcCctpMaxFeeBps;
109
134
  usdtOftMaxExecutionFee = config.usdtOftMaxExecutionFee;
110
135
  usdcSpokePoolMaxExecutionFee = config.usdcSpokePoolMaxExecutionFee;
136
+ usdceSpokePoolMaxExecutionFee = config.usdceSpokePoolMaxExecutionFee;
111
137
  usdtSpokePoolMaxExecutionFee = config.usdtSpokePoolMaxExecutionFee;
112
138
  wethSpokePoolMaxExecutionFee = config.wethSpokePoolMaxExecutionFee;
139
+ wbtcSpokePoolMaxExecutionFee = config.wbtcSpokePoolMaxExecutionFee;
113
140
  _disableInitializers();
114
141
  }
115
142
  }
@@ -5,7 +5,7 @@ import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/I
5
5
  import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
6
6
  import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
7
7
  import { IBeacon } from "@openzeppelin/contracts/proxy/beacon/IBeacon.sol";
8
- import { ICounterfactualBeacon } from "../../interfaces/ICounterfactualBeacon.sol";
8
+ import { ICounterfactualBeaconBase } from "../../interfaces/ICounterfactualBeaconBase.sol";
9
9
 
10
10
  /// @dev Minimal view used to verify a candidate beacon target is bound to this beacon — every
11
11
  /// counterfactual implementation embeds its beacon as the immutable `BEACON` (for `updateRoot`).
@@ -18,18 +18,18 @@ interface IBeaconTarget {
18
18
  * @notice The **logic** of the counterfactual registry/beacon: the mutable `implementation` (beacon target)
19
19
  * every proxy runs, the `upgradeRoot` authorizing per-proxy root updates, UUPS upgradeability and the
20
20
  * `Ownable2Step` admin. The chain-specific configuration (endpoints, tokens, fee signer, fee caps)
21
- * lives in the derived `CounterfactualBeacon` as immutables. Splitting it out keeps the audit
22
- * boundary clean: this base is the reviewable logic; a config-only change is a new derived contract
23
- * that touches no logic here (see `CounterfactualBeacon`).
24
- * @dev Abstract — the config getters declared in `ICounterfactualBeacon` are implemented by the derived
25
- * contract's immutables. A UUPS proxy, so the registry address is permanent (anchoring every
26
- * `BeaconProxy`) while logic/config evolve. `Ownable2Step` admin (no timelock) — it can retarget every
27
- * proxy instantly, so use a trusted multisig. `implementation()` is the beacon target, not the
28
- * registry's own UUPS implementation.
21
+ * lives in a derived contract as immutables. Splitting it out keeps the audit boundary clean: this
22
+ * base is the reviewable logic; a config-only change is a new derived contract that touches no logic
23
+ * here (see `CounterfactualBeacon`).
24
+ * @dev Abstract — the config getters are declared by whichever config interface the derived contract
25
+ * implements (`ICounterfactualBeacon` for this repo's beacon) and satisfied by its immutables. A UUPS
26
+ * proxy, so the registry address is permanent (anchoring every `BeaconProxy`) while logic/config
27
+ * evolve. `Ownable2Step` admin (no timelock) — it can retarget every proxy instantly, so use a trusted
28
+ * multisig. `implementation()` is the beacon target, not the registry's own UUPS implementation.
29
29
  * @custom:security-contact bugs@across.to
30
30
  */
31
31
  abstract contract CounterfactualBeaconBase is
32
- ICounterfactualBeacon,
32
+ ICounterfactualBeaconBase,
33
33
  Initializable,
34
34
  UUPSUpgradeable,
35
35
  Ownable2StepUpgradeable
@@ -72,7 +72,7 @@ abstract contract CounterfactualBeaconBase is
72
72
  return _getStorage().implementation;
73
73
  }
74
74
 
75
- /// @inheritdoc ICounterfactualBeacon
75
+ /// @inheritdoc ICounterfactualBeaconBase
76
76
  function upgradeRoot() external view returns (bytes32) {
77
77
  return _getStorage().upgradeRoot;
78
78
  }
@@ -3,7 +3,7 @@ pragma solidity ^0.8.0;
3
3
 
4
4
  import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
5
5
  import { MerkleProof } from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
6
- import { ICounterfactualBeacon } from "../../interfaces/ICounterfactualBeacon.sol";
6
+ import { ICounterfactualBeaconBase } from "../../interfaces/ICounterfactualBeaconBase.sol";
7
7
  import { ICounterfactualDeposit } from "../../interfaces/ICounterfactualDeposit.sol";
8
8
  import { ICounterfactualImplementation } from "../../interfaces/ICounterfactualImplementation.sol";
9
9
 
@@ -42,19 +42,10 @@ contract CounterfactualDeposit is Initializable, ICounterfactualDeposit {
42
42
  // keccak256(abi.encode(uint256(keccak256("across.counterfactual.upgradeable.storage")) - 1)) & ~bytes32(uint256(0xff))
43
43
  bytes32 private constant STORAGE_LOCATION = 0x5b89d334b964a560e5498fb6b9c95b4213116f116bbd1e59c9c85ba952217700;
44
44
 
45
- /// @notice The `CounterfactualBeacon` — the beacon every counterfactual `BeaconProxy` resolves its
46
- /// implementation from, and the source of the `upgradeRoot` used by `updateRoot`.
47
- ICounterfactualBeacon public immutable BEACON;
48
-
49
- /// @notice Emitted when `activeRoot` is updated via the upgrade tree.
50
- event RootUpdated(bytes32 newRoot);
51
-
52
- /// @dev Merkle proof against the registry's `(proxy, latestRoot)` tree failed.
53
- error InvalidUpgradeProof();
54
- /// @dev New root equals the current `activeRoot` (no-op).
55
- error RootUnchanged();
45
+ /// @inheritdoc ICounterfactualDeposit
46
+ ICounterfactualBeaconBase public immutable BEACON;
56
47
 
57
- constructor(ICounterfactualBeacon beacon) {
48
+ constructor(ICounterfactualBeaconBase beacon) {
58
49
  BEACON = beacon;
59
50
  _disableInitializers();
60
51
  }
@@ -69,7 +60,7 @@ contract CounterfactualDeposit is Initializable, ICounterfactualDeposit {
69
60
  /// @dev Accept native value sent to the proxy (deposits before/after deployment, refunds).
70
61
  receive() external payable {}
71
62
 
72
- /// @notice The merkle root authorizing this proxy's deposit routes.
63
+ /// @inheritdoc ICounterfactualDeposit
73
64
  function activeRoot() public view returns (bytes32) {
74
65
  return _getStorage().activeRoot;
75
66
  }
@@ -99,8 +90,7 @@ contract CounterfactualDeposit is Initializable, ICounterfactualDeposit {
99
90
  _execute(implementation, params, submitterData, executeProof);
100
91
  }
101
92
 
102
- /// @notice Update `activeRoot`, proving `(address(this), newRoot)` is in the registry's upgrade tree.
103
- /// @dev Permissionless. Root updates are best-effort — a proxy keeps its `activeRoot` until updated.
93
+ /// @inheritdoc ICounterfactualDeposit
104
94
  function updateRoot(bytes32 newRoot, bytes32[] calldata proof) external {
105
95
  _updateRoot(newRoot, proof);
106
96
  }
@@ -6,6 +6,7 @@ import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.s
6
6
  import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
7
7
  import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
8
8
  import { SponsoredCCTPInterface } from "../../interfaces/SponsoredCCTPInterface.sol";
9
+ import { ICounterfactualBeacon } from "../../interfaces/ICounterfactualBeacon.sol";
9
10
  import { ICounterfactualImplementation } from "../../interfaces/ICounterfactualImplementation.sol";
10
11
  import { CounterfactualImplementationBase } from "./CounterfactualImplementationBase.sol";
11
12
  import { BPS_SCALAR } from "./CounterfactualConstants.sol";
@@ -104,8 +105,9 @@ contract CounterfactualDepositCCTP is CounterfactualImplementationBase, EIP712 {
104
105
  if (submitterData.executionFee > _resolveBeaconUint(routeParams.maxExecutionFeeGetter))
105
106
  revert MaxExecutionFee();
106
107
 
107
- address srcPeriphery = _requireConfigured(_beacon().cctpSrcPeriphery());
108
- address inputToken = _requireConfigured(_beacon().usdc());
108
+ ICounterfactualBeacon beacon = ICounterfactualBeacon(_beacon());
109
+ address srcPeriphery = _requireConfigured(beacon.cctpSrcPeriphery());
110
+ address inputToken = _requireConfigured(beacon.usdc());
109
111
 
110
112
  // Fee paid before the periphery call (load-bearing): the local signature binds the route and
111
113
  // (nonce, fee, deadline) but not `amount`, so amount-replay protection is the periphery's nonce
@@ -139,8 +141,10 @@ contract CounterfactualDepositCCTP is CounterfactualImplementationBase, EIP712 {
139
141
  submitterData.signatureDeadline
140
142
  )
141
143
  );
142
- if (ECDSA.recover(_hashTypedDataV4(structHash), submitterData.counterfactualSignature) != _beacon().signer())
143
- revert InvalidSignature();
144
+ if (
145
+ ECDSA.recover(_hashTypedDataV4(structHash), submitterData.counterfactualSignature) !=
146
+ ICounterfactualBeacon(_beacon()).signer()
147
+ ) revert InvalidSignature();
144
148
  }
145
149
 
146
150
  /// @notice Calls `depositForBurn` on the SponsoredCCTPSrcPeriphery with the constructed quote.
@@ -158,7 +162,7 @@ contract CounterfactualDepositCCTP is CounterfactualImplementationBase, EIP712 {
158
162
  ) private {
159
163
  ISponsoredCCTPSrcPeriphery(srcPeriphery).depositForBurn(
160
164
  SponsoredCCTPInterface.SponsoredCCTPQuote({
161
- sourceDomain: _beacon().cctpSourceDomain(),
165
+ sourceDomain: ICounterfactualBeacon(_beacon()).cctpSourceDomain(),
162
166
  destinationDomain: routeParams.destinationDomain,
163
167
  mintRecipient: routeParams.mintRecipient,
164
168
  amount: depositAmount,
@@ -4,6 +4,7 @@ pragma solidity ^0.8.0;
4
4
  import { Create2 } from "@openzeppelin/contracts/utils/Create2.sol";
5
5
  import { BeaconProxy } from "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
6
6
  import { CounterfactualDeposit } from "./CounterfactualDeposit.sol";
7
+ import { ICounterfactualDepositFactory } from "../../interfaces/ICounterfactualDepositFactory.sol";
7
8
 
8
9
  /**
9
10
  * @title CounterfactualDepositFactory
@@ -20,13 +21,10 @@ import { CounterfactualDeposit } from "./CounterfactualDeposit.sol";
20
21
  * variants (e.g. Tron's 0x41 CREATE2 prefix) can override prediction.
21
22
  * @custom:security-contact bugs@across.to
22
23
  */
23
- contract CounterfactualDepositFactory {
24
- /// @notice The beacon (the `CounterfactualBeacon`) every deployed proxy points at.
24
+ contract CounterfactualDepositFactory is ICounterfactualDepositFactory {
25
+ /// @inheritdoc ICounterfactualDepositFactory
25
26
  address public immutable BEACON;
26
27
 
27
- /// @notice Emitted when a counterfactual proxy is deployed.
28
- event CounterfactualDeployed(address indexed counterfactual, bytes32 initialRoot);
29
-
30
28
  constructor(address beacon) {
31
29
  BEACON = beacon;
32
30
  }
@@ -6,6 +6,7 @@ import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.s
6
6
  import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
7
7
  import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
8
8
  import { SponsoredOFTInterface } from "../../interfaces/SponsoredOFTInterface.sol";
9
+ import { ICounterfactualBeacon } from "../../interfaces/ICounterfactualBeacon.sol";
9
10
  import { ICounterfactualImplementation } from "../../interfaces/ICounterfactualImplementation.sol";
10
11
  import { CounterfactualImplementationBase } from "./CounterfactualImplementationBase.sol";
11
12
 
@@ -149,8 +150,10 @@ contract CounterfactualDepositOFT is CounterfactualImplementationBase, EIP712 {
149
150
  submitterData.signatureDeadline
150
151
  )
151
152
  );
152
- if (ECDSA.recover(_hashTypedDataV4(structHash), submitterData.counterfactualSignature) != _beacon().signer())
153
- revert InvalidSignature();
153
+ if (
154
+ ECDSA.recover(_hashTypedDataV4(structHash), submitterData.counterfactualSignature) !=
155
+ ICounterfactualBeacon(_beacon()).signer()
156
+ ) revert InvalidSignature();
154
157
  }
155
158
 
156
159
  /// @notice Calls `deposit` on the SponsoredOFTSrcPeriphery with the constructed quote.
@@ -167,7 +170,7 @@ contract CounterfactualDepositOFT is CounterfactualImplementationBase, EIP712 {
167
170
  ISponsoredOFTSrcPeriphery(oftSrcPeriphery).deposit{ value: msg.value }(
168
171
  SponsoredOFTInterface.Quote({
169
172
  signedParams: SponsoredOFTInterface.SignedQuoteParams({
170
- srcEid: _beacon().oftSrcEid(),
173
+ srcEid: ICounterfactualBeacon(_beacon()).oftSrcEid(),
171
174
  dstEid: routeParams.dstEid,
172
175
  destinationHandler: routeParams.destinationHandler,
173
176
  amountLD: depositAmount,
@@ -9,6 +9,7 @@ import { V3SpokePoolInterface } from "../../interfaces/V3SpokePoolInterface.sol"
9
9
  import { ICounterfactualBeacon } from "../../interfaces/ICounterfactualBeacon.sol";
10
10
  import { ICounterfactualImplementation } from "../../interfaces/ICounterfactualImplementation.sol";
11
11
  import { CounterfactualImplementationBase } from "./CounterfactualImplementationBase.sol";
12
+ import { CounterfactualNonces } from "./CounterfactualNonces.sol";
12
13
  import { BPS_SCALAR } from "./CounterfactualConstants.sol";
13
14
  import { SafeTransferERC20 } from "../../libraries/SafeTransferERC20.sol";
14
15
 
@@ -43,6 +44,7 @@ struct SpokePoolSubmitterData {
43
44
  bytes32 exclusiveRelayer;
44
45
  uint32 exclusivityDeadline;
45
46
  address executionFeeRecipient;
47
+ bytes32 nonce;
46
48
  uint32 quoteTimestamp;
47
49
  uint32 fillDeadline;
48
50
  uint32 signatureDeadline;
@@ -60,12 +62,18 @@ struct SpokePoolSubmitterData {
60
62
  *
61
63
  * No per-token variants or per-variant EIP-712 names: `inputTokenGetter` is in `params` →
62
64
  * `routeParamsHash`, which the fee signature binds, so a signature for one token can't validate for
63
- * another. Cross-chain replay is prevented by the domain `chainId`, cross-clone by `verifyingContract`.
64
- * No nonce needed (balance is consumed on execution; short deadlines bound the window). Depositor
65
+ * another. Cross-chain replay is prevented by the domain `chainId`, cross-clone by `verifyingContract`,
66
+ * and same-clone replay by a signed single-use `nonce` consumed in the proxy's storage
67
+ * (`CounterfactualNonces`), so a re-funded proxy can't be re-executed on an old signature. Depositor
65
68
  * speed-ups are unsupported: `depositor` is `address(this)` (the clone), which can't sign.
66
69
  * @custom:security-contact bugs@across.to
67
70
  */
68
- contract CounterfactualDepositSpokePool is CounterfactualImplementationBase, EIP712, SafeTransferERC20 {
71
+ contract CounterfactualDepositSpokePool is
72
+ CounterfactualImplementationBase,
73
+ CounterfactualNonces,
74
+ EIP712,
75
+ SafeTransferERC20
76
+ {
69
77
  // `using` is restricted to `forceApprove`; `safeTransfer` goes through the `_safeTransfer` hook so
70
78
  // chain-specific variants (Tron) can override transfer semantics in one place.
71
79
  using { SafeERC20.forceApprove } for IERC20;
@@ -83,6 +91,7 @@ contract CounterfactualDepositSpokePool is CounterfactualImplementationBase, EIP
83
91
  * @param exclusiveRelayer Address of the exclusive relayer (bytes32-encoded).
84
92
  * @param exclusivityDeadline Timestamp until which the exclusive relayer has priority.
85
93
  * @param executionFeeRecipient Address that received the execution fee.
94
+ * @param nonce Single-use nonce consumed by this execution.
86
95
  * @param quoteTimestamp Timestamp of the deposit quote.
87
96
  * @param fillDeadline Deadline by which the deposit must be filled.
88
97
  * @param signatureDeadline Deadline after which the authorizing signature expires.
@@ -94,6 +103,7 @@ contract CounterfactualDepositSpokePool is CounterfactualImplementationBase, EIP
94
103
  bytes32 indexed exclusiveRelayer,
95
104
  uint32 exclusivityDeadline,
96
105
  address indexed executionFeeRecipient,
106
+ bytes32 nonce,
97
107
  uint32 quoteTimestamp,
98
108
  uint32 fillDeadline,
99
109
  uint32 signatureDeadline,
@@ -108,7 +118,7 @@ contract CounterfactualDepositSpokePool is CounterfactualImplementationBase, EIP
108
118
  /// @notice EIP-712 typehash for execute deposit signature verification.
109
119
  bytes32 public constant EXECUTE_DEPOSIT_TYPEHASH =
110
120
  keccak256(
111
- "ExecuteDeposit(address clone,bytes32 routeParamsHash,uint256 inputAmount,uint256 outputAmount,bytes32 exclusiveRelayer,uint32 exclusivityDeadline,uint32 quoteTimestamp,uint32 fillDeadline,uint32 signatureDeadline,uint256 executionFee)"
121
+ "ExecuteDeposit(address clone,bytes32 routeParamsHash,bytes32 nonce,uint256 inputAmount,uint256 outputAmount,bytes32 exclusiveRelayer,uint32 exclusivityDeadline,uint32 quoteTimestamp,uint32 fillDeadline,uint32 signatureDeadline,uint256 executionFee)"
112
122
  );
113
123
 
114
124
  constructor() EIP712("CounterfactualDepositSpokePool", "v2.0.0") {} // solhint-disable-line no-empty-blocks
@@ -118,7 +128,8 @@ contract CounterfactualDepositSpokePool is CounterfactualImplementationBase, EIP
118
128
  * @dev `routeParamsEncoded`/`submitterDataEncoded` decode to `SpokePoolRouteParams`/`SpokePoolSubmitterData`
119
129
  * (the latter carries the beacon `signer`'s EIP-712 signature). The value resolved from
120
130
  * `inputTokenGetter` decides native (`NATIVE_SENTINEL`, msg.value) vs ERC-20. Reverts:
121
- * `SignatureExpired`, `InvalidSignature`, `MaxFee`, `NativeTransferFailed`, `RouteNotConfigured`.
131
+ * `SignatureExpired`, `InvalidSignature`, `InvalidNonce`, `MaxFee`, `NativeTransferFailed`,
132
+ * `RouteNotConfigured`.
122
133
  */
123
134
  function execute(bytes calldata routeParamsEncoded, bytes calldata submitterDataEncoded) external payable {
124
135
  SpokePoolRouteParams memory routeParams = abi.decode(routeParamsEncoded, (SpokePoolRouteParams));
@@ -126,6 +137,7 @@ contract CounterfactualDepositSpokePool is CounterfactualImplementationBase, EIP
126
137
 
127
138
  if (block.timestamp > submitterData.signatureDeadline) revert SignatureExpired();
128
139
  _verifySignature(keccak256(routeParamsEncoded), submitterData);
140
+ _useNonce(submitterData.nonce);
129
141
 
130
142
  uint256 depositAmount = submitterData.inputAmount - submitterData.executionFee;
131
143
  _checkFee(
@@ -137,7 +149,7 @@ contract CounterfactualDepositSpokePool is CounterfactualImplementationBase, EIP
137
149
  _resolveBeaconUint(routeParams.maxExecutionFeeGetter)
138
150
  );
139
151
 
140
- ICounterfactualBeacon beacon = _beacon();
152
+ ICounterfactualBeacon beacon = ICounterfactualBeacon(_beacon());
141
153
  address spokePool = _requireConfigured(beacon.spokePool());
142
154
 
143
155
  // The leaf names a beacon getter; its resolved value decides native (`NATIVE_SENTINEL`) vs ERC-20.
@@ -185,6 +197,7 @@ contract CounterfactualDepositSpokePool is CounterfactualImplementationBase, EIP
185
197
  submitterData.exclusiveRelayer,
186
198
  submitterData.exclusivityDeadline,
187
199
  submitterData.executionFeeRecipient,
200
+ submitterData.nonce,
188
201
  submitterData.quoteTimestamp,
189
202
  submitterData.fillDeadline,
190
203
  submitterData.signatureDeadline,
@@ -219,6 +232,7 @@ contract CounterfactualDepositSpokePool is CounterfactualImplementationBase, EIP
219
232
  EXECUTE_DEPOSIT_TYPEHASH,
220
233
  address(this),
221
234
  routeParamsHash,
235
+ submitterData.nonce,
222
236
  submitterData.inputAmount,
223
237
  submitterData.outputAmount,
224
238
  submitterData.exclusiveRelayer,
@@ -229,7 +243,9 @@ contract CounterfactualDepositSpokePool is CounterfactualImplementationBase, EIP
229
243
  submitterData.executionFee
230
244
  )
231
245
  );
232
- if (ECDSA.recover(_hashTypedDataV4(structHash), submitterData.signature) != _beacon().signer())
233
- revert InvalidSignature();
246
+ if (
247
+ ECDSA.recover(_hashTypedDataV4(structHash), submitterData.signature) !=
248
+ ICounterfactualBeacon(_beacon()).signer()
249
+ ) revert InvalidSignature();
234
250
  }
235
251
  }
@@ -6,8 +6,10 @@ import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.s
6
6
  import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
7
7
  import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
8
8
  import { ITokenMessengerV2 } from "../../external/interfaces/CCTPInterfaces.sol";
9
+ import { ICounterfactualBeacon } from "../../interfaces/ICounterfactualBeacon.sol";
9
10
  import { ICounterfactualImplementation } from "../../interfaces/ICounterfactualImplementation.sol";
10
11
  import { CounterfactualImplementationBase } from "./CounterfactualImplementationBase.sol";
12
+ import { CounterfactualNonces } from "./CounterfactualNonces.sol";
11
13
  import { BPS_SCALAR } from "./CounterfactualConstants.sol";
12
14
 
13
15
  /**
@@ -37,6 +39,7 @@ struct VanillaCCTPRouteParams {
37
39
  struct VanillaCCTPSubmitterData {
38
40
  uint256 amount;
39
41
  address executionFeeRecipient;
42
+ bytes32 nonce;
40
43
  uint256 executionFee;
41
44
  /// @dev Circle fast-transfer `maxFee` passed to the TokenMessenger (0 ⇒ standard transfer), capped at
42
45
  /// the beacon's `<cctpMaxFeeBpsGetter>` bps of the burned amount.
@@ -55,23 +58,26 @@ struct VanillaCCTPSubmitterData {
55
58
  * the beacon, so the impl holds no chain-specific values and has one address per chain.
56
59
  *
57
60
  * With no periphery quote signature, the local EIP-712 fee signature binds the full route
58
- * (`routeParamsHash`), `amount`, `executionFee`, `maxFeeCctp`, `minFinalityThreshold` and
59
- * `signatureDeadline`. Replay protection is the short `signatureDeadline` (no nonce). ERC-20 only.
61
+ * (`routeParamsHash`), `nonce`, `amount`, `executionFee`, `maxFeeCctp`, `minFinalityThreshold` and
62
+ * `signatureDeadline`. Replay protection is the signed single-use `nonce` consumed in the proxy's
63
+ * storage (`CounterfactualNonces`), bounded further by the short `signatureDeadline`. ERC-20 only.
60
64
  * @custom:security-contact bugs@across.to
61
65
  */
62
- contract CounterfactualDepositVanillaCCTP is CounterfactualImplementationBase, EIP712 {
66
+ contract CounterfactualDepositVanillaCCTP is CounterfactualImplementationBase, CounterfactualNonces, EIP712 {
63
67
  using SafeERC20 for IERC20;
64
68
 
65
69
  /**
66
70
  * @notice Emitted after a vanilla CCTP deposit is successfully executed.
67
71
  * @param amount Total input amount (including execution fee).
68
72
  * @param executionFeeRecipient Address that received the execution fee.
73
+ * @param nonce Single-use nonce consumed by this execution.
69
74
  * @param executionFee Execution fee paid to the executor (in input token).
70
75
  * @param depositAmount Amount burned via CCTP (`amount - executionFee`).
71
76
  */
72
77
  event VanillaCCTPDepositExecuted(
73
78
  uint256 amount,
74
79
  address indexed executionFeeRecipient,
80
+ bytes32 nonce,
75
81
  uint256 executionFee,
76
82
  uint256 depositAmount
77
83
  );
@@ -81,14 +87,18 @@ contract CounterfactualDepositVanillaCCTP is CounterfactualImplementationBase, E
81
87
  error MaxExecutionFee();
82
88
  error MaxCctpFee();
83
89
 
84
- /// @notice EIP-712 typehash binding the fee signature to the route, amount, runtime fees (executor +
85
- /// Circle), finality threshold, and deadline.
90
+ /// @notice EIP-712 typehash binding the fee signature to the route, nonce, amount, runtime fees
91
+ /// (executor + Circle), finality threshold, and deadline.
86
92
  bytes32 public constant EXECUTE_VANILLA_CCTP_TYPEHASH =
87
93
  keccak256(
88
- "ExecuteVanillaCCTP(bytes32 routeParamsHash,uint256 amount,uint256 executionFee,uint256 maxFeeCctp,uint32 minFinalityThreshold,uint32 signatureDeadline)"
94
+ "ExecuteVanillaCCTP(bytes32 routeParamsHash,bytes32 nonce,uint256 amount,uint256 executionFee,uint256 maxFeeCctp,uint32 minFinalityThreshold,uint32 signatureDeadline)"
89
95
  );
90
96
 
91
- constructor() EIP712("CounterfactualDepositVanillaCCTP", "v2.0.0") {}
97
+ /// @dev The domain name is intentionally shorter than the contract name: EIP-712 name/version strings
98
+ /// must stay <= 31 bytes so OpenZeppelin packs them into immutables. At 32+ bytes they'd go to a
99
+ /// ShortStrings storage fallback, which under the dispatcher's delegatecall would resolve against
100
+ /// the clone's (uninitialized) storage in `_EIP712Name()`/`_EIP712Version()`.
101
+ constructor() EIP712("CounterfactualVanillaCCTP", "v2.0.0") {}
92
102
 
93
103
  /**
94
104
  * @inheritdoc ICounterfactualImplementation
@@ -99,8 +109,9 @@ contract CounterfactualDepositVanillaCCTP is CounterfactualImplementationBase, E
99
109
  VanillaCCTPRouteParams memory routeParams = abi.decode(routeParamsEncoded, (VanillaCCTPRouteParams));
100
110
  VanillaCCTPSubmitterData memory submitterData = abi.decode(submitterDataEncoded, (VanillaCCTPSubmitterData));
101
111
 
102
- // Sole authorization (no periphery sig): binds the exact leaf params, amount, and fee.
112
+ // Sole authorization (no periphery sig): binds the exact leaf params, nonce, amount, and fee.
103
113
  _verifySignature(keccak256(routeParamsEncoded), submitterData);
114
+ _useNonce(submitterData.nonce);
104
115
 
105
116
  // Each fee is capped independently against the beacon getter its leaf names.
106
117
  if (submitterData.executionFee > _resolveBeaconUint(routeParams.maxExecutionFeeGetter))
@@ -111,8 +122,9 @@ contract CounterfactualDepositVanillaCCTP is CounterfactualImplementationBase, E
111
122
  (depositAmount * _resolveBeaconUint(routeParams.cctpMaxFeeBpsGetter)) / BPS_SCALAR
112
123
  ) revert MaxCctpFee();
113
124
 
114
- ITokenMessengerV2 tokenMessenger = ITokenMessengerV2(_requireConfigured(_beacon().cctpTokenMessenger()));
115
- address inputToken = _requireConfigured(_beacon().usdc());
125
+ ICounterfactualBeacon beacon = ICounterfactualBeacon(_beacon());
126
+ ITokenMessengerV2 tokenMessenger = ITokenMessengerV2(_requireConfigured(beacon.cctpTokenMessenger()));
127
+ address inputToken = _requireConfigured(beacon.usdc());
116
128
 
117
129
  if (submitterData.executionFee > 0)
118
130
  IERC20(inputToken).safeTransfer(submitterData.executionFeeRecipient, submitterData.executionFee);
@@ -146,6 +158,7 @@ contract CounterfactualDepositVanillaCCTP is CounterfactualImplementationBase, E
146
158
  emit VanillaCCTPDepositExecuted(
147
159
  submitterData.amount,
148
160
  submitterData.executionFeeRecipient,
161
+ submitterData.nonce,
149
162
  submitterData.executionFee,
150
163
  depositAmount
151
164
  );
@@ -157,6 +170,7 @@ contract CounterfactualDepositVanillaCCTP is CounterfactualImplementationBase, E
157
170
  abi.encode(
158
171
  EXECUTE_VANILLA_CCTP_TYPEHASH,
159
172
  routeParamsHash,
173
+ submitterData.nonce,
160
174
  submitterData.amount,
161
175
  submitterData.executionFee,
162
176
  submitterData.maxFeeCctp,
@@ -164,7 +178,9 @@ contract CounterfactualDepositVanillaCCTP is CounterfactualImplementationBase, E
164
178
  submitterData.signatureDeadline
165
179
  )
166
180
  );
167
- if (ECDSA.recover(_hashTypedDataV4(structHash), submitterData.counterfactualSignature) != _beacon().signer())
168
- revert InvalidSignature();
181
+ if (
182
+ ECDSA.recover(_hashTypedDataV4(structHash), submitterData.counterfactualSignature) !=
183
+ ICounterfactualBeacon(_beacon()).signer()
184
+ ) revert InvalidSignature();
169
185
  }
170
186
  }
@@ -2,13 +2,14 @@
2
2
  pragma solidity ^0.8.0;
3
3
 
4
4
  import { ERC1967Utils } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
5
- import { ICounterfactualBeacon } from "../../interfaces/ICounterfactualBeacon.sol";
6
5
  import { ICounterfactualImplementation } from "../../interfaces/ICounterfactualImplementation.sol";
7
6
 
8
7
  /**
9
8
  * @title CounterfactualImplementationBase
10
- * @notice Shared base for leaf implementations: resolves the per-chain `CounterfactualBeacon` to read
11
- * chain-specific config (endpoints, fee signer, tokens) at runtime.
9
+ * @notice Shared base for leaf implementations: resolves the per-chain registry/beacon that leaves read
10
+ * chain-specific config (endpoints, fee signer, tokens) from at runtime. Config-agnostic — it
11
+ * hands back a plain `address`, so each leaf views the beacon through whichever config interface
12
+ * it needs.
12
13
  * @dev Leaves run under delegatecall from the `BeaconProxy`, so `address(this)` is the proxy and the beacon
13
14
  * sits in its ERC-1967 beacon slot. Reading config there means a leaf holds **no immutables of its
14
15
  * own** and is byte-identical across chains (one CREATE2 address everywhere).
@@ -20,8 +21,8 @@ abstract contract CounterfactualImplementationBase is ICounterfactualImplementat
20
21
  error RouteNotConfigured();
21
22
 
22
23
  /// @dev The per-chain registry that anchors this proxy (resolved from the ERC-1967 beacon slot).
23
- function _beacon() internal view returns (ICounterfactualBeacon) {
24
- return ICounterfactualBeacon(ERC1967Utils.getBeacon());
24
+ function _beacon() internal view returns (address) {
25
+ return ERC1967Utils.getBeacon();
25
26
  }
26
27
 
27
28
  /// @dev Resolve an address from a no-arg `() -> address` beacon getter named by `getter`'s selector
@@ -29,7 +30,7 @@ abstract contract CounterfactualImplementationBase is ICounterfactualImplementat
29
30
  /// `address(0)`, which callers treat as `RouteNotConfigured`. The selector is merkle-committed (and
30
31
  /// where applicable signature-bound), so trusted; a bad selector can only revert here or downstream.
31
32
  function _resolveBeaconAddress(bytes4 getter) internal view returns (address) {
32
- (bool ok, bytes memory ret) = address(_beacon()).staticcall(abi.encodeWithSelector(getter));
33
+ (bool ok, bytes memory ret) = _beacon().staticcall(abi.encodeWithSelector(getter));
33
34
  if (!ok || ret.length != 32) return address(0);
34
35
  return abi.decode(ret, (address));
35
36
  }
@@ -38,7 +39,7 @@ abstract contract CounterfactualImplementationBase is ICounterfactualImplementat
38
39
  /// in the leaf, e.g. `beacon.usdcCctpMaxExecutionFee.selector`). Reverts `RouteNotConfigured` if the
39
40
  /// getter doesn't exist; a configured value of 0 is valid and returned as-is. Merkle/signature-bound.
40
41
  function _resolveBeaconUint(bytes4 getter) internal view returns (uint256) {
41
- (bool ok, bytes memory ret) = address(_beacon()).staticcall(abi.encodeWithSelector(getter));
42
+ (bool ok, bytes memory ret) = _beacon().staticcall(abi.encodeWithSelector(getter));
42
43
  if (!ok || ret.length != 32) revert RouteNotConfigured();
43
44
  return abi.decode(ret, (uint256));
44
45
  }