@hyperlane-xyz/core 5.12.0-ccip.1 → 5.12.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 (241) hide show
  1. package/contracts/PackageVersioned.sol +1 -1
  2. package/contracts/libs/RateLimitMidpointCommonLibrary.sol +22 -0
  3. package/contracts/test/ERC20Test.sol +156 -4
  4. package/contracts/token/interfaces/IXERC20VS.sol +96 -0
  5. package/dist/buildArtifact.js +1 -1
  6. package/dist/buildArtifact.json +1 -1
  7. package/dist/contracts/test/ERC20Test.sol/XERC20Test.d.ts +108 -1
  8. package/dist/contracts/test/ERC20Test.sol/XERC20Test.d.ts.map +1 -1
  9. package/dist/contracts/test/ERC20Test.sol/XERC20VSTest.d.ts +894 -0
  10. package/dist/contracts/test/ERC20Test.sol/XERC20VSTest.d.ts.map +1 -0
  11. package/dist/contracts/test/ERC20Test.sol/XERC20VSTest.js +2 -0
  12. package/dist/contracts/test/ERC20Test.sol/XERC20VSTest.js.map +1 -0
  13. package/dist/contracts/test/ERC20Test.sol/index.d.ts +1 -0
  14. package/dist/contracts/test/ERC20Test.sol/index.d.ts.map +1 -1
  15. package/dist/contracts/token/interfaces/IXERC20VS.d.ts +557 -0
  16. package/dist/contracts/token/interfaces/IXERC20VS.d.ts.map +1 -0
  17. package/dist/contracts/token/interfaces/IXERC20VS.js +2 -0
  18. package/dist/contracts/token/interfaces/IXERC20VS.js.map +1 -0
  19. package/dist/contracts/token/interfaces/index.d.ts +1 -0
  20. package/dist/contracts/token/interfaces/index.d.ts.map +1 -1
  21. package/dist/factories/contracts/AttributeCheckpointFraud__factory.d.ts +1 -1
  22. package/dist/factories/contracts/AttributeCheckpointFraud__factory.js +1 -1
  23. package/dist/factories/contracts/CheckpointFraudProofs__factory.d.ts +1 -1
  24. package/dist/factories/contracts/CheckpointFraudProofs__factory.js +1 -1
  25. package/dist/factories/contracts/Mailbox__factory.d.ts +1 -1
  26. package/dist/factories/contracts/Mailbox__factory.js +1 -1
  27. package/dist/factories/contracts/avs/ECDSAStakeRegistry__factory.d.ts +1 -1
  28. package/dist/factories/contracts/avs/ECDSAStakeRegistry__factory.js +1 -1
  29. package/dist/factories/contracts/avs/HyperlaneServiceManager__factory.d.ts +1 -1
  30. package/dist/factories/contracts/avs/HyperlaneServiceManager__factory.js +1 -1
  31. package/dist/factories/contracts/hooks/ArbL2ToL1Hook__factory.d.ts +1 -1
  32. package/dist/factories/contracts/hooks/ArbL2ToL1Hook__factory.js +1 -1
  33. package/dist/factories/contracts/hooks/CCIPHook__factory.d.ts +1 -1
  34. package/dist/factories/contracts/hooks/CCIPHook__factory.js +1 -1
  35. package/dist/factories/contracts/hooks/DefaultHook__factory.d.ts +1 -1
  36. package/dist/factories/contracts/hooks/DefaultHook__factory.js +1 -1
  37. package/dist/factories/contracts/hooks/MerkleTreeHook__factory.d.ts +1 -1
  38. package/dist/factories/contracts/hooks/MerkleTreeHook__factory.js +1 -1
  39. package/dist/factories/contracts/hooks/OPL2ToL1Hook__factory.d.ts +1 -1
  40. package/dist/factories/contracts/hooks/OPL2ToL1Hook__factory.js +1 -1
  41. package/dist/factories/contracts/hooks/OPStackHook__factory.d.ts +1 -1
  42. package/dist/factories/contracts/hooks/OPStackHook__factory.js +1 -1
  43. package/dist/factories/contracts/hooks/PausableHook__factory.d.ts +1 -1
  44. package/dist/factories/contracts/hooks/PausableHook__factory.js +1 -1
  45. package/dist/factories/contracts/hooks/PolygonPosHook__factory.d.ts +1 -1
  46. package/dist/factories/contracts/hooks/PolygonPosHook__factory.js +1 -1
  47. package/dist/factories/contracts/hooks/ProtocolFee__factory.d.ts +1 -1
  48. package/dist/factories/contracts/hooks/ProtocolFee__factory.js +1 -1
  49. package/dist/factories/contracts/hooks/aggregation/ERC5164Hook__factory.d.ts +1 -1
  50. package/dist/factories/contracts/hooks/aggregation/ERC5164Hook__factory.js +1 -1
  51. package/dist/factories/contracts/hooks/aggregation/StaticAggregationHookFactory__factory.d.ts +1 -1
  52. package/dist/factories/contracts/hooks/aggregation/StaticAggregationHookFactory__factory.js +1 -1
  53. package/dist/factories/contracts/hooks/aggregation/StaticAggregationHook__factory.d.ts +1 -1
  54. package/dist/factories/contracts/hooks/aggregation/StaticAggregationHook__factory.js +1 -1
  55. package/dist/factories/contracts/hooks/igp/InterchainGasPaymaster__factory.d.ts +1 -1
  56. package/dist/factories/contracts/hooks/igp/InterchainGasPaymaster__factory.js +1 -1
  57. package/dist/factories/contracts/hooks/igp/StorageGasOracle__factory.d.ts +1 -1
  58. package/dist/factories/contracts/hooks/igp/StorageGasOracle__factory.js +1 -1
  59. package/dist/factories/contracts/hooks/layer-zero/LayerZeroV1Hook__factory.d.ts +1 -1
  60. package/dist/factories/contracts/hooks/layer-zero/LayerZeroV1Hook__factory.js +1 -1
  61. package/dist/factories/contracts/hooks/layer-zero/LayerZeroV2Hook__factory.d.ts +1 -1
  62. package/dist/factories/contracts/hooks/layer-zero/LayerZeroV2Hook__factory.js +1 -1
  63. package/dist/factories/contracts/hooks/routing/AmountRoutingHook__factory.d.ts +1 -1
  64. package/dist/factories/contracts/hooks/routing/AmountRoutingHook__factory.js +1 -1
  65. package/dist/factories/contracts/hooks/routing/DestinationRecipientRoutingHook__factory.d.ts +1 -1
  66. package/dist/factories/contracts/hooks/routing/DestinationRecipientRoutingHook__factory.js +1 -1
  67. package/dist/factories/contracts/hooks/routing/DomainRoutingHook__factory.d.ts +1 -1
  68. package/dist/factories/contracts/hooks/routing/DomainRoutingHook__factory.js +1 -1
  69. package/dist/factories/contracts/hooks/routing/FallbackDomainRoutingHook__factory.d.ts +1 -1
  70. package/dist/factories/contracts/hooks/routing/FallbackDomainRoutingHook__factory.js +1 -1
  71. package/dist/factories/contracts/hooks/warp-route/RateLimitedHook__factory.d.ts +1 -1
  72. package/dist/factories/contracts/hooks/warp-route/RateLimitedHook__factory.js +1 -1
  73. package/dist/factories/contracts/isms/NoopIsm__factory.d.ts +1 -1
  74. package/dist/factories/contracts/isms/NoopIsm__factory.js +1 -1
  75. package/dist/factories/contracts/isms/PausableIsm__factory.d.ts +1 -1
  76. package/dist/factories/contracts/isms/PausableIsm__factory.js +1 -1
  77. package/dist/factories/contracts/isms/TrustedRelayerIsm__factory.d.ts +1 -1
  78. package/dist/factories/contracts/isms/TrustedRelayerIsm__factory.js +1 -1
  79. package/dist/factories/contracts/isms/aggregation/StaticAggregationIsmFactory__factory.d.ts +1 -1
  80. package/dist/factories/contracts/isms/aggregation/StaticAggregationIsmFactory__factory.js +1 -1
  81. package/dist/factories/contracts/isms/aggregation/StaticAggregationIsm__factory.d.ts +1 -1
  82. package/dist/factories/contracts/isms/aggregation/StaticAggregationIsm__factory.js +1 -1
  83. package/dist/factories/contracts/isms/aggregation/StorageAggregationIsm.sol/StorageAggregationIsmFactory__factory.d.ts +1 -1
  84. package/dist/factories/contracts/isms/aggregation/StorageAggregationIsm.sol/StorageAggregationIsmFactory__factory.js +1 -1
  85. package/dist/factories/contracts/isms/aggregation/StorageAggregationIsm.sol/StorageAggregationIsm__factory.d.ts +1 -1
  86. package/dist/factories/contracts/isms/aggregation/StorageAggregationIsm.sol/StorageAggregationIsm__factory.js +1 -1
  87. package/dist/factories/contracts/isms/hook/ArbL2ToL1Ism__factory.d.ts +1 -1
  88. package/dist/factories/contracts/isms/hook/ArbL2ToL1Ism__factory.js +1 -1
  89. package/dist/factories/contracts/isms/hook/CCIPIsm__factory.d.ts +1 -1
  90. package/dist/factories/contracts/isms/hook/CCIPIsm__factory.js +1 -1
  91. package/dist/factories/contracts/isms/hook/ERC5164Ism__factory.d.ts +1 -1
  92. package/dist/factories/contracts/isms/hook/ERC5164Ism__factory.js +1 -1
  93. package/dist/factories/contracts/isms/hook/OPL2ToL1Ism__factory.d.ts +1 -1
  94. package/dist/factories/contracts/isms/hook/OPL2ToL1Ism__factory.js +1 -1
  95. package/dist/factories/contracts/isms/hook/OPStackIsm__factory.d.ts +1 -1
  96. package/dist/factories/contracts/isms/hook/OPStackIsm__factory.js +1 -1
  97. package/dist/factories/contracts/isms/hook/PolygonPosIsm__factory.d.ts +1 -1
  98. package/dist/factories/contracts/isms/hook/PolygonPosIsm__factory.js +1 -1
  99. package/dist/factories/contracts/isms/hook/layer-zero/LayerZeroV2Ism__factory.d.ts +1 -1
  100. package/dist/factories/contracts/isms/hook/layer-zero/LayerZeroV2Ism__factory.js +1 -1
  101. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMerkleRootMultisigIsmFactory__factory.d.ts +1 -1
  102. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMerkleRootMultisigIsmFactory__factory.js +1 -1
  103. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMerkleRootMultisigIsm__factory.d.ts +1 -1
  104. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMerkleRootMultisigIsm__factory.js +1 -1
  105. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMessageIdMultisigIsmFactory__factory.d.ts +1 -1
  106. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMessageIdMultisigIsmFactory__factory.js +1 -1
  107. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMessageIdMultisigIsm__factory.d.ts +1 -1
  108. package/dist/factories/contracts/isms/multisig/StaticMultisigIsm.sol/StaticMessageIdMultisigIsm__factory.js +1 -1
  109. package/dist/factories/contracts/isms/multisig/StorageMultisigIsm.sol/StorageMerkleRootMultisigIsmFactory__factory.d.ts +1 -1
  110. package/dist/factories/contracts/isms/multisig/StorageMultisigIsm.sol/StorageMerkleRootMultisigIsmFactory__factory.js +1 -1
  111. package/dist/factories/contracts/isms/multisig/StorageMultisigIsm.sol/StorageMerkleRootMultisigIsm__factory.d.ts +1 -1
  112. package/dist/factories/contracts/isms/multisig/StorageMultisigIsm.sol/StorageMerkleRootMultisigIsm__factory.js +1 -1
  113. package/dist/factories/contracts/isms/multisig/StorageMultisigIsm.sol/StorageMessageIdMultisigIsmFactory__factory.d.ts +1 -1
  114. package/dist/factories/contracts/isms/multisig/StorageMultisigIsm.sol/StorageMessageIdMultisigIsmFactory__factory.js +1 -1
  115. package/dist/factories/contracts/isms/multisig/StorageMultisigIsm.sol/StorageMessageIdMultisigIsm__factory.d.ts +1 -1
  116. package/dist/factories/contracts/isms/multisig/StorageMultisigIsm.sol/StorageMessageIdMultisigIsm__factory.js +1 -1
  117. package/dist/factories/contracts/isms/multisig/ValidatorAnnounce__factory.d.ts +1 -1
  118. package/dist/factories/contracts/isms/multisig/ValidatorAnnounce__factory.js +1 -1
  119. package/dist/factories/contracts/isms/multisig/WeightedMultisigIsm.sol/StaticMerkleRootWeightedMultisigIsmFactory__factory.d.ts +1 -1
  120. package/dist/factories/contracts/isms/multisig/WeightedMultisigIsm.sol/StaticMerkleRootWeightedMultisigIsmFactory__factory.js +1 -1
  121. package/dist/factories/contracts/isms/multisig/WeightedMultisigIsm.sol/StaticMerkleRootWeightedMultisigIsm__factory.d.ts +1 -1
  122. package/dist/factories/contracts/isms/multisig/WeightedMultisigIsm.sol/StaticMerkleRootWeightedMultisigIsm__factory.js +1 -1
  123. package/dist/factories/contracts/isms/multisig/WeightedMultisigIsm.sol/StaticMessageIdWeightedMultisigIsmFactory__factory.d.ts +1 -1
  124. package/dist/factories/contracts/isms/multisig/WeightedMultisigIsm.sol/StaticMessageIdWeightedMultisigIsmFactory__factory.js +1 -1
  125. package/dist/factories/contracts/isms/multisig/WeightedMultisigIsm.sol/StaticMessageIdWeightedMultisigIsm__factory.d.ts +1 -1
  126. package/dist/factories/contracts/isms/multisig/WeightedMultisigIsm.sol/StaticMessageIdWeightedMultisigIsm__factory.js +1 -1
  127. package/dist/factories/contracts/isms/routing/DefaultFallbackRoutingIsm__factory.d.ts +1 -1
  128. package/dist/factories/contracts/isms/routing/DefaultFallbackRoutingIsm__factory.js +1 -1
  129. package/dist/factories/contracts/isms/routing/DomainRoutingIsmFactory.sol/DomainRoutingIsmFactory__factory.d.ts +1 -1
  130. package/dist/factories/contracts/isms/routing/DomainRoutingIsmFactory.sol/DomainRoutingIsmFactory__factory.js +1 -1
  131. package/dist/factories/contracts/isms/routing/DomainRoutingIsm__factory.d.ts +1 -1
  132. package/dist/factories/contracts/isms/routing/DomainRoutingIsm__factory.js +1 -1
  133. package/dist/factories/contracts/isms/routing/InterchainAccountIsm__factory.d.ts +1 -1
  134. package/dist/factories/contracts/isms/routing/InterchainAccountIsm__factory.js +1 -1
  135. package/dist/factories/contracts/isms/warp-route/AmountRoutingIsm__factory.d.ts +1 -1
  136. package/dist/factories/contracts/isms/warp-route/AmountRoutingIsm__factory.js +1 -1
  137. package/dist/factories/contracts/isms/warp-route/RateLimitedIsm__factory.d.ts +1 -1
  138. package/dist/factories/contracts/isms/warp-route/RateLimitedIsm__factory.js +1 -1
  139. package/dist/factories/contracts/middleware/InterchainAccountRouter__factory.d.ts +1 -1
  140. package/dist/factories/contracts/middleware/InterchainAccountRouter__factory.js +1 -1
  141. package/dist/factories/contracts/middleware/InterchainQueryRouter__factory.d.ts +1 -1
  142. package/dist/factories/contracts/middleware/InterchainQueryRouter__factory.js +1 -1
  143. package/dist/factories/contracts/middleware/liquidity-layer/LiquidityLayerRouter__factory.d.ts +1 -1
  144. package/dist/factories/contracts/middleware/liquidity-layer/LiquidityLayerRouter__factory.js +1 -1
  145. package/dist/factories/contracts/middleware/liquidity-layer/adapters/CircleBridgeAdapter__factory.d.ts +1 -1
  146. package/dist/factories/contracts/middleware/liquidity-layer/adapters/CircleBridgeAdapter__factory.js +1 -1
  147. package/dist/factories/contracts/middleware/liquidity-layer/adapters/PortalAdapter__factory.d.ts +1 -1
  148. package/dist/factories/contracts/middleware/liquidity-layer/adapters/PortalAdapter__factory.js +1 -1
  149. package/dist/factories/contracts/mock/MockHyperlaneEnvironment__factory.d.ts +1 -1
  150. package/dist/factories/contracts/mock/MockHyperlaneEnvironment__factory.js +1 -1
  151. package/dist/factories/contracts/mock/MockMailbox__factory.d.ts +1 -1
  152. package/dist/factories/contracts/mock/MockMailbox__factory.js +1 -1
  153. package/dist/factories/contracts/test/ERC20Test.sol/ERC20Test__factory.d.ts +1 -1
  154. package/dist/factories/contracts/test/ERC20Test.sol/ERC20Test__factory.js +1 -1
  155. package/dist/factories/contracts/test/ERC20Test.sol/FiatTokenTest__factory.d.ts +1 -1
  156. package/dist/factories/contracts/test/ERC20Test.sol/FiatTokenTest__factory.js +1 -1
  157. package/dist/factories/contracts/test/ERC20Test.sol/XERC20LockboxTest__factory.d.ts +1 -1
  158. package/dist/factories/contracts/test/ERC20Test.sol/XERC20LockboxTest__factory.d.ts.map +1 -1
  159. package/dist/factories/contracts/test/ERC20Test.sol/XERC20LockboxTest__factory.js +1 -1
  160. package/dist/factories/contracts/test/ERC20Test.sol/XERC20LockboxTest__factory.js.map +1 -1
  161. package/dist/factories/contracts/test/ERC20Test.sol/XERC20Test__factory.d.ts +39 -2
  162. package/dist/factories/contracts/test/ERC20Test.sol/XERC20Test__factory.d.ts.map +1 -1
  163. package/dist/factories/contracts/test/ERC20Test.sol/XERC20Test__factory.js +48 -2
  164. package/dist/factories/contracts/test/ERC20Test.sol/XERC20Test__factory.js.map +1 -1
  165. package/dist/factories/contracts/test/ERC20Test.sol/XERC20VSTest__factory.d.ts +595 -0
  166. package/dist/factories/contracts/test/ERC20Test.sol/XERC20VSTest__factory.d.ts.map +1 -0
  167. package/dist/factories/contracts/test/ERC20Test.sol/XERC20VSTest__factory.js +788 -0
  168. package/dist/factories/contracts/test/ERC20Test.sol/XERC20VSTest__factory.js.map +1 -0
  169. package/dist/factories/contracts/test/ERC20Test.sol/index.d.ts +1 -0
  170. package/dist/factories/contracts/test/ERC20Test.sol/index.d.ts.map +1 -1
  171. package/dist/factories/contracts/test/ERC20Test.sol/index.js +1 -0
  172. package/dist/factories/contracts/test/ERC20Test.sol/index.js.map +1 -1
  173. package/dist/factories/contracts/test/TestGasRouter__factory.d.ts +1 -1
  174. package/dist/factories/contracts/test/TestGasRouter__factory.js +1 -1
  175. package/dist/factories/contracts/test/TestInterchainGasPaymaster__factory.d.ts +1 -1
  176. package/dist/factories/contracts/test/TestInterchainGasPaymaster__factory.js +1 -1
  177. package/dist/factories/contracts/test/TestMailbox__factory.d.ts +1 -1
  178. package/dist/factories/contracts/test/TestMailbox__factory.js +1 -1
  179. package/dist/factories/contracts/test/TestMerkleTreeHook__factory.d.ts +1 -1
  180. package/dist/factories/contracts/test/TestMerkleTreeHook__factory.js +1 -1
  181. package/dist/factories/contracts/test/TestPostDispatchHook__factory.d.ts +1 -1
  182. package/dist/factories/contracts/test/TestPostDispatchHook__factory.js +1 -1
  183. package/dist/factories/contracts/test/TestQuerySender__factory.d.ts +1 -1
  184. package/dist/factories/contracts/test/TestQuerySender__factory.js +1 -1
  185. package/dist/factories/contracts/test/TestQuery__factory.d.ts +1 -1
  186. package/dist/factories/contracts/test/TestQuery__factory.js +1 -1
  187. package/dist/factories/contracts/test/TestRemoteChallenger__factory.d.ts +1 -1
  188. package/dist/factories/contracts/test/TestRemoteChallenger__factory.js +1 -1
  189. package/dist/factories/contracts/test/TestRouter__factory.d.ts +1 -1
  190. package/dist/factories/contracts/test/TestRouter__factory.js +1 -1
  191. package/dist/factories/contracts/test/TestSendReceiver__factory.d.ts +1 -1
  192. package/dist/factories/contracts/test/TestSendReceiver__factory.js +1 -1
  193. package/dist/factories/contracts/test/avs/TestHyperlaneServiceManager__factory.d.ts +1 -1
  194. package/dist/factories/contracts/test/avs/TestHyperlaneServiceManager__factory.js +1 -1
  195. package/dist/factories/contracts/token/HypERC20Collateral__factory.d.ts +1 -1
  196. package/dist/factories/contracts/token/HypERC20Collateral__factory.js +1 -1
  197. package/dist/factories/contracts/token/HypERC20__factory.d.ts +1 -1
  198. package/dist/factories/contracts/token/HypERC20__factory.js +1 -1
  199. package/dist/factories/contracts/token/HypERC721Collateral__factory.d.ts +1 -1
  200. package/dist/factories/contracts/token/HypERC721Collateral__factory.js +1 -1
  201. package/dist/factories/contracts/token/HypERC721__factory.d.ts +1 -1
  202. package/dist/factories/contracts/token/HypERC721__factory.js +1 -1
  203. package/dist/factories/contracts/token/HypNative__factory.d.ts +1 -1
  204. package/dist/factories/contracts/token/HypNative__factory.js +1 -1
  205. package/dist/factories/contracts/token/extensions/FastHypERC20Collateral__factory.d.ts +1 -1
  206. package/dist/factories/contracts/token/extensions/FastHypERC20Collateral__factory.js +1 -1
  207. package/dist/factories/contracts/token/extensions/FastHypERC20__factory.d.ts +1 -1
  208. package/dist/factories/contracts/token/extensions/FastHypERC20__factory.js +1 -1
  209. package/dist/factories/contracts/token/extensions/HypERC4626Collateral__factory.d.ts +1 -1
  210. package/dist/factories/contracts/token/extensions/HypERC4626Collateral__factory.js +1 -1
  211. package/dist/factories/contracts/token/extensions/HypERC4626OwnerCollateral__factory.d.ts +1 -1
  212. package/dist/factories/contracts/token/extensions/HypERC4626OwnerCollateral__factory.js +1 -1
  213. package/dist/factories/contracts/token/extensions/HypERC4626__factory.d.ts +1 -1
  214. package/dist/factories/contracts/token/extensions/HypERC4626__factory.js +1 -1
  215. package/dist/factories/contracts/token/extensions/HypERC721URICollateral__factory.d.ts +1 -1
  216. package/dist/factories/contracts/token/extensions/HypERC721URICollateral__factory.js +1 -1
  217. package/dist/factories/contracts/token/extensions/HypERC721URIStorage__factory.d.ts +1 -1
  218. package/dist/factories/contracts/token/extensions/HypERC721URIStorage__factory.js +1 -1
  219. package/dist/factories/contracts/token/extensions/HypFiatToken__factory.d.ts +1 -1
  220. package/dist/factories/contracts/token/extensions/HypFiatToken__factory.js +1 -1
  221. package/dist/factories/contracts/token/extensions/HypNativeScaled__factory.d.ts +1 -1
  222. package/dist/factories/contracts/token/extensions/HypNativeScaled__factory.js +1 -1
  223. package/dist/factories/contracts/token/extensions/HypXERC20Lockbox__factory.d.ts +1 -1
  224. package/dist/factories/contracts/token/extensions/HypXERC20Lockbox__factory.js +1 -1
  225. package/dist/factories/contracts/token/extensions/HypXERC20__factory.d.ts +1 -1
  226. package/dist/factories/contracts/token/extensions/HypXERC20__factory.js +1 -1
  227. package/dist/factories/contracts/token/extensions/WHypERC4626__factory.d.ts +1 -1
  228. package/dist/factories/contracts/token/extensions/WHypERC4626__factory.js +1 -1
  229. package/dist/factories/contracts/token/interfaces/IXERC20VS__factory.d.ts +354 -0
  230. package/dist/factories/contracts/token/interfaces/IXERC20VS__factory.d.ts.map +1 -0
  231. package/dist/factories/contracts/token/interfaces/IXERC20VS__factory.js +468 -0
  232. package/dist/factories/contracts/token/interfaces/IXERC20VS__factory.js.map +1 -0
  233. package/dist/factories/contracts/token/interfaces/index.d.ts +1 -0
  234. package/dist/factories/contracts/token/interfaces/index.d.ts.map +1 -1
  235. package/dist/factories/contracts/token/interfaces/index.js +1 -0
  236. package/dist/factories/contracts/token/interfaces/index.js.map +1 -1
  237. package/dist/index.d.ts +4 -0
  238. package/dist/index.d.ts.map +1 -1
  239. package/dist/index.js +2 -0
  240. package/dist/index.js.map +1 -1
  241. package/package.json +2 -2
