@hyperlane-xyz/core 4.0.0-beta → 4.0.0

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 (244) hide show
  1. package/contracts/client/GasRouter.sol +34 -4
  2. package/contracts/client/MailboxClient.sol +0 -81
  3. package/contracts/client/Router.sol +55 -10
  4. package/contracts/interfaces/avs/vendored/IDelegationManager.sol +5 -0
  5. package/contracts/interfaces/isms/IMultisigIsm.sol +1 -0
  6. package/contracts/isms/multisig/AbstractMultisigIsm.sol +4 -1
  7. package/contracts/test/ERC20Test.sol +54 -6
  8. package/contracts/test/TestGasRouter.sol +1 -1
  9. package/contracts/token/HypNative.sol +4 -12
  10. package/contracts/token/README.md +2 -2
  11. package/contracts/token/extensions/HypNativeScaled.sol +5 -7
  12. package/contracts/token/extensions/HypXERC20.sol +3 -1
  13. package/contracts/token/extensions/HypXERC20Lockbox.sol +25 -3
  14. package/contracts/token/interfaces/IXERC20.sol +18 -0
  15. package/contracts/token/libs/FastTokenRouter.sol +4 -2
  16. package/contracts/token/libs/TokenRouter.sol +32 -39
  17. package/dist/buildArtifact.js +1 -1
  18. package/dist/buildArtifact.json +1 -1
  19. package/dist/contracts/client/GasRouter.d.ts +2 -6
  20. package/dist/contracts/client/GasRouter.d.ts.map +1 -1
  21. package/dist/contracts/interfaces/avs/vendored/IDelegationManager.d.ts +19 -3
  22. package/dist/contracts/interfaces/avs/vendored/IDelegationManager.d.ts.map +1 -1
  23. package/dist/contracts/test/ERC20Test.sol/XERC20LockboxTest.d.ts +220 -0
  24. package/dist/contracts/test/ERC20Test.sol/XERC20LockboxTest.d.ts.map +1 -0
  25. package/dist/contracts/test/ERC20Test.sol/XERC20LockboxTest.js +2 -0
  26. package/dist/contracts/test/ERC20Test.sol/XERC20LockboxTest.js.map +1 -0
  27. package/dist/contracts/test/ERC20Test.sol/XERC20Test.d.ts +31 -1
  28. package/dist/contracts/test/ERC20Test.sol/XERC20Test.d.ts.map +1 -1
  29. package/dist/contracts/test/ERC20Test.sol/index.d.ts +1 -0
  30. package/dist/contracts/test/ERC20Test.sol/index.d.ts.map +1 -1
  31. package/dist/contracts/test/TestGasRouter.d.ts +2 -6
  32. package/dist/contracts/test/TestGasRouter.d.ts.map +1 -1
  33. package/dist/contracts/test/avs/TestDelegationManager.d.ts +19 -3
  34. package/dist/contracts/test/avs/TestDelegationManager.d.ts.map +1 -1
  35. package/dist/contracts/token/HypERC20.d.ts +2 -6
  36. package/dist/contracts/token/HypERC20.d.ts.map +1 -1
  37. package/dist/contracts/token/HypERC20Collateral.d.ts +2 -6
  38. package/dist/contracts/token/HypERC20Collateral.d.ts.map +1 -1
  39. package/dist/contracts/token/HypERC721.d.ts +2 -6
  40. package/dist/contracts/token/HypERC721.d.ts.map +1 -1
  41. package/dist/contracts/token/HypERC721Collateral.d.ts +2 -6
  42. package/dist/contracts/token/HypERC721Collateral.d.ts.map +1 -1
  43. package/dist/contracts/token/HypNative.d.ts +2 -6
  44. package/dist/contracts/token/HypNative.d.ts.map +1 -1
  45. package/dist/contracts/token/extensions/FastHypERC20.d.ts +2 -6
  46. package/dist/contracts/token/extensions/FastHypERC20.d.ts.map +1 -1
  47. package/dist/contracts/token/extensions/FastHypERC20Collateral.d.ts +2 -6
  48. package/dist/contracts/token/extensions/FastHypERC20Collateral.d.ts.map +1 -1
  49. package/dist/contracts/token/extensions/HypERC20CollateralVaultDeposit.d.ts +2 -6
  50. package/dist/contracts/token/extensions/HypERC20CollateralVaultDeposit.d.ts.map +1 -1
  51. package/dist/contracts/token/extensions/HypERC721URICollateral.d.ts +2 -6
  52. package/dist/contracts/token/extensions/HypERC721URICollateral.d.ts.map +1 -1
  53. package/dist/contracts/token/extensions/HypERC721URIStorage.d.ts +2 -6
  54. package/dist/contracts/token/extensions/HypERC721URIStorage.d.ts.map +1 -1
  55. package/dist/contracts/token/extensions/HypFiatToken.d.ts +2 -6
  56. package/dist/contracts/token/extensions/HypFiatToken.d.ts.map +1 -1
  57. package/dist/contracts/token/extensions/HypNativeScaled.d.ts +2 -6
  58. package/dist/contracts/token/extensions/HypNativeScaled.d.ts.map +1 -1
  59. package/dist/contracts/token/extensions/HypXERC20.d.ts +2 -6
  60. package/dist/contracts/token/extensions/HypXERC20.d.ts.map +1 -1
  61. package/dist/contracts/token/extensions/HypXERC20Lockbox.d.ts +44 -17
  62. package/dist/contracts/token/extensions/HypXERC20Lockbox.d.ts.map +1 -1
  63. package/dist/contracts/token/interfaces/IXERC20.d.ts +39 -1
  64. package/dist/contracts/token/interfaces/IXERC20.d.ts.map +1 -1
  65. package/dist/contracts/token/libs/FastTokenRouter.d.ts +2 -6
  66. package/dist/contracts/token/libs/FastTokenRouter.d.ts.map +1 -1
  67. package/dist/contracts/token/libs/TokenRouter.d.ts +2 -6
  68. package/dist/contracts/token/libs/TokenRouter.d.ts.map +1 -1
  69. package/dist/factories/@openzeppelin/contracts/proxy/transparent/ProxyAdmin__factory.d.ts +1 -1
  70. package/dist/factories/@openzeppelin/contracts/proxy/transparent/ProxyAdmin__factory.js +1 -1
  71. package/dist/factories/contracts/avs/ECDSAStakeRegistry__factory.d.ts +1 -1
  72. package/dist/factories/contracts/avs/ECDSAStakeRegistry__factory.js +1 -1
  73. package/dist/factories/contracts/avs/HyperlaneServiceManager__factory.d.ts +1 -1
  74. package/dist/factories/contracts/avs/HyperlaneServiceManager__factory.js +1 -1
  75. package/dist/factories/contracts/client/GasRouter__factory.d.ts +1 -1
  76. package/dist/factories/contracts/client/GasRouter__factory.js +1 -1
  77. package/dist/factories/contracts/client/GasRouter__factory.js.map +1 -1
  78. package/dist/factories/contracts/hooks/MerkleTreeHook__factory.d.ts +1 -1
  79. package/dist/factories/contracts/hooks/MerkleTreeHook__factory.js +1 -1
  80. package/dist/factories/contracts/hooks/OPStackHook__factory.d.ts +1 -1
  81. package/dist/factories/contracts/hooks/OPStackHook__factory.js +1 -1
  82. package/dist/factories/contracts/hooks/PolygonPosHook__factory.d.ts +1 -1
  83. package/dist/factories/contracts/hooks/PolygonPosHook__factory.js +1 -1
  84. package/dist/factories/contracts/hooks/aggregation/ERC5164Hook__factory.d.ts +1 -1
  85. package/dist/factories/contracts/hooks/aggregation/ERC5164Hook__factory.js +1 -1
  86. package/dist/factories/contracts/hooks/layer-zero/LayerZeroV1Hook__factory.d.ts +1 -1
  87. package/dist/factories/contracts/hooks/layer-zero/LayerZeroV1Hook__factory.js +1 -1
  88. package/dist/factories/contracts/hooks/layer-zero/LayerZeroV2Hook__factory.d.ts +1 -1
  89. package/dist/factories/contracts/hooks/layer-zero/LayerZeroV2Hook__factory.js +1 -1
  90. package/dist/factories/contracts/hooks/routing/DestinationRecipientRoutingHook__factory.d.ts +1 -1
  91. package/dist/factories/contracts/hooks/routing/DestinationRecipientRoutingHook__factory.js +1 -1
  92. package/dist/factories/contracts/hooks/routing/DomainRoutingHook__factory.d.ts +1 -1
  93. package/dist/factories/contracts/hooks/routing/DomainRoutingHook__factory.js +1 -1
  94. package/dist/factories/contracts/hooks/routing/FallbackDomainRoutingHook__factory.d.ts +1 -1
  95. package/dist/factories/contracts/hooks/routing/FallbackDomainRoutingHook__factory.js +1 -1
  96. package/dist/factories/contracts/hooks/warp-route/RateLimitedHook__factory.d.ts +1 -1
  97. package/dist/factories/contracts/hooks/warp-route/RateLimitedHook__factory.js +1 -1
  98. package/dist/factories/contracts/interfaces/avs/vendored/IDelegationManager__factory.d.ts +15 -0
  99. package/dist/factories/contracts/interfaces/avs/vendored/IDelegationManager__factory.d.ts.map +1 -1
  100. package/dist/factories/contracts/interfaces/avs/vendored/IDelegationManager__factory.js +19 -0
  101. package/dist/factories/contracts/interfaces/avs/vendored/IDelegationManager__factory.js.map +1 -1
  102. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMerkleRootMultisigIsmFactory__factory.d.ts +1 -1
  103. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMerkleRootMultisigIsmFactory__factory.js +1 -1
  104. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMerkleRootMultisigIsm__factory.d.ts +1 -1
  105. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMerkleRootMultisigIsm__factory.js +1 -1
  106. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMessageIdMultisigIsmFactory__factory.d.ts +1 -1
  107. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMessageIdMultisigIsmFactory__factory.js +1 -1
  108. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMessageIdMultisigIsm__factory.d.ts +1 -1
  109. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMessageIdMultisigIsm__factory.js +1 -1
  110. package/dist/factories/contracts/isms/multisig/ValidatorAnnounce__factory.d.ts +1 -1
  111. package/dist/factories/contracts/isms/multisig/ValidatorAnnounce__factory.js +1 -1
  112. package/dist/factories/contracts/isms/routing/DefaultFallbackRoutingIsm__factory.d.ts +1 -1
  113. package/dist/factories/contracts/isms/routing/DefaultFallbackRoutingIsm__factory.js +1 -1
  114. package/dist/factories/contracts/isms/routing/DomainRoutingIsmFactory.sol/DomainRoutingIsmFactory__factory.d.ts +1 -1
  115. package/dist/factories/contracts/isms/routing/DomainRoutingIsmFactory.sol/DomainRoutingIsmFactory__factory.js +1 -1
  116. package/dist/factories/contracts/isms/warp-route/RateLimitedIsm__factory.d.ts +1 -1
  117. package/dist/factories/contracts/isms/warp-route/RateLimitedIsm__factory.js +1 -1
  118. package/dist/factories/contracts/middleware/InterchainAccountRouter__factory.d.ts +1 -1
  119. package/dist/factories/contracts/middleware/InterchainAccountRouter__factory.d.ts.map +1 -1
  120. package/dist/factories/contracts/middleware/InterchainAccountRouter__factory.js +1 -1
  121. package/dist/factories/contracts/middleware/InterchainAccountRouter__factory.js.map +1 -1
  122. package/dist/factories/contracts/middleware/InterchainQueryRouter__factory.d.ts +1 -1
  123. package/dist/factories/contracts/middleware/InterchainQueryRouter__factory.d.ts.map +1 -1
  124. package/dist/factories/contracts/middleware/InterchainQueryRouter__factory.js +1 -1
  125. package/dist/factories/contracts/middleware/InterchainQueryRouter__factory.js.map +1 -1
  126. package/dist/factories/contracts/middleware/liquidity-layer/LiquidityLayerRouter__factory.d.ts +1 -1
  127. package/dist/factories/contracts/middleware/liquidity-layer/LiquidityLayerRouter__factory.d.ts.map +1 -1
  128. package/dist/factories/contracts/middleware/liquidity-layer/LiquidityLayerRouter__factory.js +1 -1
  129. package/dist/factories/contracts/middleware/liquidity-layer/LiquidityLayerRouter__factory.js.map +1 -1
  130. package/dist/factories/contracts/middleware/liquidity-layer/adapters/CircleBridgeAdapter__factory.d.ts +1 -1
  131. package/dist/factories/contracts/middleware/liquidity-layer/adapters/CircleBridgeAdapter__factory.js +1 -1
  132. package/dist/factories/contracts/middleware/liquidity-layer/adapters/PortalAdapter__factory.d.ts +1 -1
  133. package/dist/factories/contracts/middleware/liquidity-layer/adapters/PortalAdapter__factory.js +1 -1
  134. package/dist/factories/contracts/test/ERC20Test.sol/ERC20Test__factory.d.ts +1 -1
  135. package/dist/factories/contracts/test/ERC20Test.sol/ERC20Test__factory.js +1 -1
  136. package/dist/factories/contracts/test/ERC20Test.sol/FiatTokenTest__factory.d.ts +1 -1
  137. package/dist/factories/contracts/test/ERC20Test.sol/FiatTokenTest__factory.js +1 -1
  138. package/dist/factories/contracts/test/ERC20Test.sol/XERC20LockboxTest__factory.d.ts +119 -0
  139. package/dist/factories/contracts/test/ERC20Test.sol/XERC20LockboxTest__factory.d.ts.map +1 -0
  140. package/dist/factories/contracts/test/ERC20Test.sol/XERC20LockboxTest__factory.js +166 -0
  141. package/dist/factories/contracts/test/ERC20Test.sol/XERC20LockboxTest__factory.js.map +1 -0
  142. package/dist/factories/contracts/test/ERC20Test.sol/XERC20Test__factory.d.ts +29 -1
  143. package/dist/factories/contracts/test/ERC20Test.sol/XERC20Test__factory.d.ts.map +1 -1
  144. package/dist/factories/contracts/test/ERC20Test.sol/XERC20Test__factory.js +39 -1
  145. package/dist/factories/contracts/test/ERC20Test.sol/XERC20Test__factory.js.map +1 -1
  146. package/dist/factories/contracts/test/ERC20Test.sol/index.d.ts +1 -0
  147. package/dist/factories/contracts/test/ERC20Test.sol/index.d.ts.map +1 -1
  148. package/dist/factories/contracts/test/ERC20Test.sol/index.js +1 -0
  149. package/dist/factories/contracts/test/ERC20Test.sol/index.js.map +1 -1
  150. package/dist/factories/contracts/test/TestGasRouter__factory.d.ts +2 -2
  151. package/dist/factories/contracts/test/TestGasRouter__factory.d.ts.map +1 -1
  152. package/dist/factories/contracts/test/TestGasRouter__factory.js +2 -2
  153. package/dist/factories/contracts/test/TestGasRouter__factory.js.map +1 -1
  154. package/dist/factories/contracts/test/TestMerkleTreeHook__factory.d.ts +1 -1
  155. package/dist/factories/contracts/test/TestMerkleTreeHook__factory.js +1 -1
  156. package/dist/factories/contracts/test/TestQuerySender__factory.d.ts +1 -1
  157. package/dist/factories/contracts/test/TestQuerySender__factory.js +1 -1
  158. package/dist/factories/contracts/test/TestQuery__factory.d.ts +1 -1
  159. package/dist/factories/contracts/test/TestQuery__factory.js +1 -1
  160. package/dist/factories/contracts/test/TestRemoteChallenger__factory.d.ts +1 -1
  161. package/dist/factories/contracts/test/TestRemoteChallenger__factory.js +1 -1
  162. package/dist/factories/contracts/test/TestRouter__factory.d.ts +1 -1
  163. package/dist/factories/contracts/test/TestRouter__factory.d.ts.map +1 -1
  164. package/dist/factories/contracts/test/TestRouter__factory.js +1 -1
  165. package/dist/factories/contracts/test/TestRouter__factory.js.map +1 -1
  166. package/dist/factories/contracts/test/TestSendReceiver__factory.d.ts +1 -1
  167. package/dist/factories/contracts/test/TestSendReceiver__factory.js +1 -1
  168. package/dist/factories/contracts/test/avs/TestDelegationManager__factory.d.ts +16 -1
  169. package/dist/factories/contracts/test/avs/TestDelegationManager__factory.d.ts.map +1 -1
  170. package/dist/factories/contracts/test/avs/TestDelegationManager__factory.js +20 -1
  171. package/dist/factories/contracts/test/avs/TestDelegationManager__factory.js.map +1 -1
  172. package/dist/factories/contracts/test/avs/TestHyperlaneServiceManager__factory.d.ts +1 -1
  173. package/dist/factories/contracts/test/avs/TestHyperlaneServiceManager__factory.js +1 -1
  174. package/dist/factories/contracts/token/HypERC20Collateral__factory.d.ts +2 -2
  175. package/dist/factories/contracts/token/HypERC20Collateral__factory.d.ts.map +1 -1
  176. package/dist/factories/contracts/token/HypERC20Collateral__factory.js +2 -2
  177. package/dist/factories/contracts/token/HypERC20Collateral__factory.js.map +1 -1
  178. package/dist/factories/contracts/token/HypERC20__factory.d.ts +2 -2
  179. package/dist/factories/contracts/token/HypERC20__factory.d.ts.map +1 -1
  180. package/dist/factories/contracts/token/HypERC20__factory.js +2 -2
  181. package/dist/factories/contracts/token/HypERC20__factory.js.map +1 -1
  182. package/dist/factories/contracts/token/HypERC721Collateral__factory.d.ts +2 -2
  183. package/dist/factories/contracts/token/HypERC721Collateral__factory.d.ts.map +1 -1
  184. package/dist/factories/contracts/token/HypERC721Collateral__factory.js +2 -2
  185. package/dist/factories/contracts/token/HypERC721Collateral__factory.js.map +1 -1
  186. package/dist/factories/contracts/token/HypERC721__factory.d.ts +2 -2
  187. package/dist/factories/contracts/token/HypERC721__factory.d.ts.map +1 -1
  188. package/dist/factories/contracts/token/HypERC721__factory.js +2 -2
  189. package/dist/factories/contracts/token/HypERC721__factory.js.map +1 -1
  190. package/dist/factories/contracts/token/HypNative__factory.d.ts +2 -2
  191. package/dist/factories/contracts/token/HypNative__factory.d.ts.map +1 -1
  192. package/dist/factories/contracts/token/HypNative__factory.js +2 -2
  193. package/dist/factories/contracts/token/HypNative__factory.js.map +1 -1
  194. package/dist/factories/contracts/token/extensions/FastHypERC20Collateral__factory.d.ts +2 -2
  195. package/dist/factories/contracts/token/extensions/FastHypERC20Collateral__factory.d.ts.map +1 -1
  196. package/dist/factories/contracts/token/extensions/FastHypERC20Collateral__factory.js +2 -2
  197. package/dist/factories/contracts/token/extensions/FastHypERC20Collateral__factory.js.map +1 -1
  198. package/dist/factories/contracts/token/extensions/FastHypERC20__factory.d.ts +2 -2
  199. package/dist/factories/contracts/token/extensions/FastHypERC20__factory.d.ts.map +1 -1
  200. package/dist/factories/contracts/token/extensions/FastHypERC20__factory.js +2 -2
  201. package/dist/factories/contracts/token/extensions/FastHypERC20__factory.js.map +1 -1
  202. package/dist/factories/contracts/token/extensions/HypERC20CollateralVaultDeposit__factory.d.ts +2 -2
  203. package/dist/factories/contracts/token/extensions/HypERC20CollateralVaultDeposit__factory.d.ts.map +1 -1
  204. package/dist/factories/contracts/token/extensions/HypERC20CollateralVaultDeposit__factory.js +2 -2
  205. package/dist/factories/contracts/token/extensions/HypERC20CollateralVaultDeposit__factory.js.map +1 -1
  206. package/dist/factories/contracts/token/extensions/HypERC721URICollateral__factory.d.ts +2 -2
  207. package/dist/factories/contracts/token/extensions/HypERC721URICollateral__factory.d.ts.map +1 -1
  208. package/dist/factories/contracts/token/extensions/HypERC721URICollateral__factory.js +2 -2
  209. package/dist/factories/contracts/token/extensions/HypERC721URICollateral__factory.js.map +1 -1
  210. package/dist/factories/contracts/token/extensions/HypERC721URIStorage__factory.d.ts +2 -2
  211. package/dist/factories/contracts/token/extensions/HypERC721URIStorage__factory.d.ts.map +1 -1
  212. package/dist/factories/contracts/token/extensions/HypERC721URIStorage__factory.js +2 -2
  213. package/dist/factories/contracts/token/extensions/HypERC721URIStorage__factory.js.map +1 -1
  214. package/dist/factories/contracts/token/extensions/HypFiatToken__factory.d.ts +2 -2
  215. package/dist/factories/contracts/token/extensions/HypFiatToken__factory.d.ts.map +1 -1
  216. package/dist/factories/contracts/token/extensions/HypFiatToken__factory.js +2 -2
  217. package/dist/factories/contracts/token/extensions/HypFiatToken__factory.js.map +1 -1
  218. package/dist/factories/contracts/token/extensions/HypNativeScaled__factory.d.ts +2 -2
  219. package/dist/factories/contracts/token/extensions/HypNativeScaled__factory.d.ts.map +1 -1
  220. package/dist/factories/contracts/token/extensions/HypNativeScaled__factory.js +2 -2
  221. package/dist/factories/contracts/token/extensions/HypNativeScaled__factory.js.map +1 -1
  222. package/dist/factories/contracts/token/extensions/HypXERC20Lockbox__factory.d.ts +9 -3
  223. package/dist/factories/contracts/token/extensions/HypXERC20Lockbox__factory.d.ts.map +1 -1
  224. package/dist/factories/contracts/token/extensions/HypXERC20Lockbox__factory.js +10 -3
  225. package/dist/factories/contracts/token/extensions/HypXERC20Lockbox__factory.js.map +1 -1
  226. package/dist/factories/contracts/token/extensions/HypXERC20__factory.d.ts +2 -2
  227. package/dist/factories/contracts/token/extensions/HypXERC20__factory.d.ts.map +1 -1
  228. package/dist/factories/contracts/token/extensions/HypXERC20__factory.js +2 -2
  229. package/dist/factories/contracts/token/extensions/HypXERC20__factory.js.map +1 -1
  230. package/dist/factories/contracts/token/interfaces/IXERC20__factory.d.ts +28 -0
  231. package/dist/factories/contracts/token/interfaces/IXERC20__factory.d.ts.map +1 -1
  232. package/dist/factories/contracts/token/interfaces/IXERC20__factory.js +38 -0
  233. package/dist/factories/contracts/token/interfaces/IXERC20__factory.js.map +1 -1
  234. package/dist/factories/contracts/token/libs/FastTokenRouter__factory.d.ts +1 -1
  235. package/dist/factories/contracts/token/libs/FastTokenRouter__factory.js +1 -1
  236. package/dist/factories/contracts/token/libs/FastTokenRouter__factory.js.map +1 -1
  237. package/dist/factories/contracts/token/libs/TokenRouter__factory.d.ts +1 -1
  238. package/dist/factories/contracts/token/libs/TokenRouter__factory.js +1 -1
  239. package/dist/factories/contracts/token/libs/TokenRouter__factory.js.map +1 -1
  240. package/dist/index.d.ts +2 -0
  241. package/dist/index.d.ts.map +1 -1
  242. package/dist/index.js +1 -0
  243. package/dist/index.js.map +1 -1
  244. package/package.json +5 -2
