@across-protocol/contracts 0.1.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 (257) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +661 -0
  3. package/README.md +53 -0
  4. package/artifacts/@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol/IL2ERC20Bridge.dbg.json +4 -0
  5. package/artifacts/@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol/IL2ERC20Bridge.json +252 -0
  6. package/artifacts/@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol/CrossDomainEnabled.dbg.json +4 -0
  7. package/artifacts/@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol/CrossDomainEnabled.json +35 -0
  8. package/artifacts/@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol/ICrossDomainMessenger.dbg.json +4 -0
  9. package/artifacts/@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol/ICrossDomainMessenger.json +110 -0
  10. package/artifacts/@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol/Lib_PredeployAddresses.dbg.json +4 -0
  11. package/artifacts/@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol/Lib_PredeployAddresses.json +10 -0
  12. package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/AccessControl.dbg.json +4 -0
  13. package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/AccessControl.json +215 -0
  14. package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/IAccessControl.dbg.json +4 -0
  15. package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/IAccessControl.json +108 -0
  16. package/artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.dbg.json +4 -0
  17. package/artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.json +63 -0
  18. package/artifacts/@openzeppelin/contracts/security/Pausable.sol/Pausable.dbg.json +4 -0
  19. package/artifacts/@openzeppelin/contracts/security/Pausable.sol/Pausable.json +50 -0
  20. package/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +4 -0
  21. package/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json +297 -0
  22. package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +4 -0
  23. package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.json +194 -0
  24. package/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json +4 -0
  25. package/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.json +233 -0
  26. package/artifacts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.dbg.json +4 -0
  27. package/artifacts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.json +10 -0
  28. package/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json +4 -0
  29. package/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.json +10 -0
  30. package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +4 -0
  31. package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.json +10 -0
  32. package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json +4 -0
  33. package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.json +10 -0
  34. package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.dbg.json +4 -0
  35. package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.json +30 -0
  36. package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.dbg.json +4 -0
  37. package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.json +30 -0
  38. package/artifacts/@openzeppelin/contracts/utils/math/SafeMath.sol/SafeMath.dbg.json +4 -0
  39. package/artifacts/@openzeppelin/contracts/utils/math/SafeMath.sol/SafeMath.json +10 -0
  40. package/artifacts/@openzeppelin/contracts/utils/math/SignedSafeMath.sol/SignedSafeMath.dbg.json +4 -0
  41. package/artifacts/@openzeppelin/contracts/utils/math/SignedSafeMath.sol/SignedSafeMath.json +10 -0
  42. package/artifacts/@uma/core/contracts/common/implementation/Lockable.sol/Lockable.dbg.json +4 -0
  43. package/artifacts/@uma/core/contracts/common/implementation/Lockable.sol/Lockable.json +16 -0
  44. package/artifacts/@uma/core/contracts/cross-chain-oracle/chain-adapters/Arbitrum_ParentMessenger.sol/Arbitrum_ParentMessenger.dbg.json +4 -0
  45. package/artifacts/@uma/core/contracts/cross-chain-oracle/chain-adapters/Arbitrum_ParentMessenger.sol/Arbitrum_ParentMessenger.json +611 -0
  46. package/artifacts/@uma/core/contracts/cross-chain-oracle/chain-adapters/ParentMessengerBase.sol/ParentMessengerBase.dbg.json +4 -0
  47. package/artifacts/@uma/core/contracts/cross-chain-oracle/chain-adapters/ParentMessengerBase.sol/ParentMessengerBase.json +297 -0
  48. package/artifacts/@uma/core/contracts/cross-chain-oracle/interfaces/ParentMessengerConsumerInterface.sol/ParentMessengerConsumerInterface.dbg.json +4 -0
  49. package/artifacts/@uma/core/contracts/cross-chain-oracle/interfaces/ParentMessengerConsumerInterface.sol/ParentMessengerConsumerInterface.json +29 -0
  50. package/artifacts/@uma/core/contracts/cross-chain-oracle/interfaces/ParentMessengerInterface.sol/ParentMessengerInterface.dbg.json +4 -0
  51. package/artifacts/@uma/core/contracts/cross-chain-oracle/interfaces/ParentMessengerInterface.sol/ParentMessengerInterface.json +37 -0
  52. package/artifacts/@uma/core/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/IBridge.dbg.json +4 -0
  53. package/artifacts/@uma/core/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/IBridge.json +24 -0
  54. package/artifacts/@uma/core/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/iArbitrum_Inbox.dbg.json +4 -0
  55. package/artifacts/@uma/core/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/iArbitrum_Inbox.json +78 -0
  56. package/artifacts/@uma/core/contracts/external/avm/interfaces/iArbitrum_Outbox.sol/iArbitrum_Outbox.dbg.json +4 -0
  57. package/artifacts/@uma/core/contracts/external/avm/interfaces/iArbitrum_Outbox.sol/iArbitrum_Outbox.json +24 -0
  58. package/artifacts/@uma/core/contracts/insured-bridge/avm/Arbitrum_CrossDomainEnabled.sol/Arbitrum_CrossDomainEnabled.dbg.json +4 -0
  59. package/artifacts/@uma/core/contracts/insured-bridge/avm/Arbitrum_CrossDomainEnabled.sol/Arbitrum_CrossDomainEnabled.json +24 -0
  60. package/artifacts/build-info/1cd64db7a8ac0a153df93d26826ad4e9.json +1653 -0
  61. package/artifacts/build-info/1f738b56edd7602183f2f8d2f23f6e90.json +1592 -0
  62. package/artifacts/build-info/343b9221be36acd9ddaca3f3b83d2e75.json +3943 -0
  63. package/artifacts/build-info/622e561692c193f4cd0ff989b5a231e2.json +5661 -0
  64. package/artifacts/build-info/8e408b49e0ff2873bc28d45221a7ff71.json +277715 -0
  65. package/artifacts/build-info/9d1a3182633612bd337d811d567d5d60.json +2072 -0
  66. package/artifacts/build-info/a8cd9c443d245fe513d6650634b60f93.json +23776 -0
  67. package/artifacts/build-info/d302d9d63fbafb5c8d635cc62cb1cc7c.json +167529 -0
  68. package/artifacts/contracts/common/implementation/AncillaryData.sol/AncillaryData.dbg.json +4 -0
  69. package/artifacts/contracts/common/implementation/AncillaryData.sol/AncillaryData.json +10 -0
  70. package/artifacts/contracts/common/implementation/FixedPoint.sol/FixedPoint.dbg.json +4 -0
  71. package/artifacts/contracts/common/implementation/FixedPoint.sol/FixedPoint.json +10 -0
  72. package/artifacts/contracts/common/implementation/Lockable.sol/Lockable.dbg.json +4 -0
  73. package/artifacts/contracts/common/implementation/Lockable.sol/Lockable.json +16 -0
  74. package/artifacts/contracts/common/implementation/MultiCaller.sol/MultiCaller.dbg.json +4 -0
  75. package/artifacts/contracts/common/implementation/MultiCaller.sol/MultiCaller.json +30 -0
  76. package/artifacts/contracts/common/implementation/Testable.sol/Testable.dbg.json +4 -0
  77. package/artifacts/contracts/common/implementation/Testable.sol/Testable.json +50 -0
  78. package/artifacts/contracts/common/implementation/Timer.sol/Timer.dbg.json +4 -0
  79. package/artifacts/contracts/common/implementation/Timer.sol/Timer.json +42 -0
  80. package/artifacts/contracts/common/interfaces/AddressWhitelistInterface.sol/AddressWhitelistInterface.dbg.json +4 -0
  81. package/artifacts/contracts/common/interfaces/AddressWhitelistInterface.sol/AddressWhitelistInterface.json +69 -0
  82. package/artifacts/contracts/external/avm/AVM_CrossDomainEnabled.sol/AVM_CrossDomainEnabled.dbg.json +4 -0
  83. package/artifacts/contracts/external/avm/AVM_CrossDomainEnabled.sol/AVM_CrossDomainEnabled.json +42 -0
  84. package/artifacts/contracts/external/avm/interfaces/ArbSys.sol/ArbSys.dbg.json +4 -0
  85. package/artifacts/contracts/external/avm/interfaces/ArbSys.sol/ArbSys.json +235 -0
  86. package/artifacts/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/IBridge.dbg.json +4 -0
  87. package/artifacts/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/IBridge.json +24 -0
  88. package/artifacts/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/iArbitrum_Inbox.dbg.json +4 -0
  89. package/artifacts/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/iArbitrum_Inbox.json +78 -0
  90. package/artifacts/contracts/external/avm/interfaces/iArbitrum_Outbox.sol/iArbitrum_Outbox.dbg.json +4 -0
  91. package/artifacts/contracts/external/avm/interfaces/iArbitrum_Outbox.sol/iArbitrum_Outbox.json +24 -0
  92. package/artifacts/contracts/external/chainbridge/Bridge.sol/Bridge.dbg.json +4 -0
  93. package/artifacts/contracts/external/chainbridge/Bridge.sol/Bridge.json +1019 -0
  94. package/artifacts/contracts/external/chainbridge/handlers/GenericHandler.sol/GenericHandler.dbg.json +4 -0
  95. package/artifacts/contracts/external/chainbridge/handlers/GenericHandler.sol/GenericHandler.json +314 -0
  96. package/artifacts/contracts/external/chainbridge/interfaces/IBridge.sol/IBridge.dbg.json +4 -0
  97. package/artifacts/contracts/external/chainbridge/interfaces/IBridge.sol/IBridge.json +47 -0
  98. package/artifacts/contracts/external/chainbridge/interfaces/IDepositExecute.sol/IDepositExecute.dbg.json +4 -0
  99. package/artifacts/contracts/external/chainbridge/interfaces/IDepositExecute.sol/IDepositExecute.json +62 -0
  100. package/artifacts/contracts/external/chainbridge/interfaces/IERCHandler.sol/IERCHandler.dbg.json +4 -0
  101. package/artifacts/contracts/external/chainbridge/interfaces/IERCHandler.sol/IERCHandler.json +65 -0
  102. package/artifacts/contracts/external/chainbridge/interfaces/IGenericHandler.sol/IGenericHandler.dbg.json +4 -0
  103. package/artifacts/contracts/external/chainbridge/interfaces/IGenericHandler.sol/IGenericHandler.json +39 -0
  104. package/artifacts/contracts/external/ovm/OVM_CrossDomainEnabled.sol/OVM_CrossDomainEnabled.dbg.json +4 -0
  105. package/artifacts/contracts/external/ovm/OVM_CrossDomainEnabled.sol/OVM_CrossDomainEnabled.json +35 -0
  106. package/artifacts/contracts/external/ovm/OVM_CrossDomainEnabled.sol/iOVM_CrossDomainMessenger.dbg.json +4 -0
  107. package/artifacts/contracts/external/ovm/OVM_CrossDomainEnabled.sol/iOVM_CrossDomainMessenger.json +86 -0
  108. package/artifacts/contracts/external/polygon/lib/Merkle.sol/Merkle.dbg.json +4 -0
  109. package/artifacts/contracts/external/polygon/lib/Merkle.sol/Merkle.json +10 -0
  110. package/artifacts/contracts/external/polygon/lib/MerklePatriciaProof.sol/MerklePatriciaProof.dbg.json +4 -0
  111. package/artifacts/contracts/external/polygon/lib/MerklePatriciaProof.sol/MerklePatriciaProof.json +10 -0
  112. package/artifacts/contracts/external/polygon/lib/RLPReader.sol/RLPReader.dbg.json +4 -0
  113. package/artifacts/contracts/external/polygon/lib/RLPReader.sol/RLPReader.json +10 -0
  114. package/artifacts/contracts/external/polygon/test/FxChildMock.sol/FxChildMock.dbg.json +4 -0
  115. package/artifacts/contracts/external/polygon/test/FxChildMock.sol/FxChildMock.json +104 -0
  116. package/artifacts/contracts/external/polygon/test/FxChildMock.sol/IFxMessageProcessor.dbg.json +4 -0
  117. package/artifacts/contracts/external/polygon/test/FxChildMock.sol/IFxMessageProcessor.json +34 -0
  118. package/artifacts/contracts/external/polygon/test/FxChildMock.sol/IStateReceiver.dbg.json +4 -0
  119. package/artifacts/contracts/external/polygon/test/FxChildMock.sol/IStateReceiver.json +29 -0
  120. package/artifacts/contracts/external/polygon/test/FxRootMock.sol/FxRootMock.dbg.json +4 -0
  121. package/artifacts/contracts/external/polygon/test/FxRootMock.sol/FxRootMock.json +79 -0
  122. package/artifacts/contracts/external/polygon/test/FxRootMock.sol/IFxStateSender.dbg.json +4 -0
  123. package/artifacts/contracts/external/polygon/test/FxRootMock.sol/IFxStateSender.json +29 -0
  124. package/artifacts/contracts/external/polygon/test/FxRootMock.sol/IStateSender.dbg.json +4 -0
  125. package/artifacts/contracts/external/polygon/test/FxRootMock.sol/IStateSender.json +29 -0
  126. package/artifacts/contracts/external/polygon/test/StateSyncMock.sol/StateSyncMock.dbg.json +4 -0
  127. package/artifacts/contracts/external/polygon/test/StateSyncMock.sol/StateSyncMock.json +54 -0
  128. package/artifacts/contracts/external/polygon/tunnel/FxBaseChildTunnel.sol/FxBaseChildTunnel.dbg.json +4 -0
  129. package/artifacts/contracts/external/polygon/tunnel/FxBaseChildTunnel.sol/FxBaseChildTunnel.json +86 -0
  130. package/artifacts/contracts/external/polygon/tunnel/FxBaseChildTunnel.sol/IFxMessageProcessor.dbg.json +4 -0
  131. package/artifacts/contracts/external/polygon/tunnel/FxBaseChildTunnel.sol/IFxMessageProcessor.json +34 -0
  132. package/artifacts/contracts/external/polygon/tunnel/FxBaseRootTunnel.sol/FxBaseRootTunnel.dbg.json +4 -0
  133. package/artifacts/contracts/external/polygon/tunnel/FxBaseRootTunnel.sol/FxBaseRootTunnel.json +108 -0
  134. package/artifacts/contracts/external/polygon/tunnel/FxBaseRootTunnel.sol/ICheckpointManager.dbg.json +4 -0
  135. package/artifacts/contracts/external/polygon/tunnel/FxBaseRootTunnel.sol/ICheckpointManager.json +50 -0
  136. package/artifacts/contracts/external/polygon/tunnel/FxBaseRootTunnel.sol/IFxStateSender.dbg.json +4 -0
  137. package/artifacts/contracts/external/polygon/tunnel/FxBaseRootTunnel.sol/IFxStateSender.json +29 -0
  138. package/artifacts/contracts/insured-bridge/BridgeAdmin.sol/BridgeAdmin.dbg.json +4 -0
  139. package/artifacts/contracts/insured-bridge/BridgeAdmin.sol/BridgeAdmin.json +662 -0
  140. package/artifacts/contracts/insured-bridge/BridgeDepositBox.sol/BridgeDepositBox.dbg.json +4 -0
  141. package/artifacts/contracts/insured-bridge/BridgeDepositBox.sol/BridgeDepositBox.json +391 -0
  142. package/artifacts/contracts/insured-bridge/BridgeDepositBox.sol/TokenLike.dbg.json +4 -0
  143. package/artifacts/contracts/insured-bridge/BridgeDepositBox.sol/TokenLike.json +30 -0
  144. package/artifacts/contracts/insured-bridge/BridgeDepositBox.sol/WETH9Like.dbg.json +4 -0
  145. package/artifacts/contracts/insured-bridge/BridgeDepositBox.sol/WETH9Like.json +31 -0
  146. package/artifacts/contracts/insured-bridge/BridgePool.sol/BridgePool.dbg.json +4 -0
  147. package/artifacts/contracts/insured-bridge/BridgePool.sol/BridgePool.json +1709 -0
  148. package/artifacts/contracts/insured-bridge/BridgePool.sol/BridgePoolProd.dbg.json +4 -0
  149. package/artifacts/contracts/insured-bridge/BridgePool.sol/BridgePoolProd.json +1709 -0
  150. package/artifacts/contracts/insured-bridge/BridgePool.sol/WETH9Like.dbg.json +4 -0
  151. package/artifacts/contracts/insured-bridge/BridgePool.sol/WETH9Like.json +31 -0
  152. package/artifacts/contracts/insured-bridge/avm/AVM_BridgeDepositBox.sol/AVM_BridgeDepositBox.dbg.json +4 -0
  153. package/artifacts/contracts/insured-bridge/avm/AVM_BridgeDepositBox.sol/AVM_BridgeDepositBox.json +564 -0
  154. package/artifacts/contracts/insured-bridge/avm/AVM_BridgeDepositBox.sol/StandardBridgeLike.dbg.json +4 -0
  155. package/artifacts/contracts/insured-bridge/avm/AVM_BridgeDepositBox.sol/StandardBridgeLike.json +45 -0
  156. package/artifacts/contracts/insured-bridge/avm/Arbitrum_CrossDomainEnabled.sol/Arbitrum_CrossDomainEnabled.dbg.json +4 -0
  157. package/artifacts/contracts/insured-bridge/avm/Arbitrum_CrossDomainEnabled.sol/Arbitrum_CrossDomainEnabled.json +24 -0
  158. package/artifacts/contracts/insured-bridge/avm/Arbitrum_Messenger.sol/Arbitrum_Messenger.dbg.json +4 -0
  159. package/artifacts/contracts/insured-bridge/avm/Arbitrum_Messenger.sol/Arbitrum_Messenger.json +191 -0
  160. package/artifacts/contracts/insured-bridge/interfaces/BridgeAdminInterface.sol/BridgeAdminInterface.dbg.json +4 -0
  161. package/artifacts/contracts/insured-bridge/interfaces/BridgeAdminInterface.sol/BridgeAdminInterface.json +319 -0
  162. package/artifacts/contracts/insured-bridge/interfaces/BridgePoolInterface.sol/BridgePoolInterface.dbg.json +4 -0
  163. package/artifacts/contracts/insured-bridge/interfaces/BridgePoolInterface.sol/BridgePoolInterface.json +63 -0
  164. package/artifacts/contracts/insured-bridge/interfaces/MessengerInterface.sol/MessengerInterface.dbg.json +4 -0
  165. package/artifacts/contracts/insured-bridge/interfaces/MessengerInterface.sol/MessengerInterface.json +54 -0
  166. package/artifacts/contracts/insured-bridge/ovm/OVM_BridgeDepositBox.sol/OVM_BridgeDepositBox.dbg.json +4 -0
  167. package/artifacts/contracts/insured-bridge/ovm/OVM_BridgeDepositBox.sol/OVM_BridgeDepositBox.json +528 -0
  168. package/artifacts/contracts/insured-bridge/ovm/OVM_CrossDomainEnabled.sol/OVM_CrossDomainEnabled.dbg.json +4 -0
  169. package/artifacts/contracts/insured-bridge/ovm/OVM_CrossDomainEnabled.sol/OVM_CrossDomainEnabled.json +35 -0
  170. package/artifacts/contracts/insured-bridge/ovm/OVM_OETH_BridgeDepositBox.sol/OVM_OETH_BridgeDepositBox.dbg.json +4 -0
  171. package/artifacts/contracts/insured-bridge/ovm/OVM_OETH_BridgeDepositBox.sol/OVM_OETH_BridgeDepositBox.json +572 -0
  172. package/artifacts/contracts/insured-bridge/ovm/Optimism_Messenger.sol/Optimism_Messenger.dbg.json +4 -0
  173. package/artifacts/contracts/insured-bridge/ovm/Optimism_Messenger.sol/Optimism_Messenger.json +130 -0
  174. package/artifacts/contracts/insured-bridge/ovm/Optimism_Wrapper.sol/Optimism_Wrapper.dbg.json +4 -0
  175. package/artifacts/contracts/insured-bridge/ovm/Optimism_Wrapper.sol/Optimism_Wrapper.json +142 -0
  176. package/artifacts/contracts/insured-bridge/ovm/Optimism_Wrapper.sol/WETH9Like.dbg.json +4 -0
  177. package/artifacts/contracts/insured-bridge/ovm/Optimism_Wrapper.sol/WETH9Like.json +55 -0
  178. package/artifacts/contracts/insured-bridge/ovm/iOVM_CrossDomainMessenger.sol/iOVM_CrossDomainMessenger.dbg.json +4 -0
  179. package/artifacts/contracts/insured-bridge/ovm/iOVM_CrossDomainMessenger.sol/iOVM_CrossDomainMessenger.json +86 -0
  180. package/artifacts/contracts/insured-bridge/test/Arbitrum_InboxMock.sol/Arbitrum_BridgeMock.dbg.json +4 -0
  181. package/artifacts/contracts/insured-bridge/test/Arbitrum_InboxMock.sol/Arbitrum_BridgeMock.json +68 -0
  182. package/artifacts/contracts/insured-bridge/test/Arbitrum_InboxMock.sol/Arbitrum_InboxMock.dbg.json +4 -0
  183. package/artifacts/contracts/insured-bridge/test/Arbitrum_InboxMock.sol/Arbitrum_InboxMock.json +78 -0
  184. package/artifacts/contracts/insured-bridge/test/Arbitrum_InboxMock.sol/Arbitrum_OutboxMock.dbg.json +4 -0
  185. package/artifacts/contracts/insured-bridge/test/Arbitrum_InboxMock.sol/Arbitrum_OutboxMock.json +24 -0
  186. package/artifacts/contracts/insured-bridge/test/BridgeDepositBoxMock.sol/BridgeDepositBoxMock.dbg.json +4 -0
  187. package/artifacts/contracts/insured-bridge/test/BridgeDepositBoxMock.sol/BridgeDepositBoxMock.json +510 -0
  188. package/artifacts/contracts/insured-bridge/test/MessengerMock.sol/MessengerMock.dbg.json +4 -0
  189. package/artifacts/contracts/insured-bridge/test/MessengerMock.sol/MessengerMock.json +85 -0
  190. package/artifacts/contracts/insured-bridge/test/OVM_L1CrossDomainMessengerMock.sol/OVM_L1CrossDomainMessengerMock.dbg.json +4 -0
  191. package/artifacts/contracts/insured-bridge/test/OVM_L1CrossDomainMessengerMock.sol/OVM_L1CrossDomainMessengerMock.json +110 -0
  192. package/artifacts/contracts/oracle/implementation/Constants.sol/OptimisticOracleConstraints.dbg.json +4 -0
  193. package/artifacts/contracts/oracle/implementation/Constants.sol/OptimisticOracleConstraints.json +24 -0
  194. package/artifacts/contracts/oracle/implementation/Constants.sol/OracleInterfaces.dbg.json +4 -0
  195. package/artifacts/contracts/oracle/implementation/Constants.sol/OracleInterfaces.json +141 -0
  196. package/artifacts/contracts/oracle/interfaces/FinderInterface.sol/FinderInterface.dbg.json +4 -0
  197. package/artifacts/contracts/oracle/interfaces/FinderInterface.sol/FinderInterface.json +48 -0
  198. package/artifacts/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol/IdentifierWhitelistInterface.dbg.json +4 -0
  199. package/artifacts/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol/IdentifierWhitelistInterface.json +56 -0
  200. package/artifacts/contracts/oracle/interfaces/OptimisticOracleInterface.sol/OptimisticOracleInterface.dbg.json +4 -0
  201. package/artifacts/contracts/oracle/interfaces/OptimisticOracleInterface.sol/OptimisticOracleInterface.json +555 -0
  202. package/artifacts/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol/SkinnyOptimisticOracleInterface.dbg.json +4 -0
  203. package/artifacts/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol/SkinnyOptimisticOracleInterface.json +853 -0
  204. package/artifacts/contracts/oracle/interfaces/StoreInterface.sol/StoreInterface.dbg.json +4 -0
  205. package/artifacts/contracts/oracle/interfaces/StoreInterface.sol/StoreInterface.json +124 -0
  206. package/contracts/common/implementation/AncillaryData.sol +144 -0
  207. package/contracts/common/implementation/FixedPoint.sol +763 -0
  208. package/contracts/common/implementation/Lockable.sol +61 -0
  209. package/contracts/common/implementation/MultiCaller.sol +27 -0
  210. package/contracts/common/implementation/Testable.sol +52 -0
  211. package/contracts/common/implementation/Timer.sol +30 -0
  212. package/contracts/common/interfaces/AddressWhitelistInterface.sol +12 -0
  213. package/contracts/external/avm/AVM_CrossDomainEnabled.sol +43 -0
  214. package/contracts/external/avm/interfaces/ArbSys.sol +79 -0
  215. package/contracts/external/avm/interfaces/iArbitrum_Inbox.sol +28 -0
  216. package/contracts/external/avm/interfaces/iArbitrum_Outbox.sol +26 -0
  217. package/contracts/external/chainbridge/Bridge.sol +454 -0
  218. package/contracts/external/chainbridge/handlers/GenericHandler.sol +237 -0
  219. package/contracts/external/chainbridge/interfaces/IBridge.sol +20 -0
  220. package/contracts/external/chainbridge/interfaces/IDepositExecute.sol +29 -0
  221. package/contracts/external/chainbridge/interfaces/IERCHandler.sol +33 -0
  222. package/contracts/external/chainbridge/interfaces/IGenericHandler.sol +23 -0
  223. package/contracts/external/ovm/OVM_CrossDomainEnabled.sol +114 -0
  224. package/contracts/external/polygon/lib/Merkle.sol +36 -0
  225. package/contracts/external/polygon/lib/MerklePatriciaProof.sol +139 -0
  226. package/contracts/external/polygon/lib/RLPReader.sol +251 -0
  227. package/contracts/external/polygon/test/FxChildMock.sol +42 -0
  228. package/contracts/external/polygon/test/FxRootMock.sol +32 -0
  229. package/contracts/external/polygon/test/StateSyncMock.sol +26 -0
  230. package/contracts/external/polygon/tunnel/FxBaseChildTunnel.sol +80 -0
  231. package/contracts/external/polygon/tunnel/FxBaseRootTunnel.sol +185 -0
  232. package/contracts/insured-bridge/BridgeAdmin.sol +394 -0
  233. package/contracts/insured-bridge/BridgeDepositBox.sol +245 -0
  234. package/contracts/insured-bridge/BridgePool.sol +980 -0
  235. package/contracts/insured-bridge/avm/AVM_BridgeDepositBox.sol +144 -0
  236. package/contracts/insured-bridge/avm/Arbitrum_CrossDomainEnabled.sol +67 -0
  237. package/contracts/insured-bridge/avm/Arbitrum_Messenger.sol +72 -0
  238. package/contracts/insured-bridge/interfaces/BridgeAdminInterface.sol +44 -0
  239. package/contracts/insured-bridge/interfaces/BridgePoolInterface.sol +14 -0
  240. package/contracts/insured-bridge/interfaces/MessengerInterface.sol +18 -0
  241. package/contracts/insured-bridge/ovm/OVM_BridgeDepositBox.sol +135 -0
  242. package/contracts/insured-bridge/ovm/OVM_CrossDomainEnabled.sol +84 -0
  243. package/contracts/insured-bridge/ovm/OVM_OETH_BridgeDepositBox.sol +89 -0
  244. package/contracts/insured-bridge/ovm/Optimism_Messenger.sol +34 -0
  245. package/contracts/insured-bridge/ovm/Optimism_Wrapper.sol +59 -0
  246. package/contracts/insured-bridge/ovm/iOVM_CrossDomainMessenger.sol +41 -0
  247. package/contracts/insured-bridge/test/Arbitrum_InboxMock.sol +50 -0
  248. package/contracts/insured-bridge/test/BridgeDepositBoxMock.sol +113 -0
  249. package/contracts/insured-bridge/test/MessengerMock.sol +32 -0
  250. package/contracts/insured-bridge/test/OVM_L1CrossDomainMessengerMock.sol +16 -0
  251. package/contracts/oracle/implementation/Constants.sol +29 -0
  252. package/contracts/oracle/interfaces/FinderInterface.sol +22 -0
  253. package/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol +28 -0
  254. package/contracts/oracle/interfaces/OptimisticOracleInterface.sol +263 -0
  255. package/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol +251 -0
  256. package/contracts/oracle/interfaces/StoreInterface.sol +46 -0
  257. package/package.json +60 -0
