@hyperlane-xyz/core 1.4.1 → 1.4.2

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 (143) hide show
  1. package/docs/book.css +13 -0
  2. package/docs/book.toml +12 -0
  3. package/docs/solidity.min.js +74 -0
  4. package/docs/src/README.md +15 -0
  5. package/docs/src/SUMMARY.md +139 -0
  6. package/docs/src/contracts/GasRouter.sol/abstract.GasRouter.md +124 -0
  7. package/docs/src/contracts/HyperlaneConnectionClient.sol/abstract.HyperlaneConnectionClient.md +191 -0
  8. package/docs/src/contracts/Mailbox.sol/contract.Mailbox.md +251 -0
  9. package/docs/src/contracts/OwnableMulticall.sol/contract.OwnableMulticall.md +41 -0
  10. package/docs/src/contracts/PausableReentrancyGuard.sol/abstract.PausableReentrancyGuardUpgradeable.md +100 -0
  11. package/docs/src/contracts/README.md +19 -0
  12. package/docs/src/contracts/Router.sol/abstract.Router.md +255 -0
  13. package/docs/src/contracts/ValidatorAnnounce.sol/contract.ValidatorAnnounce.md +117 -0
  14. package/docs/src/contracts/hooks/ERC5164/ERC5164MessageHook.sol/contract.ERC5164MessageHook.md +64 -0
  15. package/docs/src/contracts/hooks/ERC5164/README.md +5 -0
  16. package/docs/src/contracts/hooks/ERC5164/interfaces/IMessageDispatcher.sol/interface.IMessageDispatcher.md +25 -0
  17. package/docs/src/contracts/hooks/ERC5164/interfaces/README.md +4 -0
  18. package/docs/src/contracts/hooks/OptimismMessageHook.sol/contract.OptimismMessageHook.md +71 -0
  19. package/docs/src/contracts/hooks/README.md +5 -0
  20. package/docs/src/contracts/igps/InterchainGasPaymaster.sol/contract.InterchainGasPaymaster.md +231 -0
  21. package/docs/src/contracts/igps/OverheadIgp.sol/contract.OverheadIgp.md +161 -0
  22. package/docs/src/contracts/igps/README.md +6 -0
  23. package/docs/src/contracts/igps/gas-oracles/README.md +4 -0
  24. package/docs/src/contracts/igps/gas-oracles/StorageGasOracle.sol/contract.StorageGasOracle.md +114 -0
  25. package/docs/src/contracts/interfaces/IGasOracle.sol/interface.IGasOracle.md +25 -0
  26. package/docs/src/contracts/interfaces/IHyperlaneConnectionClient.sol/interface.IHyperlaneConnectionClient.md +43 -0
  27. package/docs/src/contracts/interfaces/IInterchainGasPaymaster.sol/interface.IInterchainGasPaymaster.md +33 -0
  28. package/docs/src/contracts/interfaces/IInterchainSecurityModule.sol/interface.IInterchainSecurityModule.md +55 -0
  29. package/docs/src/contracts/interfaces/IInterchainSecurityModule.sol/interface.ISpecifiesInterchainSecurityModule.md +12 -0
  30. package/docs/src/contracts/interfaces/ILiquidityLayerMessageRecipient.sol/interface.ILiquidityLayerMessageRecipient.md +13 -0
  31. package/docs/src/contracts/interfaces/ILiquidityLayerRouter.sol/interface.ILiquidityLayerRouter.md +19 -0
  32. package/docs/src/contracts/interfaces/IMailbox.sol/interface.IMailbox.md +103 -0
  33. package/docs/src/contracts/interfaces/IMessageRecipient.sol/interface.IMessageRecipient.md +12 -0
  34. package/docs/src/contracts/interfaces/IRouter.sol/interface.IRouter.md +33 -0
  35. package/docs/src/contracts/interfaces/IValidatorAnnounce.sol/interface.IValidatorAnnounce.md +78 -0
  36. package/docs/src/contracts/interfaces/README.md +17 -0
  37. package/docs/src/contracts/interfaces/hooks/IMessageHook.sol/interface.IMessageHook.md +12 -0
  38. package/docs/src/contracts/interfaces/hooks/README.md +4 -0
  39. package/docs/src/contracts/interfaces/isms/IAggregationIsm.sol/interface.IAggregationIsm.md +36 -0
  40. package/docs/src/contracts/interfaces/isms/IMultisigIsm.sol/interface.IMultisigIsm.md +36 -0
  41. package/docs/src/contracts/interfaces/isms/IRoutingIsm.sol/interface.IRoutingIsm.md +31 -0
  42. package/docs/src/contracts/interfaces/isms/README.md +6 -0
  43. package/docs/src/contracts/interfaces/middleware/IInterchainAccountRouter.sol/interface.IInterchainAccountRouter.md +64 -0
  44. package/docs/src/contracts/interfaces/middleware/IInterchainQueryRouter.sol/interface.IInterchainQueryRouter.md +21 -0
  45. package/docs/src/contracts/interfaces/middleware/README.md +5 -0
  46. package/docs/src/contracts/isms/README.md +7 -0
  47. package/docs/src/contracts/isms/aggregation/AbstractAggregationIsm.sol/abstract.AbstractAggregationIsm.md +60 -0
  48. package/docs/src/contracts/isms/aggregation/README.md +6 -0
  49. package/docs/src/contracts/isms/aggregation/StaticAggregationIsm.sol/contract.StaticAggregationIsm.md +30 -0
  50. package/docs/src/contracts/isms/aggregation/StaticAggregationIsmFactory.sol/contract.StaticAggregationIsmFactory.md +15 -0
  51. package/docs/src/contracts/isms/hook/AbstractHookISM.sol/abstract.AbstractHookISM.md +44 -0
  52. package/docs/src/contracts/isms/hook/CrossChainEnabled.sol/abstract.CrossChainEnabled.md +74 -0
  53. package/docs/src/contracts/isms/hook/ERC5164ISM.sol/contract.ERC5164ISM.md +57 -0
  54. package/docs/src/contracts/isms/hook/README.md +7 -0
  55. package/docs/src/contracts/isms/hook/optimism/CrossChainEnabledOptimism.sol/abstract.CrossChainEnabledOptimism.md +53 -0
  56. package/docs/src/contracts/isms/hook/optimism/LibOptimism.sol/library.LibOptimism.md +39 -0
  57. package/docs/src/contracts/isms/hook/optimism/OptimismISM.sol/contract.OptimismISM.md +66 -0
  58. package/docs/src/contracts/isms/hook/optimism/README.md +6 -0
  59. package/docs/src/contracts/isms/multisig/AbstractMerkleRootMultisigIsm.sol/abstract.AbstractMerkleRootMultisigIsm.md +78 -0
  60. package/docs/src/contracts/isms/multisig/AbstractMessageIdMultisigIsm.sol/abstract.AbstractMessageIdMultisigIsm.md +69 -0
  61. package/docs/src/contracts/isms/multisig/AbstractMultisigIsm.sol/abstract.AbstractMultisigIsm.md +102 -0
  62. package/docs/src/contracts/isms/multisig/LegacyMultisigIsm.sol/contract.LegacyMultisigIsm.md +355 -0
  63. package/docs/src/contracts/isms/multisig/README.md +12 -0
  64. package/docs/src/contracts/isms/multisig/StaticMultisigIsm.sol/abstract.AbstractMetaProxyMultisigIsm.md +36 -0
  65. package/docs/src/contracts/isms/multisig/StaticMultisigIsm.sol/contract.StaticMerkleRootMultisigIsm.md +11 -0
  66. package/docs/src/contracts/isms/multisig/StaticMultisigIsm.sol/contract.StaticMerkleRootMultisigIsmFactory.md +15 -0
  67. package/docs/src/contracts/isms/multisig/StaticMultisigIsm.sol/contract.StaticMessageIdMultisigIsm.md +10 -0
  68. package/docs/src/contracts/isms/multisig/StaticMultisigIsm.sol/contract.StaticMessageIdMultisigIsmFactory.md +15 -0
  69. package/docs/src/contracts/isms/routing/AbstractRoutingIsm.sol/abstract.AbstractRoutingIsm.md +55 -0
  70. package/docs/src/contracts/isms/routing/DomainRoutingIsm.sol/contract.DomainRoutingIsm.md +112 -0
  71. package/docs/src/contracts/isms/routing/DomainRoutingIsmFactory.sol/contract.DomainRoutingIsmFactory.md +47 -0
  72. package/docs/src/contracts/isms/routing/InterchainAccountIsm.sol/contract.InterchainAccountIsm.md +44 -0
  73. package/docs/src/contracts/isms/routing/README.md +7 -0
  74. package/docs/src/contracts/libs/Call.sol/library.CallLib.md +124 -0
  75. package/docs/src/contracts/libs/CheckpointLib.sol/library.CheckpointLib.md +61 -0
  76. package/docs/src/contracts/libs/EnumerableMapExtended.sol/library.EnumerableMapExtended.md +63 -0
  77. package/docs/src/contracts/libs/LegacyCheckpointLib.sol/library.LegacyCheckpointLib.md +55 -0
  78. package/docs/src/contracts/libs/Merkle.sol/library.MerkleLib.md +354 -0
  79. package/docs/src/contracts/libs/Message.sol/library.Message.md +304 -0
  80. package/docs/src/contracts/libs/MetaProxy.sol/library.MetaProxy.md +36 -0
  81. package/docs/src/contracts/libs/MinimalProxy.sol/library.MinimalProxy.md +34 -0
  82. package/docs/src/contracts/libs/README.md +16 -0
  83. package/docs/src/contracts/libs/StaticMOfNAddressSetFactory.sol/abstract.StaticMOfNAddressSetFactory.md +123 -0
  84. package/docs/src/contracts/libs/TypeCasts.sol/library.TypeCasts.md +19 -0
  85. package/docs/src/contracts/libs/ValidatorAnnouncements.sol/library.ValidatorAnnouncements.md +31 -0
  86. package/docs/src/contracts/libs/isms/AggregationIsmMetadata.sol/library.AggregationIsmMetadata.md +97 -0
  87. package/docs/src/contracts/libs/isms/LegacyMultisigIsmMetadata.sol/library.LegacyMultisigIsmMetadata.md +296 -0
  88. package/docs/src/contracts/libs/isms/MerkleRootMultisigIsmMetadata.sol/library.MerkleRootMultisigIsmMetadata.md +177 -0
  89. package/docs/src/contracts/libs/isms/MessageIdMultisigIsmMetadata.sol/library.MessageIdMultisigIsmMetadata.md +109 -0
  90. package/docs/src/contracts/libs/isms/README.md +7 -0
  91. package/docs/src/contracts/libs/middleware/InterchainAccountMessage.sol/library.InterchainAccountMessage.md +134 -0
  92. package/docs/src/contracts/libs/middleware/InterchainQueryMessage.sol/library.InterchainQueryMessage.md +203 -0
  93. package/docs/src/contracts/libs/middleware/README.md +5 -0
  94. package/docs/src/contracts/middleware/InterchainAccountRouter.sol/contract.InterchainAccountRouter.md +542 -0
  95. package/docs/src/contracts/middleware/InterchainQueryRouter.sol/contract.InterchainQueryRouter.md +119 -0
  96. package/docs/src/contracts/middleware/README.md +6 -0
  97. package/docs/src/contracts/middleware/liquidity-layer/LiquidityLayerRouter.sol/contract.LiquidityLayerRouter.md +81 -0
  98. package/docs/src/contracts/middleware/liquidity-layer/README.md +6 -0
  99. package/docs/src/contracts/middleware/liquidity-layer/adapters/CircleBridgeAdapter.sol/contract.CircleBridgeAdapter.md +197 -0
  100. package/docs/src/contracts/middleware/liquidity-layer/adapters/PortalAdapter.sol/contract.PortalAdapter.md +189 -0
  101. package/docs/src/contracts/middleware/liquidity-layer/adapters/README.md +5 -0
  102. package/docs/src/contracts/middleware/liquidity-layer/interfaces/ILiquidityLayerAdapter.sol/interface.ILiquidityLayerAdapter.md +23 -0
  103. package/docs/src/contracts/middleware/liquidity-layer/interfaces/README.md +6 -0
  104. package/docs/src/contracts/middleware/liquidity-layer/interfaces/circle/ICircleMessageTransmitter.sol/interface.ICircleMessageTransmitter.md +54 -0
  105. package/docs/src/contracts/middleware/liquidity-layer/interfaces/circle/ITokenMessenger.sol/interface.ITokenMessenger.md +92 -0
  106. package/docs/src/contracts/middleware/liquidity-layer/interfaces/circle/README.md +5 -0
  107. package/docs/src/contracts/middleware/liquidity-layer/interfaces/portal/IPortalTokenBridge.sol/interface.IPortalTokenBridge.md +131 -0
  108. package/docs/src/contracts/middleware/liquidity-layer/interfaces/portal/README.md +4 -0
  109. package/docs/src/contracts/mock/MockCircleMessageTransmitter.sol/contract.MockCircleMessageTransmitter.md +58 -0
  110. package/docs/src/contracts/mock/MockCircleTokenMessenger.sol/contract.MockCircleTokenMessenger.md +44 -0
  111. package/docs/src/contracts/mock/MockERC5164.sol/contract.MockMessageDispatcher.md +15 -0
  112. package/docs/src/contracts/mock/MockERC5164.sol/contract.MockMessageExecutor.md +11 -0
  113. package/docs/src/contracts/mock/MockHyperlaneEnvironment.sol/contract.MockHyperlaneEnvironment.md +69 -0
  114. package/docs/src/contracts/mock/MockMailbox.sol/contract.MockMailbox.md +137 -0
  115. package/docs/src/contracts/mock/MockPortalBridge.sol/contract.MockPortalBridge.md +82 -0
  116. package/docs/src/contracts/mock/MockToken.sol/contract.MockToken.md +22 -0
  117. package/docs/src/contracts/mock/README.md +11 -0
  118. package/docs/src/contracts/test/LightTestRecipient.sol/contract.LightTestRecipient.md +15 -0
  119. package/docs/src/contracts/test/README.md +20 -0
  120. package/docs/src/contracts/test/TestGasRouter.sol/contract.TestGasRouter.md +27 -0
  121. package/docs/src/contracts/test/TestHyperlaneConnectionClient.sol/contract.TestHyperlaneConnectionClient.md +29 -0
  122. package/docs/src/contracts/test/TestInterchainGasPaymaster.sol/contract.TestInterchainGasPaymaster.md +30 -0
  123. package/docs/src/contracts/test/TestLegacyMultisigIsm.sol/contract.TestLegacyMultisigIsm.md +15 -0
  124. package/docs/src/contracts/test/TestLiquidityLayerMessageRecipient.sol/contract.TestLiquidityLayerMessageRecipient.md +23 -0
  125. package/docs/src/contracts/test/TestMailbox.sol/contract.TestMailbox.md +29 -0
  126. package/docs/src/contracts/test/TestMerkle.sol/contract.TestMerkle.md +50 -0
  127. package/docs/src/contracts/test/TestMessage.sol/contract.TestMessage.md +68 -0
  128. package/docs/src/contracts/test/TestMultisigIsm.sol/contract.TestMultisigIsm.md +51 -0
  129. package/docs/src/contracts/test/TestQuery.sol/contract.TestQuery.md +45 -0
  130. package/docs/src/contracts/test/TestQuerySender.sol/contract.TestQuerySender.md +128 -0
  131. package/docs/src/contracts/test/TestRecipient.sol/contract.TestRecipient.md +78 -0
  132. package/docs/src/contracts/test/TestRouter.sol/contract.TestRouter.md +63 -0
  133. package/docs/src/contracts/test/TestSendReceiver.sol/contract.TestSendReceiver.md +49 -0
  134. package/docs/src/contracts/test/TestTokenRecipient.sol/contract.TestTokenRecipient.md +80 -0
  135. package/docs/src/contracts/test/bad-recipient/BadRecipient1.sol/contract.BadRecipient1.md +15 -0
  136. package/docs/src/contracts/test/bad-recipient/BadRecipient2.sol/contract.BadRecipient2.md +12 -0
  137. package/docs/src/contracts/test/bad-recipient/BadRecipient3.sol/contract.BadRecipient3.md +15 -0
  138. package/docs/src/contracts/test/bad-recipient/BadRecipient5.sol/contract.BadRecipient5.md +15 -0
  139. package/docs/src/contracts/test/bad-recipient/BadRecipient6.sol/contract.BadRecipient6.md +15 -0
  140. package/docs/src/contracts/test/bad-recipient/README.md +8 -0
  141. package/docs/src/contracts/upgrade/README.md +4 -0
  142. package/docs/src/contracts/upgrade/Versioned.sol/contract.Versioned.md +14 -0
  143. package/package.json +3 -3