@@ -43,13 +43,13 @@ abstract contract GasRouter is Router {
43
43
  */
44
44
  function quoteGasPayment(
45
45
  uint32 _destinationDomain
46
- ) external view returns (uint256 _gasPayment) {
47
- return _quoteDispatch(_destinationDomain, "");
46
+ ) external view returns (uint256) {
47
+ return _GasRouter_quoteDispatch(_destinationDomain, "", address(hook));
48
48
  }
49
49
 
50
- function _metadata(
50
+ function _GasRouter_hookMetadata(
51
51
  uint32 _destination
52
- ) internal view virtual override returns (bytes memory) {
52
+ ) internal view returns (bytes memory) {
53
53
  return
54
54
  StandardHookMetadata.overrideGasLimit(destinationGas[_destination]);
55
55
  }
@@ -57,4 +57,34 @@ abstract contract GasRouter is Router {
57
57
  function _setDestinationGas(uint32 domain, uint256 gas) internal {
58
58
  destinationGas[domain] = gas;
59
59
  }
60
+
61
+ function _GasRouter_dispatch(
62
+ uint32 _destination,
63
+ uint256 _value,
64
+ bytes memory _messageBody,
65
+ address _hook
66
+ ) internal returns (bytes32) {
67
+ return
68
+ _Router_dispatch(
69
+ _destination,
70
+ _value,
71
+ _messageBody,
72
+ _GasRouter_hookMetadata(_destination),
73
+ _hook
74
+ );
75
+ }
76
+
77
+ function _GasRouter_quoteDispatch(
78
+ uint32 _destination,
79
+ bytes memory _messageBody,
80
+ address _hook
81
+ ) internal view returns (uint256) {
82
+ return
83
+ _Router_quoteDispatch(
84
+ _destination,
85
+ _messageBody,
86
+ _GasRouter_hookMetadata(_destination),
87
+ _hook
88
+ );
89
+ }
60
90
  }
@@ -95,85 +95,4 @@ abstract contract MailboxClient is OwnableUpgradeable {
95
95
  function _isDelivered(bytes32 id) internal view returns (bool) {
96
96
  return mailbox.delivered(id);
97
97
  }
98
-
99
- function _metadata(
100
- uint32 /*_destinationDomain*/
101
- ) internal view virtual returns (bytes memory) {
102
- return "";
103
- }
104
-
105
- function _dispatch(
106
- uint32 _destinationDomain,
107
- bytes32 _recipient,
108
- bytes memory _messageBody
109
- ) internal virtual returns (bytes32) {
110
- return
111
- _dispatch(_destinationDomain, _recipient, msg.value, _messageBody);
112
- }
113
-
114
- function _dispatch(
115
- uint32 _destinationDomain,
116
- bytes32 _recipient,
117
- uint256 _value,
118
- bytes memory _messageBody
119
- ) internal virtual returns (bytes32) {
120
- return
121
- mailbox.dispatch{value: _value}(
122
- _destinationDomain,
123
- _recipient,
124
- _messageBody,
125
- _metadata(_destinationDomain),
126
- hook
127
- );
128
- }
129
-
130
- function _dispatch(
131
- uint32 _destinationDomain,
132
- bytes32 _recipient,
133
- uint256 _value,
134
- bytes memory _messageBody,
135
- bytes memory _hookMetadata,
136
- IPostDispatchHook _hook
137
- ) internal virtual returns (bytes32) {
138
- return
139
- mailbox.dispatch{value: _value}(
140
- _destinationDomain,
141
- _recipient,
142
- _messageBody,
143
- _hookMetadata,
144
- _hook
145
- );
146
- }
147
-
148
- function _quoteDispatch(
149
- uint32 _destinationDomain,
150
- bytes32 _recipient,
151
- bytes memory _messageBody
152
- ) internal view virtual returns (uint256) {
153
- return
154
- mailbox.quoteDispatch(
155
- _destinationDomain,
156
- _recipient,
157
- _messageBody,
158
- _metadata(_destinationDomain),
159
- hook
160
- );
161
- }
162
-
163
- function _quoteDispatch(
164
- uint32 _destinationDomain,
165
- bytes32 _recipient,
166
- bytes memory _messageBody,
167
- bytes calldata _hookMetadata,
168
- IPostDispatchHook _hook
169
- ) internal view virtual returns (uint256) {
170
- return
171
- mailbox.quoteDispatch(
172
- _destinationDomain,
173
- _recipient,
174
- _messageBody,
175
- _hookMetadata,
176
- _hook
177
- );
178
- }
179
98
  }
@@ -167,28 +167,73 @@ abstract contract Router is MailboxClient, IMessageRecipient {
167
167
  );
168
168
  }
169
169
 
170
- function _dispatch(
170
+ function _Router_dispatch(
171
171
  uint32 _destinationDomain,
172
- bytes memory _messageBody
173
- ) internal virtual returns (bytes32) {
174
- return _dispatch(_destinationDomain, msg.value, _messageBody);
172
+ uint256 _value,
173
+ bytes memory _messageBody,
174
+ bytes memory _hookMetadata,
175
+ address _hook
176
+ ) internal returns (bytes32) {
177
+ bytes32 _router = _mustHaveRemoteRouter(_destinationDomain);
178
+ return
179
+ mailbox.dispatch{value: _value}(
180
+ _destinationDomain,
181
+ _router,
182
+ _messageBody,
183
+ _hookMetadata,
184
+ IPostDispatchHook(_hook)
185
+ );
175
186
  }
176
187
 
188
+ /**
189
+ * DEPRECATED: Use `_Router_dispatch` instead
190
+ * @dev For backward compatibility with v2 client contracts
191
+ */
177
192
  function _dispatch(
178
193
  uint32 _destinationDomain,
179
- uint256 _value,
180
194
  bytes memory _messageBody
181
- ) internal virtual returns (bytes32) {
195
+ ) internal returns (bytes32) {
196
+ return
197
+ _Router_dispatch(
198
+ _destinationDomain,
199
+ msg.value,
200
+ _messageBody,
201
+ "",
202
+ address(hook)
203
+ );
204
+ }
205
+
206
+ function _Router_quoteDispatch(
207
+ uint32 _destinationDomain,
208
+ bytes memory _messageBody,
209
+ bytes memory _hookMetadata,
210
+ address _hook
211
+ ) internal view returns (uint256) {
182
212
  bytes32 _router = _mustHaveRemoteRouter(_destinationDomain);
183
213
  return
184
- super._dispatch(_destinationDomain, _router, _value, _messageBody);
214
+ mailbox.quoteDispatch(
215
+ _destinationDomain,
216
+ _router,
217
+ _messageBody,
218
+ _hookMetadata,
219
+ IPostDispatchHook(_hook)
220
+ );
185
221
  }
186
222
 
223
+ /**
224
+ * DEPRECATED: Use `_Router_quoteDispatch` instead
225
+ * @dev For backward compatibility with v2 client contracts
226
+ */
187
227
  function _quoteDispatch(
188
228
  uint32 _destinationDomain,
189
229
  bytes memory _messageBody
190
- ) internal view virtual returns (uint256) {
191
- bytes32 _router = _mustHaveRemoteRouter(_destinationDomain);
192
- return super._quoteDispatch(_destinationDomain, _router, _messageBody);
230
+ ) internal view returns (uint256) {
231
+ return
232
+ _Router_quoteDispatch(
233
+ _destinationDomain,
234
+ _messageBody,
235
+ "",
236
+ address(hook)
237
+ );
193
238
  }
194
239
  }
@@ -20,6 +20,11 @@ interface IDelegationManager {
20
20
  uint32 stakerOptOutWindowBlocks;
21
21
  }
22
22
 
23
+ event OperatorMetadataURIUpdated(
24
+ address indexed operator,
25
+ string metadataURI
26
+ );
27
+
23
28
  function registerAsOperator(
24
29
  OperatorDetails calldata registeringOperatorDetails,
25
30
  string calldata metadataURI
@@ -8,6 +8,7 @@ interface IMultisigIsm is IInterchainSecurityModule {
8
8
  * @notice Returns the set of validators responsible for verifying _message
9
9
  * and the number of signatures required
10
10
  * @dev Can change based on the content of _message
11
+ * @dev Signatures provided to `verify` must be consistent with validator ordering
11
12
  * @param _message Hyperlane formatted interchain message
12
13
  * @return validators The array of validator addresses
13
14
  * @return threshold The number of validator signatures needed
@@ -26,6 +26,7 @@ abstract contract AbstractMultisigIsm is IMultisigIsm {
26
26
  * @notice Returns the set of validators responsible for verifying _message
27
27
  * and the number of signatures required
28
28
  * @dev Can change based on the content of _message
29
+ * @dev Signatures provided to `verify` must be consistent with validator ordering
29
30
  * @param _message Hyperlane formatted interchain message
30
31
  * @return validators The array of validator addresses
31
32
  * @return threshold The number of validator signatures needed
@@ -60,7 +61,9 @@ abstract contract AbstractMultisigIsm is IMultisigIsm {
60
61
 
61
62
  /**
62
63
  * @notice Requires that m-of-n validators verify a merkle root,
63
- * and verifies a me∑rkle proof of `_message` against that root.
64
+ * and verifies a merkle proof of `_message` against that root.
65
+ * @dev Optimization relies on the caller sorting signatures in the same order as validators.
66
+ * @dev Employs https://www.geeksforgeeks.org/two-pointers-technique/ to minimize gas usage.
64
67
  * @param _metadata ABI encoded module metadata
65
68
  * @param _message Formatted Hyperlane message (see Message.sol).
66
69
  */
@@ -3,6 +3,7 @@ pragma solidity >=0.8.0;
3
3
 
4
4
  import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
5
5
 
6
+ import "../token/interfaces/IXERC20Lockbox.sol";
6
7
  import "../token/interfaces/IXERC20.sol";
7
8
  import "../token/interfaces/IFiatToken.sol";
8
9
 
@@ -66,15 +67,62 @@ contract XERC20Test is ERC20Test, IXERC20 {
66
67
  _burn(account, amount);
67
68
  }
68
69
 
69
- function setLimits(
70
- address /* _bridge */,
71
- uint256 /* _mintingLimit */,
72
- uint256 /* _burningLimit */
73
- ) external pure {
74
- require(false, "setLimits(): not implemented");
70
+ function setLimits(address, uint256, uint256) external pure {
71
+ assert(false);
75
72
  }
76
73
 
77
74
  function owner() external pure returns (address) {
78
75
  return address(0x0);
79
76
  }
77
+
78
+ function burningCurrentLimitOf(
79
+ address _bridge
80
+ ) external view returns (uint256) {
81
+ return type(uint256).max;
82
+ }
83
+
84
+ function mintingCurrentLimitOf(
85
+ address _bridge
86
+ ) external view returns (uint256) {
87
+ return type(uint256).max;
88
+ }
89
+ }
90
+
91
+ contract XERC20LockboxTest is IXERC20Lockbox {
92
+ IXERC20 public immutable XERC20;
93
+ IERC20 public immutable ERC20;
94
+
95
+ constructor(
96
+ string memory name,
97
+ string memory symbol,
98
+ uint256 totalSupply,
99
+ uint8 __decimals
100
+ ) {
101
+ ERC20Test erc20 = new ERC20Test(name, symbol, totalSupply, __decimals);
102
+ erc20.transfer(msg.sender, totalSupply);
103
+ ERC20 = erc20;
104
+ XERC20 = new XERC20Test(name, symbol, 0, __decimals);
105
+ }
106
+
107
+ function depositTo(address _user, uint256 _amount) public {
108
+ ERC20.transferFrom(msg.sender, address(this), _amount);
109
+ XERC20.mint(_user, _amount);
110
+ }
111
+
112
+ function deposit(uint256 _amount) external {
113
+ depositTo(msg.sender, _amount);
114
+ }
115
+
116
+ function depositNativeTo(address) external payable {
117
+ assert(false);
118
+ }
119
+
120
+ function withdrawTo(address _user, uint256 _amount) public {
121
+ XERC20.burn(msg.sender, _amount);
122
+ ERC20Test(address(ERC20)).mintTo(_user, _amount);
123
+ }
124
+
125
+ function withdraw(uint256 _amount) external {
126
+ withdrawTo(msg.sender, _amount);
127
+ }
80
128
  }
@@ -7,7 +7,7 @@ contract TestGasRouter is GasRouter {
7
7
  constructor(address _mailbox) GasRouter(_mailbox) {}
8
8
 
9
9
  function dispatch(uint32 _destination, bytes memory _msg) external payable {
10
- _dispatch(_destination, _msg);
10
+ _GasRouter_dispatch(_destination, msg.value, _msg, address(hook));
11
11
  }
12
12
 
13
13
  function _handle(uint32, bytes32, bytes calldata) internal pure override {}
@@ -36,24 +36,16 @@ contract HypNative is TokenRouter {
36
36
 
37
37
  /**
38
38
  * @inheritdoc TokenRouter
39
- * @dev uses (`msg.value` - `_amount`) as interchain gas payment and `msg.sender` as refund address.
39
+ * @dev uses (`msg.value` - `_amount`) as hook payment and `msg.sender` as refund address.
40
40
  */
41
41
  function transferRemote(
42
42
  uint32 _destination,
43
43
  bytes32 _recipient,
44
44
  uint256 _amount
45
- ) public payable virtual override returns (bytes32 messageId) {
45
+ ) external payable virtual override returns (bytes32 messageId) {
46
46
  require(msg.value >= _amount, "Native: amount exceeds msg.value");
47
- uint256 gasPayment = msg.value - _amount;
48
- return
49
- _transferRemote(
50
- _destination,
51
- _recipient,
52
- _amount,
53
- gasPayment,
54
- bytes(""),
55
- address(0)
56
- );
47
+ uint256 _hookPayment = msg.value - _amount;
48
+ return _transferRemote(_destination, _recipient, _amount, _hookPayment);
57
49
  }
58
50
 
59
51
  function balanceOf(
@@ -6,7 +6,7 @@ For instructions on deploying Warp Routes, see [the deployment documentation](ht
6
6
 
7
7
  ## Warp Route Architecture
8
8
 
9
- A Warp Route is a collection of [`TokenRouter`](./contracts/libs/TokenRouter.sol) contracts deployed across a set of Hyperlane chains. These contracts leverage the `Router` pattern to implement access control and routing logic for remote token transfers. These contracts send and receive [`Messages`](./contracts/libs/Message.sol) which encode payloads containing a transfer `amount` and `recipient` address.
9
+ A Warp Route is a collection of [`TokenRouter`](./libs/TokenRouter.sol) contracts deployed across a set of Hyperlane chains. These contracts leverage the `Router` pattern to implement access control and routing logic for remote token transfers. These contracts send and receive [`Messages`](./libs/TokenMessage.sol) which encode payloads containing a transfer `amount` and `recipient` address.
10
10
 
11
11
  ```mermaid
12
12
  %%{ init: {
@@ -39,7 +39,7 @@ graph LR
39
39
  Mailbox_G[(Mailbox)]
40
40
  end
41
41
 
42
- HYP_E -. "router" .- HYP_P -. "router" .- HYP_G
42
+ HYP_E -. "TokenMessage" .- HYP_P -. "TokenMessage" .- HYP_G
43
43
 
44
44
  ```
45
45
 
@@ -25,18 +25,16 @@ contract HypNativeScaled is HypNative {
25
25
  uint32 _destination,
26
26
  bytes32 _recipient,
27
27
  uint256 _amount
28
- ) public payable override returns (bytes32 messageId) {
28
+ ) external payable override returns (bytes32 messageId) {
29
29
  require(msg.value >= _amount, "Native: amount exceeds msg.value");
30
- uint256 gasPayment = msg.value - _amount;
31
- uint256 scaledAmount = _amount / scale;
30
+ uint256 _hookPayment = msg.value - _amount;
31
+ uint256 _scaledAmount = _amount / scale;
32
32
  return
33
33
  _transferRemote(
34
34
  _destination,
35
35
  _recipient,
36
- scaledAmount,
37
- gasPayment,
38
- bytes(""),
39
- address(0)
36
+ _scaledAmount,
37
+ _hookPayment
40
38
  );
41
39
  }
42
40
 
@@ -8,7 +8,9 @@ contract HypXERC20 is HypERC20Collateral {
8
8
  constructor(
9
9
  address _xerc20,
10
10
  address _mailbox
11
- ) HypERC20Collateral(_xerc20, _mailbox) {}
11
+ ) HypERC20Collateral(_xerc20, _mailbox) {
12
+ _disableInitializers();
13
+ }
12
14
 
13
15
  function _transferFromSender(
14
16
  uint256 _amountOrId
@@ -17,18 +17,40 @@ contract HypXERC20Lockbox is HypERC20Collateral {
17
17
  ) HypERC20Collateral(address(IXERC20Lockbox(_lockbox).ERC20()), _mailbox) {
18
18
  lockbox = IXERC20Lockbox(_lockbox);
19
19
  xERC20 = lockbox.XERC20();
20
+ approveLockbox();
21
+ _disableInitializers();
22
+ }
20
23
 
21
- // grant infinite approvals to lockbox
24
+ /**
25
+ * @notice Approve the lockbox to spend the wrapped token and xERC20
26
+ * @dev This function is idempotent and need not be access controlled
27
+ */
28
+ function approveLockbox() public {
22
29
  require(
23
- IERC20(wrappedToken).approve(_lockbox, MAX_INT),
30
+ IERC20(wrappedToken).approve(address(lockbox), MAX_INT),
24
31
  "erc20 lockbox approve failed"
25
32
  );
26
33
  require(
27
- xERC20.approve(_lockbox, MAX_INT),
34
+ xERC20.approve(address(lockbox), MAX_INT),
28
35
  "xerc20 lockbox approve failed"
29
36
  );
30
37
  }
31
38
 
39
+ /**
40
+ * @notice Initialize the contract
41
+ * @param _hook The address of the hook contract
42
+ * @param _ism The address of the interchain security module
43
+ * @param _owner The address of the owner
44
+ */
45
+ function initialize(
46
+ address _hook,
47
+ address _ism,
48
+ address _owner
49
+ ) public override initializer {
50
+ approveLockbox();
51
+ _MailboxClient_initialize(_hook, _ism, _owner);
52
+ }
53
+
32
54
  function _transferFromSender(
33
55
  uint256 _amount
34
56
  ) internal override returns (bytes memory) {
@@ -36,4 +36,22 @@ interface IXERC20 is IERC20 {
36
36
  ) external;
37
37
 
38
38
  function owner() external returns (address);
39
+
40
+ /**
41
+ * @notice Returns the current limit of a bridge
42
+ * @param _bridge the bridge we are viewing the limits of
43
+ * @return _limit The limit the bridge has
44
+ */
45
+ function burningCurrentLimitOf(
46
+ address _bridge
47
+ ) external view returns (uint256 _limit);
48
+
49
+ /**
50
+ * @notice Returns the current limit of a bridge
51
+ * @param _bridge the bridge we are viewing the limits of
52
+ * @return _limit The limit the bridge has
53
+ */
54
+ function mintingCurrentLimitOf(
55
+ address _bridge
56
+ ) external view returns (uint256 _limit);
39
57
  }
@@ -109,9 +109,11 @@ abstract contract FastTokenRouter is TokenRouter {
109
109
  _fastTransferId
110
110
  );
111
111
 
112
- messageId = _dispatch(
112
+ messageId = _GasRouter_dispatch(
113
113
  _destination,
114
- TokenMessage.format(_recipient, _amountOrId, metadata)
114
+ msg.value,
115
+ TokenMessage.format(_recipient, _amountOrId, metadata),
116
+ address(hook)
115
117
  );
116
118
  emit SentTransferRemote(_destination, _recipient, _amountOrId);
117
119
  }
@@ -57,14 +57,7 @@ abstract contract TokenRouter is GasRouter {
57
57
  uint256 _amountOrId
58
58
  ) external payable virtual returns (bytes32 messageId) {
59
59
  return
60
- _transferRemote(
61
- _destination,
62
- _recipient,
63
- _amountOrId,
64
- msg.value,
65
- bytes(""),
66
- address(0)
67
- );
60
+ _transferRemote(_destination, _recipient, _amountOrId, msg.value);
68
61
  }
69
62
 
70
63
  /**
@@ -97,45 +90,45 @@ abstract contract TokenRouter is GasRouter {
97
90
  );
98
91
  }
99
92
 
100
- /**
101
- * @notice Transfers `_amountOrId` token to `_recipient` on `_destination` domain.
102
- * @dev Delegates transfer logic to `_transferFromSender` implementation.
103
- * @dev The metadata is the token metadata, and is DIFFERENT than the hook metadata.
104
- * @dev Emits `SentTransferRemote` event on the origin chain.
105
- * @param _destination The identifier of the destination chain.
106
- * @param _recipient The address of the recipient on the destination chain.
107
- * @param _amountOrId The amount or identifier of tokens to be sent to the remote recipient.
108
- * @param _gasPayment The amount of native token to pay for interchain gas.
109
- * @param _hookMetadata The metadata passed into the hook
110
- * @param _hook The post dispatch hook to be called by the Mailbox
111
- * @return messageId The identifier of the dispatched message.
112
- */
113
93
  function _transferRemote(
114
94
  uint32 _destination,
115
95
  bytes32 _recipient,
116
96
  uint256 _amountOrId,
117
- uint256 _gasPayment,
118
- bytes memory _hookMetadata,
119
- address _hook
97
+ uint256 _value
120
98
  ) internal returns (bytes32 messageId) {
121
- bytes memory metadata = _transferFromSender(_amountOrId);
122
-
123
- if (address(_hook) == address(0)) {
124
- messageId = _dispatch(
125
- _destination,
126
- _gasPayment,
127
- TokenMessage.format(_recipient, _amountOrId, metadata)
128
- );
129
- } else {
130
- messageId = _dispatch(
99
+ return
100
+ _transferRemote(
131
101
  _destination,
132
102
  _recipient,
133
- _gasPayment,
134
- TokenMessage.format(_recipient, _amountOrId, metadata),
135
- _hookMetadata,
136
- IPostDispatchHook(_hook)
103
+ _amountOrId,
104
+ _value,
105
+ _GasRouter_hookMetadata(_destination),
106
+ address(hook)
137
107
  );
138
- }
108
+ }
109
+
110
+ function _transferRemote(
111
+ uint32 _destination,
112
+ bytes32 _recipient,
113
+ uint256 _amountOrId,
114
+ uint256 _value,
115
+ bytes memory _hookMetadata,
116
+ address _hook
117
+ ) internal virtual returns (bytes32 messageId) {
118
+ bytes memory _tokenMetadata = _transferFromSender(_amountOrId);
119
+ bytes memory _tokenMessage = TokenMessage.format(
120
+ _recipient,
121
+ _amountOrId,
122
+ _tokenMetadata
123
+ );
124
+
125
+ messageId = _Router_dispatch(
126
+ _destination,
127
+ _value,
128
+ _tokenMessage,
129
+ _hookMetadata,
130
+ _hook
131
+ );
139
132
 
140
133
  emit SentTransferRemote(_destination, _recipient, _amountOrId);
141
134
  }