@@ -7,5 +7,5 @@ pragma solidity >=0.6.11;
7
7
  **/
8
8
  abstract contract PackageVersioned {
9
9
  // GENERATED CODE - DO NOT EDIT
10
- string public constant PACKAGE_VERSION = "5.11.3";
10
+ string public constant PACKAGE_VERSION = "5.12.0";
11
11
  }
@@ -0,0 +1,22 @@
1
+ // SPDX-License-Identifier: BSD-3.0
2
+ pragma solidity >=0.8.19 <0.9.0;
3
+
4
+ /// @notice two rate storage slots per rate limit
5
+ struct RateLimitMidPoint {
6
+ //// -------------------------------------------- ////
7
+ //// ------------------ SLOT 0 ------------------ ////
8
+ //// -------------------------------------------- ////
9
+ /// @notice the rate per second for this contract
10
+ uint128 rateLimitPerSecond;
11
+ /// @notice the cap of the buffer that can be used at once
12
+ uint112 bufferCap;
13
+ //// -------------------------------------------- ////
14
+ //// ------------------ SLOT 1 ------------------ ////
15
+ //// -------------------------------------------- ////
16
+ /// @notice the last time the buffer was used by the contract
17
+ uint32 lastBufferUsedTime;
18
+ /// @notice the buffer at the timestamp of lastBufferUsedTime
19
+ uint112 bufferStored;
20
+ /// @notice the mid point of the buffer
21
+ uint112 midPoint;
22
+ }
@@ -2,9 +2,12 @@
2
2
  pragma solidity >=0.8.0;