@@ -0,0 +1,117 @@
1
+ # ValidatorAnnounce
2
+ [Git Source](https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/a5209dbd9b0f5eb34e0bc9df2ba157dda2b454d3/contracts/ValidatorAnnounce.sol)
3
+
4
+ **Inherits:**
5
+ [IValidatorAnnounce](/contracts/interfaces/IValidatorAnnounce.sol/interface.IValidatorAnnounce.md)
6
+
7
+ Stores the location(s) of validator signed checkpoints
8
+
9
+
10
+ ## State Variables
11
+ ### mailbox
12
+
13
+ ```solidity
14
+ address public immutable mailbox;
15
+ ```
16
+
17
+
18
+ ### localDomain
19
+
20
+ ```solidity
21
+ uint32 public immutable localDomain;
22
+ ```
23
+
24
+
25
+ ### validators
26
+
27
+ ```solidity
28
+ EnumerableSet.AddressSet private validators;
29
+ ```
30
+
31
+
32
+ ### storageLocations
33
+
34
+ ```solidity
35
+ mapping(address => string[]) private storageLocations;
36
+ ```
37
+
38
+
39
+ ### replayProtection
40
+
41
+ ```solidity
42
+ mapping(bytes32 => bool) private replayProtection;
43
+ ```
44
+
45
+
46
+ ## Functions
47
+ ### constructor
48
+
49
+
50
+ ```solidity
51
+ constructor(address _mailbox);
52
+ ```
53
+
54
+ ### announce
55
+
56
+ Announces a validator signature storage location
57
+
58
+
59
+ ```solidity
60
+ function announce(address _validator, string calldata _storageLocation, bytes calldata _signature)
61
+ external
62
+ returns (bool);
63
+ ```
64
+ **Parameters**
65
+
66
+ |Name|Type|Description|
67
+ |----|----|-----------|
68
+ |`_validator`|`address`||
69
+ |`_storageLocation`|`string`|Information encoding the location of signed checkpoints|
70
+ |`_signature`|`bytes`|The signed validator announcement|
71
+
72
+ **Returns**
73
+
74
+ |Name|Type|Description|
75
+ |----|----|-----------|
76
+ |`<none>`|`bool`|True upon success|
77
+
78
+
79
+ ### getAnnouncedStorageLocations
80
+
81
+ Returns a list of all announced storage locations
82
+
83
+
84
+ ```solidity
85
+ function getAnnouncedStorageLocations(address[] calldata _validators) external view returns (string[][] memory);
86
+ ```
87
+ **Parameters**
88
+
89
+ |Name|Type|Description|
90
+ |----|----|-----------|
91
+ |`_validators`|`address[]`|The list of validators to get registrations for|
92
+
93
+ **Returns**
94
+
95
+ |Name|Type|Description|
96
+ |----|----|-----------|
97
+ |`<none>`|`string[][]`|A list of registered storage metadata|
98
+
99
+
100
+ ### getAnnouncedValidators
101
+
102
+ Returns a list of validators that have made announcements
103
+
104
+
105
+ ```solidity
106
+ function getAnnouncedValidators() external view returns (address[] memory);
107
+ ```
108
+
109
+ ## Events
110
+ ### ValidatorAnnouncement
111
+ Emitted when a new validator announcement is made
112
+
113
+
114
+ ```solidity
115
+ event ValidatorAnnouncement(address indexed validator, string storageLocation);
116
+ ```
117
+
@@ -0,0 +1,64 @@
1
+ # ERC5164MessageHook
2
+ [Git Source](https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/a5209dbd9b0f5eb34e0bc9df2ba157dda2b454d3/contracts/hooks/ERC5164/ERC5164MessageHook.sol)
3
+
4
+ **Inherits:**
5
+ [IMessageHook](/contracts/interfaces/hooks/IMessageHook.sol/interface.IMessageHook.md)
6
+
7
+ Message hook to inform the 5164 ISM of messages published through
8
+ any of the 5164 adapters.
9
+
10
+
11
+ ## State Variables
12
+ ### destinationDomain
13
+
14
+ ```solidity
15
+ uint32 public immutable destinationDomain;
16
+ ```
17
+
18
+
19
+ ### dispatcher
20
+
21
+ ```solidity
22
+ IMessageDispatcher public immutable dispatcher;
23
+ ```
24
+
25
+
26
+ ### ism
27
+
28
+ ```solidity
29
+ address public immutable ism;
30
+ ```
31
+
32
+
33
+ ## Functions
34
+ ### constructor
35
+
36
+
37
+ ```solidity
38
+ constructor(uint32 _destinationDomain, address _dispatcher, address _ism);
39
+ ```
40
+
41
+ ### postDispatch
42
+
43
+ Hook to inform the ERC5164ISM of messages published through.
44
+
45
+ *anyone can call this function, that's why we need to send msg.sender*
46
+
47
+
48
+ ```solidity
49
+ function postDispatch(uint32 _destinationDomain, bytes32 _messageId) public payable override returns (uint256);
50
+ ```
51
+ **Parameters**
52
+
53
+ |Name|Type|Description|
54
+ |----|----|-----------|
55
+ |`_destinationDomain`|`uint32`|The destination domain of the message.|
56
+ |`_messageId`|`bytes32`|The message ID.|
57
+
58
+ **Returns**
59
+
60
+ |Name|Type|Description|
61
+ |----|----|-----------|
62
+ |`<none>`|`uint256`|gasOverhead The gas overhead for the function call on destination.|
63
+
64
+
@@ -0,0 +1,5 @@
1
+
2
+
3
+ # Contents
4
+ - [interfaces](/contracts/hooks/ERC5164/interfaces)
5
+ - [ERC5164MessageHook](ERC5164MessageHook.sol/contract.ERC5164MessageHook.md)
@@ -0,0 +1,25 @@
1
+ # IMessageDispatcher
2
+ [Git Source](https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/a5209dbd9b0f5eb34e0bc9df2ba157dda2b454d3/contracts/hooks/ERC5164/interfaces/IMessageDispatcher.sol)
3
+
4
+ *See https://eips.ethereum.org/EIPS/eip-5164*
5
+
6
+
7
+ ## Functions
8
+ ### dispatchMessage
9
+
10
+
11
+ ```solidity
12
+ function dispatchMessage(uint256 toChainId, address to, bytes calldata data) external returns (bytes32);
13
+ ```
14
+
15
+ ## Events
16
+ ### MessageDispatched
17
+ Emitted when a message has successfully been dispatched to the executor chain.
18
+
19
+
20
+ ```solidity
21
+ event MessageDispatched(
22
+ bytes32 indexed messageId, address indexed from, uint256 indexed toChainId, address to, bytes data
23
+ );
24
+ ```
25
+
@@ -0,0 +1,4 @@
1
+
2
+
3
+ # Contents
4
+ - [IMessageDispatcher](IMessageDispatcher.sol/interface.IMessageDispatcher.md)
@@ -0,0 +1,71 @@
1
+ # OptimismMessageHook
2
+ [Git Source](https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/a5209dbd9b0f5eb34e0bc9df2ba157dda2b454d3/contracts/hooks/OptimismMessageHook.sol)
3
+
4
+ **Inherits:**
5
+ [IMessageHook](/contracts/interfaces/hooks/IMessageHook.sol/interface.IMessageHook.md)
6
+
7
+ Message hook to inform the Optimism ISM of messages published through
8
+ the native Optimism bridge.
9
+
10
+
11
+ ## State Variables
12
+ ### destinationDomain
13
+
14
+ ```solidity
15
+ uint32 public immutable destinationDomain;
16
+ ```
17
+
18
+
19
+ ### l1Messenger
20
+
21
+ ```solidity
22
+ ICrossDomainMessenger public immutable l1Messenger;
23
+ ```
24
+
25
+
26
+ ### ism
27
+
28
+ ```solidity
29
+ address public immutable ism;
30
+ ```
31
+
32
+
33
+ ### GAS_LIMIT
34
+
35
+ ```solidity
36
+ uint32 internal constant GAS_LIMIT = 1_920_000;
37
+ ```
38
+
39
+
40
+ ## Functions
41
+ ### constructor
42
+
43
+
44
+ ```solidity
45
+ constructor(uint32 _destinationDomain, address _messenger, address _ism);
46
+ ```
47
+
48
+ ### postDispatch
49
+
50
+ Hook to inform the optimism ISM of messages published through.
51
+
52
+ *anyone can call this function, that's why we need to send msg.sender*
53
+
54
+
55
+ ```solidity
56
+ function postDispatch(uint32 _destination, bytes32 _messageId) public payable override returns (uint256);
57
+ ```
58
+ **Parameters**
59
+
60
+ |Name|Type|Description|
61
+ |----|----|-----------|
62
+ |`_destination`|`uint32`|The destination domain of the message.|
63
+ |`_messageId`|`bytes32`|The message ID.|
64
+
65
+ **Returns**
66
+
67
+ |Name|Type|Description|
68
+ |----|----|-----------|
69
+ |`<none>`|`uint256`|gasOverhead The gas overhead for the function call on L2.|
70
+
71
+
@@ -0,0 +1,5 @@
1
+
2
+
3
+ # Contents
4
+ - [ERC5164](/contracts/hooks/ERC5164)
5
+ - [OptimismMessageHook](OptimismMessageHook.sol/contract.OptimismMessageHook.md)
@@ -0,0 +1,231 @@
1
+ # InterchainGasPaymaster
2
+ [Git Source](https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/a5209dbd9b0f5eb34e0bc9df2ba157dda2b454d3/contracts/igps/InterchainGasPaymaster.sol)
3
+
4
+ **Inherits:**
5
+ [IInterchainGasPaymaster](/contracts/interfaces/IInterchainGasPaymaster.sol/interface.IInterchainGasPaymaster.md), [IGasOracle](/contracts/interfaces/IGasOracle.sol/interface.IGasOracle.md), OwnableUpgradeable
6
+
7
+ Manages payments on a source chain to cover gas costs of relaying
8
+ messages to destination chains.
9
+
10
+
11
+ ## State Variables
12
+ ### TOKEN_EXCHANGE_RATE_SCALE
13
+ The scale of gas oracle token exchange rates.
14
+
15
+
16
+ ```solidity
17
+ uint256 internal constant TOKEN_EXCHANGE_RATE_SCALE = 1e10;
18
+ ```
19
+
20
+
21
+ ### gasOracles
22
+ Keyed by remote domain, the gas oracle to use for the domain.
23
+
24
+
25
+ ```solidity
26
+ mapping(uint32 => IGasOracle) public gasOracles;
27
+ ```
28
+
29
+
30
+ ### beneficiary
31
+ The benficiary that can receive native tokens paid into this contract.
32
+
33
+
34
+ ```solidity
35
+ address public beneficiary;
36
+ ```
37
+
38
+
39
+ ## Functions
40
+ ### initialize
41
+
42
+
43
+ ```solidity
44
+ function initialize(address _owner, address _beneficiary) public initializer;
45
+ ```
46
+ **Parameters**
47
+
48
+ |Name|Type|Description|
49
+ |----|----|-----------|
50
+ |`_owner`|`address`|The owner of the contract.|
51
+ |`_beneficiary`|`address`|The beneficiary.|
52
+
53
+
54
+ ### payForGas
55
+
56
+ Deposits msg.value as a payment for the relaying of a message
57
+ to its destination chain.
58
+
59
+ *Overpayment will result in a refund of native tokens to the _refundAddress.
60
+ Callers should be aware that this may present reentrancy issues.*
61
+
62
+
63
+ ```solidity
64
+ function payForGas(bytes32 _messageId, uint32 _destinationDomain, uint256 _gasAmount, address _refundAddress)
65
+ external
66
+ payable
67
+ override;
68
+ ```
69
+ **Parameters**
70
+
71
+ |Name|Type|Description|
72
+ |----|----|-----------|
73
+ |`_messageId`|`bytes32`|The ID of the message to pay for.|
74
+ |`_destinationDomain`|`uint32`|The domain of the message's destination chain.|
75
+ |`_gasAmount`|`uint256`|The amount of destination gas to pay for.|
76
+ |`_refundAddress`|`address`|The address to refund any overpayment to.|
77
+
78
+
79
+ ### claim
80
+
81
+ Transfers the entire native token balance to the beneficiary.
82
+
83
+ *The beneficiary must be able to receive native tokens.*
84
+
85
+
86
+ ```solidity
87
+ function claim() external;
88
+ ```
89
+
90
+ ### setGasOracles
91
+
92
+ Sets the gas oracles for remote domains specified in the config array.
93
+
94
+
95
+ ```solidity
96
+ function setGasOracles(GasOracleConfig[] calldata _configs) external onlyOwner;
97
+ ```
98
+ **Parameters**
99
+
100
+ |Name|Type|Description|
101
+ |----|----|-----------|
102
+ |`_configs`|`GasOracleConfig[]`|An array of configs including the remote domain and gas oracles to set.|
103
+
104
+
105
+ ### setBeneficiary
106
+
107
+ Sets the beneficiary.
108
+
109
+
110
+ ```solidity
111
+ function setBeneficiary(address _beneficiary) external onlyOwner;
112
+ ```
113
+ **Parameters**
114
+
115
+ |Name|Type|Description|
116
+ |----|----|-----------|
117
+ |`_beneficiary`|`address`|The new beneficiary.|
118
+
119
+
120
+ ### quoteGasPayment
121
+
122
+ Quotes the amount of native tokens to pay for interchain gas.
123
+
124
+
125
+ ```solidity
126
+ function quoteGasPayment(uint32 _destinationDomain, uint256 _gasAmount)
127
+ public
128
+ view
129
+ virtual
130
+ override
131
+ returns (uint256);
132
+ ```
133
+ **Parameters**
134
+
135
+ |Name|Type|Description|
136
+ |----|----|-----------|
137
+ |`_destinationDomain`|`uint32`|The domain of the message's destination chain.|
138
+ |`_gasAmount`|`uint256`|The amount of destination gas to pay for.|
139
+
140
+ **Returns**
141
+
142
+ |Name|Type|Description|
143
+ |----|----|-----------|
144
+ |`<none>`|`uint256`|The amount of native tokens required to pay for interchain gas.|
145
+
146
+
147
+ ### getExchangeRateAndGasPrice
148
+
149
+ Gets the token exchange rate and gas price from the configured gas oracle
150
+ for a given destination domain.
151
+
152
+
153
+ ```solidity
154
+ function getExchangeRateAndGasPrice(uint32 _destinationDomain)
155
+ public
156
+ view
157
+ override
158
+ returns (uint128 tokenExchangeRate, uint128 gasPrice);
159
+ ```
160
+ **Parameters**
161
+
162
+ |Name|Type|Description|
163
+ |----|----|-----------|
164
+ |`_destinationDomain`|`uint32`|The destination domain.|
165
+
166
+ **Returns**
167
+
168
+ |Name|Type|Description|
169
+ |----|----|-----------|
170
+ |`tokenExchangeRate`|`uint128`|The exchange rate of the remote native token quoted in the local native token.|
171
+ |`gasPrice`|`uint128`|The gas price on the remote chain.|
172
+
173
+
174
+ ### _setBeneficiary
175
+
176
+ Sets the beneficiary.
177
+
178
+
179
+ ```solidity
180
+ function _setBeneficiary(address _beneficiary) internal;
181
+ ```
182
+ **Parameters**
183
+
184
+ |Name|Type|Description|
185
+ |----|----|-----------|
186
+ |`_beneficiary`|`address`|The new beneficiary.|
187
+
188
+
189
+ ### _setGasOracle
190
+
191
+ Sets the gas oracle for a remote domain.
192
+
193
+
194
+ ```solidity
195
+ function _setGasOracle(uint32 _remoteDomain, address _gasOracle) internal;
196
+ ```
197
+ **Parameters**
198
+
199
+ |Name|Type|Description|
200
+ |----|----|-----------|
201
+ |`_remoteDomain`|`uint32`|The remote domain.|
202
+ |`_gasOracle`|`address`|The gas oracle.|
203
+
204
+
205
+ ## Events
206
+ ### GasOracleSet
207
+ Emitted when the gas oracle for a remote domain is set.
208
+
209
+
210
+ ```solidity
211
+ event GasOracleSet(uint32 indexed remoteDomain, address gasOracle);
212
+ ```
213
+
214
+ ### BeneficiarySet
215
+ Emitted when the beneficiary is set.
216
+
217
+
218
+ ```solidity
219
+ event BeneficiarySet(address beneficiary);
220
+ ```
221
+
222
+ ## Structs
223
+ ### GasOracleConfig
224
+
225
+ ```solidity
226
+ struct GasOracleConfig {
227
+ uint32 remoteDomain;
228
+ address gasOracle;
229
+ }
230
+ ```
231
+
@@ -0,0 +1,161 @@
1
+ # OverheadIgp
2
+ [Git Source](https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/a5209dbd9b0f5eb34e0bc9df2ba157dda2b454d3/contracts/igps/OverheadIgp.sol)
3
+
4
+ **Inherits:**
5
+ [IInterchainGasPaymaster](/contracts/interfaces/IInterchainGasPaymaster.sol/interface.IInterchainGasPaymaster.md), Ownable
6
+
7
+ An IGP that adds configured gas overheads to gas amounts and forwards
8
+ calls to an "inner" IGP.
9
+
10
+ *The intended use of this contract is to store overhead gas amounts for destination
11
+ domains, e.g. Mailbox and/or ISM gas usage, such that users of this IGP are only required
12
+ to specify the gas amount used by their own applications.*
13
+
14
+
15
+ ## State Variables
16
+ ### innerIgp
17
+ The IGP that is called when paying for or quoting gas
18
+ after applying overhead gas amounts.
19
+
20
+
21
+ ```solidity
22
+ IInterchainGasPaymaster public immutable innerIgp;
23
+ ```
24
+
25
+
26
+ ### destinationGasOverhead
27
+ Destination domain => overhead gas amount on that domain.
28
+
29
+
30
+ ```solidity
31
+ mapping(uint32 => uint256) public destinationGasOverhead;
32
+ ```
33
+
34
+
35
+ ## Functions
36
+ ### constructor
37
+
38
+
39
+ ```solidity
40
+ constructor(address _innerIgp);
41
+ ```
42
+
43
+ ### payForGas
44
+
45
+ Adds the stored destinationGasOverhead to the _gasAmount and forwards the
46
+ call to the innerIgp's `payForGas` function.
47
+
48
+
49
+ ```solidity
50
+ function payForGas(bytes32 _messageId, uint32 _destinationDomain, uint256 _gasAmount, address _refundAddress)
51
+ external
52
+ payable;
53
+ ```
54
+ **Parameters**
55
+
56
+ |Name|Type|Description|
57
+ |----|----|-----------|
58
+ |`_messageId`|`bytes32`|The ID of the message to pay for.|
59
+ |`_destinationDomain`|`uint32`|The domain of the message's destination chain.|
60
+ |`_gasAmount`|`uint256`|The amount of destination gas to pay for. This should not consider any gas that is accounted for in the stored destinationGasOverhead.|
61
+ |`_refundAddress`|`address`|The address to refund any overpayment to.|
62
+
63
+
64
+ ### setDestinationGasOverheads
65
+
66
+ Sets destination gas overheads for multiple domains.
67
+
68
+ *Only callable by the owner.*
69
+
70
+
71
+ ```solidity
72
+ function setDestinationGasOverheads(DomainConfig[] calldata configs) external onlyOwner;
73
+ ```
74
+ **Parameters**
75
+
76
+ |Name|Type|Description|
77
+ |----|----|-----------|
78
+ |`configs`|`DomainConfig[]`|A list of destination domains and gas overheads.|
79
+
80
+
81
+ ### quoteGasPayment
82
+
83
+ Adds the stored destinationGasOverhead to the _gasAmount and forwards the
84
+ call to the innerIgp's `quoteGasPayment` function.
85
+
86
+
87
+ ```solidity
88
+ function quoteGasPayment(uint32 _destinationDomain, uint256 _gasAmount) public view returns (uint256);
89
+ ```
90
+ **Parameters**
91
+
92
+ |Name|Type|Description|
93
+ |----|----|-----------|
94
+ |`_destinationDomain`|`uint32`|The domain of the message's destination chain.|
95
+ |`_gasAmount`|`uint256`|The amount of destination gas to pay for. This should not consider any gas that is accounted for in the stored destinationGasOverhead.|
96
+
97
+ **Returns**
98
+
99
+ |Name|Type|Description|
100
+ |----|----|-----------|
101
+ |`<none>`|`uint256`|The amount of native tokens required to pay for interchain gas.|
102
+
103
+
104
+ ### destinationGasAmount
105
+
106
+ Returns the stored destinationGasOverhead added to the _gasAmount.
107
+
108
+ *If there is no stored destinationGasOverhead, 0 is used.*
109
+
110
+
111
+ ```solidity
112
+ function destinationGasAmount(uint32 _destinationDomain, uint256 _gasAmount) public view returns (uint256);
113
+ ```
114
+ **Parameters**
115
+
116
+ |Name|Type|Description|
117
+ |----|----|-----------|
118
+ |`_destinationDomain`|`uint32`|The domain of the message's destination chain.|
119
+ |`_gasAmount`|`uint256`|The amount of destination gas to pay for. This should not consider any gas that is accounted for in the stored destinationGasOverhead.|
120
+
121
+ **Returns**
122
+
123
+ |Name|Type|Description|
124
+ |----|----|-----------|
125
+ |`<none>`|`uint256`|The stored destinationGasOverhead added to the _gasAmount.|
126
+
127
+
128
+ ### _setDestinationGasOverhead
129
+
130
+ Sets the destination gas overhead for a single domain.
131
+
132
+
133
+ ```solidity
134
+ function _setDestinationGasOverhead(DomainConfig calldata config) internal;
135
+ ```
136
+ **Parameters**
137
+
138
+ |Name|Type|Description|
139
+ |----|----|-----------|
140
+ |`config`|`DomainConfig`|The destination domain and gas overhead.|
141
+
142
+
143
+ ## Events
144
+ ### DestinationGasOverheadSet
145
+ Emitted when an entry in the destinationGasOverhead mapping is set.
146
+
147
+
148
+ ```solidity
149
+ event DestinationGasOverheadSet(uint32 indexed domain, uint256 gasOverhead);
150
+ ```
151
+
152
+ ## Structs
153
+ ### DomainConfig
154
+
155
+ ```solidity
156
+ struct DomainConfig {
157
+ uint32 domain;
158
+ uint256 gasOverhead;
159
+ }
160
+ ```
161
+
@@ -0,0 +1,6 @@
1
+
2
+
3
+ # Contents
4
+ - [gas-oracles](/contracts/igps/gas-oracles)
5
+ - [InterchainGasPaymaster](InterchainGasPaymaster.sol/contract.InterchainGasPaymaster.md)
6
+ - [OverheadIgp](OverheadIgp.sol/contract.OverheadIgp.md)
@@ -0,0 +1,4 @@
1
+
2
+
3
+ # Contents
4
+ - [StorageGasOracle](StorageGasOracle.sol/contract.StorageGasOracle.md)