@@ -0,0 +1,263 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ pragma solidity ^0.8.0;
3
+
4
+ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
5
+
6
+ /**
7
+ * @title Financial contract facing Oracle interface.
8
+ * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.
9
+ */
10
+ abstract contract OptimisticOracleInterface {
11
+ // Struct representing the state of a price request.
12
+ enum State {
13
+ Invalid, // Never requested.
14
+ Requested, // Requested, no other actions taken.
15
+ Proposed, // Proposed, but not expired or disputed yet.
16
+ Expired, // Proposed, not disputed, past liveness.
17
+ Disputed, // Disputed, but no DVM price returned yet.
18
+ Resolved, // Disputed and DVM price is available.
19
+ Settled // Final price has been set in the contract (can get here from Expired or Resolved).
20
+ }
21
+
22
+ // Struct representing a price request.
23
+ struct Request {
24
+ address proposer; // Address of the proposer.
25
+ address disputer; // Address of the disputer.
26
+ IERC20 currency; // ERC20 token used to pay rewards and fees.
27
+ bool settled; // True if the request is settled.
28
+ bool refundOnDispute; // True if the requester should be refunded their reward on dispute.
29
+ int256 proposedPrice; // Price that the proposer submitted.
30
+ int256 resolvedPrice; // Price resolved once the request is settled.
31
+ uint256 expirationTime; // Time at which the request auto-settles without a dispute.
32
+ uint256 reward; // Amount of the currency to pay to the proposer on settlement.
33
+ uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.
34
+ uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.
35
+ uint256 customLiveness; // Custom liveness value set by the requester.
36
+ }
37
+
38
+ // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible
39
+ // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses
40
+ // to accept a price request made with ancillary data length over a certain size.
41
+ uint256 public constant ancillaryBytesLimit = 8192;
42
+
43
+ /**
44
+ * @notice Requests a new price.
45
+ * @param identifier price identifier being requested.
46
+ * @param timestamp timestamp of the price being requested.
47
+ * @param ancillaryData ancillary data representing additional args being passed with the price request.
48
+ * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.
49
+ * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,
50
+ * which could make sense if the contract requests and proposes the value in the same call or
51
+ * provides its own reward system.
52
+ * @return totalBond default bond (final fee) + final fee that the proposer and disputer will be required to pay.
53
+ * This can be changed with a subsequent call to setBond().
54
+ */
55
+ function requestPrice(
56
+ bytes32 identifier,
57
+ uint256 timestamp,
58
+ bytes memory ancillaryData,
59
+ IERC20 currency,
60
+ uint256 reward
61
+ ) external virtual returns (uint256 totalBond);
62
+
63
+ /**
64
+ * @notice Set the proposal bond associated with a price request.
65
+ * @param identifier price identifier to identify the existing request.
66
+ * @param timestamp timestamp to identify the existing request.
67
+ * @param ancillaryData ancillary data of the price being requested.
68
+ * @param bond custom bond amount to set.
69
+ * @return totalBond new bond + final fee that the proposer and disputer will be required to pay. This can be
70
+ * changed again with a subsequent call to setBond().
71
+ */
72
+ function setBond(
73
+ bytes32 identifier,
74
+ uint256 timestamp,
75
+ bytes memory ancillaryData,
76
+ uint256 bond
77
+ ) external virtual returns (uint256 totalBond);
78
+
79
+ /**
80
+ * @notice Sets the request to refund the reward if the proposal is disputed. This can help to "hedge" the caller
81
+ * in the event of a dispute-caused delay. Note: in the event of a dispute, the winner still receives the other's
82
+ * bond, so there is still profit to be made even if the reward is refunded.
83
+ * @param identifier price identifier to identify the existing request.
84
+ * @param timestamp timestamp to identify the existing request.
85
+ * @param ancillaryData ancillary data of the price being requested.
86
+ */
87
+ function setRefundOnDispute(
88
+ bytes32 identifier,
89
+ uint256 timestamp,
90
+ bytes memory ancillaryData
91
+ ) external virtual;
92
+
93
+ /**
94
+ * @notice Sets a custom liveness value for the request. Liveness is the amount of time a proposal must wait before
95
+ * being auto-resolved.
96
+ * @param identifier price identifier to identify the existing request.
97
+ * @param timestamp timestamp to identify the existing request.
98
+ * @param ancillaryData ancillary data of the price being requested.
99
+ * @param customLiveness new custom liveness.
100
+ */
101
+ function setCustomLiveness(
102
+ bytes32 identifier,
103
+ uint256 timestamp,
104
+ bytes memory ancillaryData,
105
+ uint256 customLiveness
106
+ ) external virtual;
107
+
108
+ /**
109
+ * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come
110
+ * from this proposal. However, any bonds are pulled from the caller.
111
+ * @param proposer address to set as the proposer.
112
+ * @param requester sender of the initial price request.
113
+ * @param identifier price identifier to identify the existing request.
114
+ * @param timestamp timestamp to identify the existing request.
115
+ * @param ancillaryData ancillary data of the price being requested.
116
+ * @param proposedPrice price being proposed.
117
+ * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
118
+ * the proposer once settled if the proposal is correct.
119
+ */
120
+ function proposePriceFor(
121
+ address proposer,
122
+ address requester,
123
+ bytes32 identifier,
124
+ uint256 timestamp,
125
+ bytes memory ancillaryData,
126
+ int256 proposedPrice
127
+ ) public virtual returns (uint256 totalBond);
128
+
129
+ /**
130
+ * @notice Proposes a price value for an existing price request.
131
+ * @param requester sender of the initial price request.
132
+ * @param identifier price identifier to identify the existing request.
133
+ * @param timestamp timestamp to identify the existing request.
134
+ * @param ancillaryData ancillary data of the price being requested.
135
+ * @param proposedPrice price being proposed.
136
+ * @return totalBond the amount that's pulled from the proposer's wallet as a bond. The bond will be returned to
137
+ * the proposer once settled if the proposal is correct.
138
+ */
139
+ function proposePrice(
140
+ address requester,
141
+ bytes32 identifier,
142
+ uint256 timestamp,
143
+ bytes memory ancillaryData,
144
+ int256 proposedPrice
145
+ ) external virtual returns (uint256 totalBond);
146
+
147
+ /**
148
+ * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will
149
+ * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.
150
+ * @param disputer address to set as the disputer.
151
+ * @param requester sender of the initial price request.
152
+ * @param identifier price identifier to identify the existing request.
153
+ * @param timestamp timestamp to identify the existing request.
154
+ * @param ancillaryData ancillary data of the price being requested.
155
+ * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
156
+ * the disputer once settled if the dispute was value (the proposal was incorrect).
157
+ */
158
+ function disputePriceFor(
159
+ address disputer,
160
+ address requester,
161
+ bytes32 identifier,
162
+ uint256 timestamp,
163
+ bytes memory ancillaryData
164
+ ) public virtual returns (uint256 totalBond);
165
+
166
+ /**
167
+ * @notice Disputes a price value for an existing price request with an active proposal.
168
+ * @param requester sender of the initial price request.
169
+ * @param identifier price identifier to identify the existing request.
170
+ * @param timestamp timestamp to identify the existing request.
171
+ * @param ancillaryData ancillary data of the price being requested.
172
+ * @return totalBond the amount that's pulled from the disputer's wallet as a bond. The bond will be returned to
173
+ * the disputer once settled if the dispute was valid (the proposal was incorrect).
174
+ */
175
+ function disputePrice(
176
+ address requester,
177
+ bytes32 identifier,
178
+ uint256 timestamp,
179
+ bytes memory ancillaryData
180
+ ) external virtual returns (uint256 totalBond);
181
+
182
+ /**
183
+ * @notice Retrieves a price that was previously requested by a caller. Reverts if the request is not settled
184
+ * or settleable. Note: this method is not view so that this call may actually settle the price request if it
185
+ * hasn't been settled.
186
+ * @param identifier price identifier to identify the existing request.
187
+ * @param timestamp timestamp to identify the existing request.
188
+ * @param ancillaryData ancillary data of the price being requested.
189
+ * @return resolved price.
190
+ */
191
+ function settleAndGetPrice(
192
+ bytes32 identifier,
193
+ uint256 timestamp,
194
+ bytes memory ancillaryData
195
+ ) external virtual returns (int256);
196
+
197
+ /**
198
+ * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.
199
+ * @param requester sender of the initial price request.
200
+ * @param identifier price identifier to identify the existing request.
201
+ * @param timestamp timestamp to identify the existing request.
202
+ * @param ancillaryData ancillary data of the price being requested.
203
+ * @return payout the amount that the "winner" (proposer or disputer) receives on settlement. This amount includes
204
+ * the returned bonds as well as additional rewards.
205
+ */
206
+ function settle(
207
+ address requester,
208
+ bytes32 identifier,
209
+ uint256 timestamp,
210
+ bytes memory ancillaryData
211
+ ) external virtual returns (uint256 payout);
212
+
213
+ /**
214
+ * @notice Gets the current data structure containing all information about a price request.
215
+ * @param requester sender of the initial price request.
216
+ * @param identifier price identifier to identify the existing request.
217
+ * @param timestamp timestamp to identify the existing request.
218
+ * @param ancillaryData ancillary data of the price being requested.
219
+ * @return the Request data structure.
220
+ */
221
+ function getRequest(
222
+ address requester,
223
+ bytes32 identifier,
224
+ uint256 timestamp,
225
+ bytes memory ancillaryData
226
+ ) public view virtual returns (Request memory);
227
+
228
+ /**
229
+ * @notice Returns the state of a price request.
230
+ * @param requester sender of the initial price request.
231
+ * @param identifier price identifier to identify the existing request.
232
+ * @param timestamp timestamp to identify the existing request.
233
+ * @param ancillaryData ancillary data of the price being requested.
234
+ * @return the State enum value.
235
+ */
236
+ function getState(
237
+ address requester,
238
+ bytes32 identifier,
239
+ uint256 timestamp,
240
+ bytes memory ancillaryData
241
+ ) public view virtual returns (State);
242
+
243
+ /**
244
+ * @notice Checks if a given request has resolved or been settled (i.e the optimistic oracle has a price).
245
+ * @param requester sender of the initial price request.
246
+ * @param identifier price identifier to identify the existing request.
247
+ * @param timestamp timestamp to identify the existing request.
248
+ * @param ancillaryData ancillary data of the price being requested.
249
+ * @return true if price has resolved or settled, false otherwise.
250
+ */
251
+ function hasPrice(
252
+ address requester,
253
+ bytes32 identifier,
254
+ uint256 timestamp,
255
+ bytes memory ancillaryData
256
+ ) public view virtual returns (bool);
257
+
258
+ function stampAncillaryData(bytes memory ancillaryData, address requester)
259
+ public
260
+ view
261
+ virtual
262
+ returns (bytes memory);
263
+ }
@@ -0,0 +1,251 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ pragma solidity ^0.8.0;
3
+
4
+ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
5
+ import "../interfaces/OptimisticOracleInterface.sol";
6
+
7
+ /**
8
+ * @title Interface for the gas-cost-reduced version of the OptimisticOracle.
9
+ * @notice Differences from normal OptimisticOracle:
10
+ * - refundOnDispute: flag is removed, by default there are no refunds on disputes.
11
+ * - customizing request parameters: In the OptimisticOracle, parameters like `bond` and `customLiveness` can be reset
12
+ * after a request is already made via `requestPrice`. In the SkinnyOptimisticOracle, these parameters can only be
13
+ * set in `requestPrice`, which has an expanded input set.
14
+ * - settleAndGetPrice: Replaced by `settle`, which can only be called once per settleable request. The resolved price
15
+ * can be fetched via the `Settle` event or the return value of `settle`.
16
+ * - general changes to interface: Functions that interact with existing requests all require the parameters of the
17
+ * request to modify to be passed as input. These parameters must match with the existing request parameters or the
18
+ * function will revert. This change reflects the internal refactor to store hashed request parameters instead of the
19
+ * full request struct.
20
+ * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface.
21
+ */
22
+ abstract contract SkinnyOptimisticOracleInterface {
23
+ // Struct representing a price request. Note that this differs from the OptimisticOracleInterface's Request struct
24
+ // in that refundOnDispute is removed.
25
+ struct Request {
26
+ address proposer; // Address of the proposer.
27
+ address disputer; // Address of the disputer.
28
+ IERC20 currency; // ERC20 token used to pay rewards and fees.
29
+ bool settled; // True if the request is settled.
30
+ int256 proposedPrice; // Price that the proposer submitted.
31
+ int256 resolvedPrice; // Price resolved once the request is settled.
32
+ uint256 expirationTime; // Time at which the request auto-settles without a dispute.
33
+ uint256 reward; // Amount of the currency to pay to the proposer on settlement.
34
+ uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.
35
+ uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.
36
+ uint256 customLiveness; // Custom liveness value set by the requester.
37
+ }
38
+
39
+ // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible
40
+ // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses
41
+ // to accept a price request made with ancillary data length over a certain size.
42
+ uint256 public constant ancillaryBytesLimit = 8192;
43
+
44
+ /**
45
+ * @notice Requests a new price.
46
+ * @param identifier price identifier being requested.
47
+ * @param timestamp timestamp of the price being requested.
48
+ * @param ancillaryData ancillary data representing additional args being passed with the price request.
49
+ * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.
50
+ * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,
51
+ * which could make sense if the contract requests and proposes the value in the same call or
52
+ * provides its own reward system.
53
+ * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.
54
+ * @param customLiveness custom proposal liveness to set for request.
55
+ * @return totalBond default bond + final fee that the proposer and disputer will be required to pay.
56
+ */
57
+ function requestPrice(
58
+ bytes32 identifier,
59
+ uint32 timestamp,
60
+ bytes memory ancillaryData,
61
+ IERC20 currency,
62
+ uint256 reward,
63
+ uint256 bond,
64
+ uint256 customLiveness
65
+ ) external virtual returns (uint256 totalBond);
66
+
67
+ /**
68
+ * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come
69
+ * from this proposal. However, any bonds are pulled from the caller.
70
+ * @param requester sender of the initial price request.
71
+ * @param identifier price identifier to identify the existing request.
72
+ * @param timestamp timestamp to identify the existing request.
73
+ * @param ancillaryData ancillary data of the price being requested.
74
+ * @param request price request parameters whose hash must match the request that the caller wants to
75
+ * propose a price for.
76
+ * @param proposer address to set as the proposer.
77
+ * @param proposedPrice price being proposed.
78
+ * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
79
+ * the proposer once settled if the proposal is correct.
80
+ */
81
+ function proposePriceFor(
82
+ address requester,
83
+ bytes32 identifier,
84
+ uint32 timestamp,
85
+ bytes memory ancillaryData,
86
+ Request memory request,
87
+ address proposer,
88
+ int256 proposedPrice
89
+ ) public virtual returns (uint256 totalBond);
90
+
91
+ /**
92
+ * @notice Proposes a price value where caller is the proposer.
93
+ * @param requester sender of the initial price request.
94
+ * @param identifier price identifier to identify the existing request.
95
+ * @param timestamp timestamp to identify the existing request.
96
+ * @param ancillaryData ancillary data of the price being requested.
97
+ * @param request price request parameters whose hash must match the request that the caller wants to
98
+ * propose a price for.
99
+ * @param proposedPrice price being proposed.
100
+ * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
101
+ * the proposer once settled if the proposal is correct.
102
+ */
103
+ function proposePrice(
104
+ address requester,
105
+ bytes32 identifier,
106
+ uint32 timestamp,
107
+ bytes memory ancillaryData,
108
+ Request memory request,
109
+ int256 proposedPrice
110
+ ) external virtual returns (uint256 totalBond);
111
+
112
+ /**
113
+ * @notice Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to
114
+ * overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer
115
+ * will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.
116
+ * @dev The caller is the requester, but the proposer can be customized.
117
+ * @param identifier price identifier to identify the existing request.
118
+ * @param timestamp timestamp to identify the existing request.
119
+ * @param ancillaryData ancillary data of the price being requested.
120
+ * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.
121
+ * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,
122
+ * which could make sense if the contract requests and proposes the value in the same call or
123
+ * provides its own reward system.
124
+ * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.
125
+ * @param customLiveness custom proposal liveness to set for request.
126
+ * @param proposer address to set as the proposer.
127
+ * @param proposedPrice price being proposed.
128
+ * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
129
+ * the proposer once settled if the proposal is correct.
130
+ */
131
+ function requestAndProposePriceFor(
132
+ bytes32 identifier,
133
+ uint32 timestamp,
134
+ bytes memory ancillaryData,
135
+ IERC20 currency,
136
+ uint256 reward,
137
+ uint256 bond,
138
+ uint256 customLiveness,
139
+ address proposer,
140
+ int256 proposedPrice
141
+ ) external virtual returns (uint256 totalBond);
142
+
143
+ /**
144
+ * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will
145
+ * receive any rewards that come from this dispute. However, any bonds are pulled from the caller.
146
+ * @param identifier price identifier to identify the existing request.
147
+ * @param timestamp timestamp to identify the existing request.
148
+ * @param ancillaryData ancillary data of the price being requested.
149
+ * @param request price request parameters whose hash must match the request that the caller wants to
150
+ * dispute.
151
+ * @param disputer address to set as the disputer.
152
+ * @param requester sender of the initial price request.
153
+ * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
154
+ * the disputer once settled if the dispute was valid (the proposal was incorrect).
155
+ */
156
+ function disputePriceFor(
157
+ bytes32 identifier,
158
+ uint32 timestamp,
159
+ bytes memory ancillaryData,
160
+ Request memory request,
161
+ address disputer,
162
+ address requester
163
+ ) public virtual returns (uint256 totalBond);
164
+
165
+ /**
166
+ * @notice Disputes a price request with an active proposal where caller is the disputer.
167
+ * @param requester sender of the initial price request.
168
+ * @param identifier price identifier to identify the existing request.
169
+ * @param timestamp timestamp to identify the existing request.
170
+ * @param ancillaryData ancillary data of the price being requested.
171
+ * @param request price request parameters whose hash must match the request that the caller wants to
172
+ * dispute.
173
+ * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
174
+ * the disputer once settled if the dispute was valid (the proposal was incorrect).
175
+ */
176
+ function disputePrice(
177
+ address requester,
178
+ bytes32 identifier,
179
+ uint32 timestamp,
180
+ bytes memory ancillaryData,
181
+ Request memory request
182
+ ) external virtual returns (uint256 totalBond);
183
+
184
+ /**
185
+ * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.
186
+ * @param requester sender of the initial price request.
187
+ * @param identifier price identifier to identify the existing request.
188
+ * @param timestamp timestamp to identify the existing request.
189
+ * @param ancillaryData ancillary data of the price being requested.
190
+ * @param request price request parameters whose hash must match the request that the caller wants to
191
+ * settle.
192
+ * @return payout the amount that the "winner" (proposer or disputer) receives on settlement. This amount includes
193
+ * the returned bonds as well as additional rewards.
194
+ * @return resolvedPrice the price that the request settled to.
195
+ */
196
+ function settle(
197
+ address requester,
198
+ bytes32 identifier,
199
+ uint32 timestamp,
200
+ bytes memory ancillaryData,
201
+ Request memory request
202
+ ) external virtual returns (uint256 payout, int256 resolvedPrice);
203
+
204
+ /**
205
+ * @notice Computes the current state of a price request. See the State enum for more details.
206
+ * @param requester sender of the initial price request.
207
+ * @param identifier price identifier to identify the existing request.
208
+ * @param timestamp timestamp to identify the existing request.
209
+ * @param ancillaryData ancillary data of the price being requested.
210
+ * @param request price request parameters.
211
+ * @return the State.
212
+ */
213
+ function getState(
214
+ address requester,
215
+ bytes32 identifier,
216
+ uint32 timestamp,
217
+ bytes memory ancillaryData,
218
+ Request memory request
219
+ ) external virtual returns (OptimisticOracleInterface.State);
220
+
221
+ /**
222
+ * @notice Checks if a given request has resolved, expired or been settled (i.e the optimistic oracle has a price).
223
+ * @param requester sender of the initial price request.
224
+ * @param identifier price identifier to identify the existing request.
225
+ * @param timestamp timestamp to identify the existing request.
226
+ * @param ancillaryData ancillary data of the price being requested.
227
+ * @param request price request parameters. The hash of these parameters must match with the request hash that is
228
+ * associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method
229
+ * will revert.
230
+ * @return boolean indicating true if price exists and false if not.
231
+ */
232
+ function hasPrice(
233
+ address requester,
234
+ bytes32 identifier,
235
+ uint32 timestamp,
236
+ bytes memory ancillaryData,
237
+ Request memory request
238
+ ) public virtual returns (bool);
239
+
240
+ /**
241
+ * @notice Generates stamped ancillary data in the format that it would be used in the case of a price dispute.
242
+ * @param ancillaryData ancillary data of the price being requested.
243
+ * @param requester sender of the initial price request.
244
+ * @return the stamped ancillary bytes.
245
+ */
246
+ function stampAncillaryData(bytes memory ancillaryData, address requester)
247
+ public
248
+ pure
249
+ virtual
250
+ returns (bytes memory);
251
+ }
@@ -0,0 +1,46 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ pragma solidity ^0.8.0;
3
+
4
+ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
5
+ import "../../common/implementation/FixedPoint.sol";
6
+
7
+ /**
8
+ * @title Interface that allows financial contracts to pay oracle fees for their use of the system.
9
+ */
10
+ interface StoreInterface {
11
+ /**
12
+ * @notice Pays Oracle fees in ETH to the store.
13
+ * @dev To be used by contracts whose margin currency is ETH.
14
+ */
15
+ function payOracleFees() external payable;
16
+
17
+ /**
18
+ * @notice Pays oracle fees in the margin currency, erc20Address, to the store.
19
+ * @dev To be used if the margin currency is an ERC20 token rather than ETH.
20
+ * @param erc20Address address of the ERC20 token used to pay the fee.
21
+ * @param amount number of tokens to transfer. An approval for at least this amount must exist.
22
+ */
23
+ function payOracleFeesErc20(address erc20Address, FixedPoint.Unsigned calldata amount) external;
24
+
25
+ /**
26
+ * @notice Computes the regular oracle fees that a contract should pay for a period.
27
+ * @param startTime defines the beginning time from which the fee is paid.
28
+ * @param endTime end time until which the fee is paid.
29
+ * @param pfc "profit from corruption", or the maximum amount of margin currency that a
30
+ * token sponsor could extract from the contract through corrupting the price feed in their favor.
31
+ * @return regularFee amount owed for the duration from start to end time for the given pfc.
32
+ * @return latePenalty for paying the fee after the deadline.
33
+ */
34
+ function computeRegularFee(
35
+ uint256 startTime,
36
+ uint256 endTime,
37
+ FixedPoint.Unsigned calldata pfc
38
+ ) external view returns (FixedPoint.Unsigned memory regularFee, FixedPoint.Unsigned memory latePenalty);
39
+
40
+ /**
41
+ * @notice Computes the final oracle fees that a contract should pay at settlement.
42
+ * @param currency token used to pay the final fee.
43
+ * @return finalFee amount due.
44
+ */
45
+ function computeFinalFee(address currency) external view returns (FixedPoint.Unsigned memory);
46
+ }
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@across-protocol/contracts",
3
+ "version": "0.1.0",
4
+ "description": "Across smart contracts and tests",
5
+ "dependencies": {
6
+ "@eth-optimism/contracts": "^0.5.5",
7
+ "@openzeppelin/contracts": "4.1.0",
8
+ "@uma/core": "^2.18.0"
9
+ },
10
+ "devDependencies": {
11
+ "@eth-optimism/hardhat-ovm": "^0.2.2",
12
+ "@eth-optimism/smock": "1.1.9",
13
+ "@ethersproject/abi": "^5.5.0",
14
+ "@ethersproject/abstract-provider": "^5.5.1",
15
+ "@ethersproject/abstract-signer": "^5.5.0",
16
+ "@ethersproject/contracts": "^5.4.0",
17
+ "@ethersproject/providers": "^5.4.2",
18
+ "@nomiclabs/ethereumjs-vm": "^4.2.2",
19
+ "@nomiclabs/hardhat-ethers": "^2.0.2",
20
+ "@nomiclabs/hardhat-etherscan": "^2.1.6",
21
+ "@nomiclabs/hardhat-truffle5": "^2.0.0",
22
+ "@nomiclabs/hardhat-web3": "^2.0.0",
23
+ "@uma/common": "^2.14.0",
24
+ "@uma/contracts-node": "^0.1.15",
25
+ "@uniswap/v3-core": "^1.0.0-rc.2",
26
+ "arb-ts": "^1.0.2",
27
+ "decimal.js": "^10.3.1",
28
+ "ethers": "^5.5.2",
29
+ "glob": "^7.2.0",
30
+ "hardhat": "^2.6.8"
31
+ },
32
+ "homepage": "https://across.to",
33
+ "license": "AGPL-3.0-or-later",
34
+ "publishConfig": {
35
+ "registry": "https://registry.npmjs.com/",
36
+ "access": "public"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/across-protocol/across-smart-contracts.git"
41
+ },
42
+ "main": "dist/index.js",
43
+ "types": "types/index.d.ts",
44
+ "files": [
45
+ "/contracts/**/*.sol",
46
+ "/artifacts/**/*",
47
+ "/dist/**/*",
48
+ "/types/**/*"
49
+ ],
50
+ "sideEffects": false,
51
+ "scripts": {
52
+ "test": "mocha 'test/**/*.js'",
53
+ "build": "hardhat compile && yarn load-addresses",
54
+ "load-addresses": "yarn hardhat load-addresses",
55
+ "prepublish": "yarn build"
56
+ },
57
+ "bugs": {
58
+ "url": "https://github.com/across-protocol/across-smart-contracts/issues"
59
+ }
60
+ }