3
3
 
4
4
  import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
5
+ import "@openzeppelin/contracts/access/Ownable.sol";
6
+ import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
5
7
 
6
8
  import "../token/interfaces/IXERC20Lockbox.sol";
7
9
  import "../token/interfaces/IXERC20.sol";
10
+ import "../token/interfaces/IXERC20VS.sol";
8
11
  import "../token/interfaces/IFiatToken.sol";
9
12
 
10
13
  contract ERC20Test is ERC20 {
@@ -55,13 +58,17 @@ contract FiatTokenTest is ERC20Test, IFiatToken {
55
58
  }
56
59
  }
57
60
 
58
- contract XERC20Test is ERC20Test, IXERC20 {
61
+ contract XERC20Test is ERC20Test, Ownable, IXERC20 {
59
62
  constructor(
60
63
  string memory name,
61
64
  string memory symbol,
62
65
  uint256 totalSupply,
63
66
  uint8 __decimals
64
- ) ERC20Test(name, symbol, totalSupply, __decimals) {}
67
+ ) ERC20Test(name, symbol, totalSupply, __decimals) Ownable() {}
68
+
69
+ function initialize() external {
70
+ _transferOwnership(msg.sender);
71
+ }
65
72
 
66
73
  function mint(address account, uint256 amount) public override {
67
74
  _mint(account, amount);
@@ -75,8 +82,8 @@ contract XERC20Test is ERC20Test, IXERC20 {
75
82
  assert(false);
76
83
  }
77
84
 
78
- function owner() external pure returns (address) {
79
- return address(0x0);
85
+ function owner() public view override(Ownable, IXERC20) returns (address) {
86
+ return Ownable.owner();
80
87
  }
81
88
 
82
89
  function burningCurrentLimitOf(
@@ -104,6 +111,151 @@ contract XERC20Test is ERC20Test, IXERC20 {
104
111
  }
105
112
  }
106
113
 
114
+ contract XERC20VSTest is ERC20Test, Ownable, IXERC20VS {
115
+ event ConfigurationChanged(
116
+ address indexed bridge,
117
+ uint112 bufferCap,
118
+ uint128 rateLimitPerSecond
119
+ );
120
+
121
+ mapping(address bridge => RateLimitMidPoint bridgeRateLimit)
122
+ internal _rateLimits;
123
+
124
+ constructor(
125
+ string memory name,
126
+ string memory symbol,
127
+ uint256 totalSupply,
128
+ uint8 __decimals
129
+ ) ERC20Test(name, symbol, totalSupply, __decimals) Ownable() {
130
+ _transferOwnership(msg.sender);
131
+ }
132
+
133
+ function initialize() external {
134
+ _transferOwnership(msg.sender);
135
+ }
136
+
137
+ function owner() public view override(Ownable) returns (address) {
138
+ return Ownable.owner();
139
+ }
140
+
141
+ function lockbox() external view override returns (address) {
142
+ return address(0);
143
+ }
144
+
145
+ function rateLimits(
146
+ address _bridge
147
+ ) external view override returns (RateLimitMidPoint memory _rateLimit) {
148
+ return _rateLimits[_bridge];
149
+ }
150
+
151
+ function mintingMaxLimitOf(
152
+ address _bridge
153
+ ) external view returns (uint256) {
154
+ return _rateLimits[_bridge].bufferCap;
155
+ }
156
+
157
+ function burningMaxLimitOf(
158
+ address _bridge
159
+ ) external view returns (uint256) {
160
+ return _rateLimits[_bridge].bufferCap;
161
+ }
162
+
163
+ function burningCurrentLimitOf(
164
+ address _bridge
165
+ ) external view returns (uint256) {
166
+ return _rateLimits[_bridge].bufferCap - _buffer(_rateLimits[_bridge]);
167
+ }
168
+
169
+ function mintingCurrentLimitOf(
170
+ address _bridge
171
+ ) external view returns (uint256) {
172
+ return _buffer(_rateLimits[_bridge]);
173
+ }
174
+
175
+ function mint(address account, uint256 amount) public override {
176
+ _mint(account, amount);
177
+ }
178
+
179
+ function burn(address account, uint256 amount) public override {
180
+ _burn(account, amount);
181
+ }
182
+
183
+ function setBufferCap(
184
+ address _bridge,
185
+ uint256 _newBufferCap
186
+ ) external override {}
187
+
188
+ function setRateLimitPerSecond(
189
+ address _bridge,
190
+ uint128 _newRateLimitPerSecond
191
+ ) external override {}
192
+
193
+ function addBridge(
194
+ RateLimitMidPointInfo memory rateLimit
195
+ ) external onlyOwner {
196
+ _rateLimits[rateLimit.bridge] = RateLimitMidPoint({
197
+ bufferCap: rateLimit.bufferCap,
198
+ lastBufferUsedTime: uint32(block.timestamp),
199
+ bufferStored: uint112(rateLimit.bufferCap / 2),
200
+ midPoint: uint112(rateLimit.bufferCap / 2),
201
+ rateLimitPerSecond: rateLimit.rateLimitPerSecond
202
+ });
203
+
204
+ emit ConfigurationChanged(
205
+ rateLimit.bridge,
206
+ rateLimit.bufferCap,
207
+ rateLimit.rateLimitPerSecond
208
+ );
209
+ }
210
+
211
+ function removeBridge(address _bridge) external override {
212
+ delete _rateLimits[_bridge];
213
+ }
214
+
215
+ function _buffer(
216
+ RateLimitMidPoint storage limit
217
+ ) internal view returns (uint256) {
218
+ uint256 elapsed;
219
+ unchecked {
220
+ elapsed = uint32(block.timestamp) - limit.lastBufferUsedTime;
221
+ }
222
+
223
+ uint256 accrued = uint256(limit.rateLimitPerSecond) * elapsed;
224
+ if (limit.bufferStored < limit.midPoint) {
225
+ return
226
+ Math.min(
227
+ uint256(limit.bufferStored) + accrued,
228
+ uint256(limit.midPoint)
229
+ );
230
+ } else if (limit.bufferStored > limit.midPoint) {
231
+ /// past midpoint so subtract accrued off bufferStored back down to midpoint
232
+
233
+ /// second part of if statement will not be evaluated if first part is true
234
+ if (
235
+ accrued > limit.bufferStored ||
236
+ limit.bufferStored - accrued < limit.midPoint
237
+ ) {
238
+ /// if accrued is more than buffer stored, subtracting will underflow,
239
+ /// and we are at the midpoint, so return that
240
+ return limit.midPoint;
241
+ } else {
242
+ return limit.bufferStored - accrued;
243
+ }
244
+ } else {
245
+ /// no change
246
+ return limit.bufferStored;
247
+ }
248
+ }
249
+
250
+ function rateLimitPerSecond(address from) public view returns (uint256) {
251
+ return _rateLimits[from].rateLimitPerSecond;
252
+ }
253
+
254
+ function bufferCap(address from) public view returns (uint256) {
255
+ return _rateLimits[from].bufferCap;
256
+ }
257
+ }
258
+
107
259
  contract XERC20LockboxTest is IXERC20Lockbox {
108
260
  IXERC20 public immutable XERC20;
109
261
  IERC20 public immutable ERC20;
@@ -0,0 +1,96 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.0;
3
+
4
+ import {RateLimitMidPoint} from "../../libs/RateLimitMidpointCommonLibrary.sol";
5
+ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
6
+
7
+ interface IXERC20VS is IERC20 {
8
+ /// @notice Emits when a limit is set
9
+ /// @param _bridge The address of the bridge we are setting the limit to
10
+ /// @param _bufferCap The updated buffer cap for the bridge
11
+ event BridgeLimitsSet(address indexed _bridge, uint256 _bufferCap);
12
+
13
+ struct RateLimitMidPointInfo {
14
+ /// @notice the buffer cap for this bridge
15
+ uint112 bufferCap;
16
+ /// @notice the rate limit per second for this bridge
17
+ uint128 rateLimitPerSecond;
18
+ /// @notice the bridge address
19
+ address bridge;
20
+ }
21
+
22
+ /// @notice The address of the lockbox contract
23
+ function lockbox() external view returns (address);
24
+
25
+ /// @notice Maps bridge address to bridge rate limits
26
+ /// @param _bridge The bridge we are viewing the limits of
27
+ /// @return _rateLimit The limits of the bridge
28
+ function rateLimits(
29
+ address _bridge
30
+ ) external view returns (RateLimitMidPoint memory _rateLimit);
31
+
32
+ /// @notice Returns the max limit of a bridge
33
+ /// @param _bridge The bridge we are viewing the limits of
34
+ /// @return _limit The limit the bridge has
35
+ function mintingMaxLimitOf(
36
+ address _bridge
37
+ ) external view returns (uint256 _limit);
38
+
39
+ /// @notice Returns the max limit of a bridge
40
+ /// @param _bridge the bridge we are viewing the limits of
41
+ /// @return _limit The limit the bridge has
42
+ function burningMaxLimitOf(
43
+ address _bridge
44
+ ) external view returns (uint256 _limit);
45
+
46
+ /// @notice Returns the current limit of a bridge
47
+ /// @param _bridge The bridge we are viewing the limits of
48
+ /// @return _limit The limit the bridge has
49
+ function mintingCurrentLimitOf(
50
+ address _bridge
51
+ ) external view returns (uint256 _limit);
52
+
53
+ /// @notice Returns the current limit of a bridge
54
+ /// @param _bridge the bridge we are viewing the limits of
55
+ /// @return _limit The limit the bridge has
56
+ function burningCurrentLimitOf(
57
+ address _bridge
58
+ ) external view returns (uint256 _limit);
59
+
60
+ /// @notice Mints tokens for a user
61
+ /// @dev Can only be called by a bridge
62
+ /// @param _user The address of the user who needs tokens minted
63
+ /// @param _amount The amount of tokens being minted
64
+ function mint(address _user, uint256 _amount) external;
65
+
66
+ /// @notice Burns tokens for a user
67
+ /// @dev Can only be called by a bridge
68
+ /// @param _user The address of the user who needs tokens burned
69
+ /// @param _amount The amount of tokens being burned
70
+ function burn(address _user, uint256 _amount) external;
71
+
72
+ /// @notice Conform to the xERC20 setLimits interface
73
+ /// @dev Can only be called if the bridge already has a buffer cap
74
+ /// @param _bridge The bridge we are setting the limits of
75
+ /// @param _newBufferCap The new buffer cap, uint112 max for unlimited
76
+ function setBufferCap(address _bridge, uint256 _newBufferCap) external;
77
+
78
+ /// @notice Sets rate limit per second for a bridge
79
+ /// @dev Can only be called if the bridge already has a buffer cap
80
+ /// @param _bridge The bridge we are setting the limits of
81
+ /// @param _newRateLimitPerSecond The new rate limit per second
82
+ function setRateLimitPerSecond(
83
+ address _bridge,
84
+ uint128 _newRateLimitPerSecond
85
+ ) external;
86
+
87
+ /// @notice Adds a new bridge to the currently active bridges
88
+ /// @param _newBridge The bridge to add
89
+ function addBridge(RateLimitMidPointInfo memory _newBridge) external;
90
+
91
+ /// @notice Removes a bridge from the currently active bridges
92
+ /// deleting its buffer stored, buffer cap, mid point and last
93
+ /// buffer used time
94
+ /// @param _bridge The bridge to remove
95
+ function removeBridge(address _bridge) external;
96
+ }