@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.
- package/CHANGELOG.md +8 -0
- package/LICENSE +661 -0
- package/README.md +53 -0
- package/artifacts/@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol/IL2ERC20Bridge.dbg.json +4 -0
- package/artifacts/@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol/IL2ERC20Bridge.json +252 -0
- package/artifacts/@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol/CrossDomainEnabled.dbg.json +4 -0
- package/artifacts/@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol/CrossDomainEnabled.json +35 -0
- package/artifacts/@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol/ICrossDomainMessenger.dbg.json +4 -0
- package/artifacts/@eth-optimism/contracts/libraries/bridge/ICrossDomainMessenger.sol/ICrossDomainMessenger.json +110 -0
- package/artifacts/@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol/Lib_PredeployAddresses.dbg.json +4 -0
- package/artifacts/@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol/Lib_PredeployAddresses.json +10 -0
- package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/AccessControl.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/AccessControl.json +215 -0
- package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/IAccessControl.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/IAccessControl.json +108 -0
- package/artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.json +63 -0
- package/artifacts/@openzeppelin/contracts/security/Pausable.sol/Pausable.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/security/Pausable.sol/Pausable.json +50 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json +297 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.json +194 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.json +233 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.json +10 -0
- package/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.json +10 -0
- package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.json +10 -0
- package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.json +10 -0
- package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.json +30 -0
- package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.json +30 -0
- package/artifacts/@openzeppelin/contracts/utils/math/SafeMath.sol/SafeMath.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/math/SafeMath.sol/SafeMath.json +10 -0
- package/artifacts/@openzeppelin/contracts/utils/math/SignedSafeMath.sol/SignedSafeMath.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/math/SignedSafeMath.sol/SignedSafeMath.json +10 -0
- package/artifacts/@uma/core/contracts/common/implementation/Lockable.sol/Lockable.dbg.json +4 -0
- package/artifacts/@uma/core/contracts/common/implementation/Lockable.sol/Lockable.json +16 -0
- package/artifacts/@uma/core/contracts/cross-chain-oracle/chain-adapters/Arbitrum_ParentMessenger.sol/Arbitrum_ParentMessenger.dbg.json +4 -0
- package/artifacts/@uma/core/contracts/cross-chain-oracle/chain-adapters/Arbitrum_ParentMessenger.sol/Arbitrum_ParentMessenger.json +611 -0
- package/artifacts/@uma/core/contracts/cross-chain-oracle/chain-adapters/ParentMessengerBase.sol/ParentMessengerBase.dbg.json +4 -0
- package/artifacts/@uma/core/contracts/cross-chain-oracle/chain-adapters/ParentMessengerBase.sol/ParentMessengerBase.json +297 -0
- package/artifacts/@uma/core/contracts/cross-chain-oracle/interfaces/ParentMessengerConsumerInterface.sol/ParentMessengerConsumerInterface.dbg.json +4 -0
- package/artifacts/@uma/core/contracts/cross-chain-oracle/interfaces/ParentMessengerConsumerInterface.sol/ParentMessengerConsumerInterface.json +29 -0
- package/artifacts/@uma/core/contracts/cross-chain-oracle/interfaces/ParentMessengerInterface.sol/ParentMessengerInterface.dbg.json +4 -0
- package/artifacts/@uma/core/contracts/cross-chain-oracle/interfaces/ParentMessengerInterface.sol/ParentMessengerInterface.json +37 -0
- package/artifacts/@uma/core/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/IBridge.dbg.json +4 -0
- package/artifacts/@uma/core/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/IBridge.json +24 -0
- package/artifacts/@uma/core/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/iArbitrum_Inbox.dbg.json +4 -0
- package/artifacts/@uma/core/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/iArbitrum_Inbox.json +78 -0
- package/artifacts/@uma/core/contracts/external/avm/interfaces/iArbitrum_Outbox.sol/iArbitrum_Outbox.dbg.json +4 -0
- package/artifacts/@uma/core/contracts/external/avm/interfaces/iArbitrum_Outbox.sol/iArbitrum_Outbox.json +24 -0
- package/artifacts/@uma/core/contracts/insured-bridge/avm/Arbitrum_CrossDomainEnabled.sol/Arbitrum_CrossDomainEnabled.dbg.json +4 -0
- package/artifacts/@uma/core/contracts/insured-bridge/avm/Arbitrum_CrossDomainEnabled.sol/Arbitrum_CrossDomainEnabled.json +24 -0
- package/artifacts/build-info/1cd64db7a8ac0a153df93d26826ad4e9.json +1653 -0
- package/artifacts/build-info/1f738b56edd7602183f2f8d2f23f6e90.json +1592 -0
- package/artifacts/build-info/343b9221be36acd9ddaca3f3b83d2e75.json +3943 -0
- package/artifacts/build-info/622e561692c193f4cd0ff989b5a231e2.json +5661 -0
- package/artifacts/build-info/8e408b49e0ff2873bc28d45221a7ff71.json +277715 -0
- package/artifacts/build-info/9d1a3182633612bd337d811d567d5d60.json +2072 -0
- package/artifacts/build-info/a8cd9c443d245fe513d6650634b60f93.json +23776 -0
- package/artifacts/build-info/d302d9d63fbafb5c8d635cc62cb1cc7c.json +167529 -0
- package/artifacts/contracts/common/implementation/AncillaryData.sol/AncillaryData.dbg.json +4 -0
- package/artifacts/contracts/common/implementation/AncillaryData.sol/AncillaryData.json +10 -0
- package/artifacts/contracts/common/implementation/FixedPoint.sol/FixedPoint.dbg.json +4 -0
- package/artifacts/contracts/common/implementation/FixedPoint.sol/FixedPoint.json +10 -0
- package/artifacts/contracts/common/implementation/Lockable.sol/Lockable.dbg.json +4 -0
- package/artifacts/contracts/common/implementation/Lockable.sol/Lockable.json +16 -0
- package/artifacts/contracts/common/implementation/MultiCaller.sol/MultiCaller.dbg.json +4 -0
- package/artifacts/contracts/common/implementation/MultiCaller.sol/MultiCaller.json +30 -0
- package/artifacts/contracts/common/implementation/Testable.sol/Testable.dbg.json +4 -0
- package/artifacts/contracts/common/implementation/Testable.sol/Testable.json +50 -0
- package/artifacts/contracts/common/implementation/Timer.sol/Timer.dbg.json +4 -0
- package/artifacts/contracts/common/implementation/Timer.sol/Timer.json +42 -0
- package/artifacts/contracts/common/interfaces/AddressWhitelistInterface.sol/AddressWhitelistInterface.dbg.json +4 -0
- package/artifacts/contracts/common/interfaces/AddressWhitelistInterface.sol/AddressWhitelistInterface.json +69 -0
- package/artifacts/contracts/external/avm/AVM_CrossDomainEnabled.sol/AVM_CrossDomainEnabled.dbg.json +4 -0
- package/artifacts/contracts/external/avm/AVM_CrossDomainEnabled.sol/AVM_CrossDomainEnabled.json +42 -0
- package/artifacts/contracts/external/avm/interfaces/ArbSys.sol/ArbSys.dbg.json +4 -0
- package/artifacts/contracts/external/avm/interfaces/ArbSys.sol/ArbSys.json +235 -0
- package/artifacts/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/IBridge.dbg.json +4 -0
- package/artifacts/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/IBridge.json +24 -0
- package/artifacts/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/iArbitrum_Inbox.dbg.json +4 -0
- package/artifacts/contracts/external/avm/interfaces/iArbitrum_Inbox.sol/iArbitrum_Inbox.json +78 -0
- package/artifacts/contracts/external/avm/interfaces/iArbitrum_Outbox.sol/iArbitrum_Outbox.dbg.json +4 -0
- package/artifacts/contracts/external/avm/interfaces/iArbitrum_Outbox.sol/iArbitrum_Outbox.json +24 -0
- package/artifacts/contracts/external/chainbridge/Bridge.sol/Bridge.dbg.json +4 -0
- package/artifacts/contracts/external/chainbridge/Bridge.sol/Bridge.json +1019 -0
- package/artifacts/contracts/external/chainbridge/handlers/GenericHandler.sol/GenericHandler.dbg.json +4 -0
- package/artifacts/contracts/external/chainbridge/handlers/GenericHandler.sol/GenericHandler.json +314 -0
- package/artifacts/contracts/external/chainbridge/interfaces/IBridge.sol/IBridge.dbg.json +4 -0
- package/artifacts/contracts/external/chainbridge/interfaces/IBridge.sol/IBridge.json +47 -0
- package/artifacts/contracts/external/chainbridge/interfaces/IDepositExecute.sol/IDepositExecute.dbg.json +4 -0
- package/artifacts/contracts/external/chainbridge/interfaces/IDepositExecute.sol/IDepositExecute.json +62 -0
- package/artifacts/contracts/external/chainbridge/interfaces/IERCHandler.sol/IERCHandler.dbg.json +4 -0
- package/artifacts/contracts/external/chainbridge/interfaces/IERCHandler.sol/IERCHandler.json +65 -0
- package/artifacts/contracts/external/chainbridge/interfaces/IGenericHandler.sol/IGenericHandler.dbg.json +4 -0
- package/artifacts/contracts/external/chainbridge/interfaces/IGenericHandler.sol/IGenericHandler.json +39 -0
- package/artifacts/contracts/external/ovm/OVM_CrossDomainEnabled.sol/OVM_CrossDomainEnabled.dbg.json +4 -0
- package/artifacts/contracts/external/ovm/OVM_CrossDomainEnabled.sol/OVM_CrossDomainEnabled.json +35 -0
- package/artifacts/contracts/external/ovm/OVM_CrossDomainEnabled.sol/iOVM_CrossDomainMessenger.dbg.json +4 -0
- package/artifacts/contracts/external/ovm/OVM_CrossDomainEnabled.sol/iOVM_CrossDomainMessenger.json +86 -0
- package/artifacts/contracts/external/polygon/lib/Merkle.sol/Merkle.dbg.json +4 -0
- package/artifacts/contracts/external/polygon/lib/Merkle.sol/Merkle.json +10 -0
- package/artifacts/contracts/external/polygon/lib/MerklePatriciaProof.sol/MerklePatriciaProof.dbg.json +4 -0
- package/artifacts/contracts/external/polygon/lib/MerklePatriciaProof.sol/MerklePatriciaProof.json +10 -0
- package/artifacts/contracts/external/polygon/lib/RLPReader.sol/RLPReader.dbg.json +4 -0
- package/artifacts/contracts/external/polygon/lib/RLPReader.sol/RLPReader.json +10 -0
- package/artifacts/contracts/external/polygon/test/FxChildMock.sol/FxChildMock.dbg.json +4 -0
- package/artifacts/contracts/external/polygon/test/FxChildMock.sol/FxChildMock.json +104 -0
- package/artifacts/contracts/external/polygon/test/FxChildMock.sol/IFxMessageProcessor.dbg.json +4 -0
- package/artifacts/contracts/external/polygon/test/FxChildMock.sol/IFxMessageProcessor.json +34 -0
- package/artifacts/contracts/external/polygon/test/FxChildMock.sol/IStateReceiver.dbg.json +4 -0
- package/artifacts/contracts/external/polygon/test/FxChildMock.sol/IStateReceiver.json +29 -0
- package/artifacts/contracts/external/polygon/test/FxRootMock.sol/FxRootMock.dbg.json +4 -0
- package/artifacts/contracts/external/polygon/test/FxRootMock.sol/FxRootMock.json +79 -0
- package/artifacts/contracts/external/polygon/test/FxRootMock.sol/IFxStateSender.dbg.json +4 -0
- package/artifacts/contracts/external/polygon/test/FxRootMock.sol/IFxStateSender.json +29 -0
- package/artifacts/contracts/external/polygon/test/FxRootMock.sol/IStateSender.dbg.json +4 -0
- package/artifacts/contracts/external/polygon/test/FxRootMock.sol/IStateSender.json +29 -0
- package/artifacts/contracts/external/polygon/test/StateSyncMock.sol/StateSyncMock.dbg.json +4 -0
- package/artifacts/contracts/external/polygon/test/StateSyncMock.sol/StateSyncMock.json +54 -0
- package/artifacts/contracts/external/polygon/tunnel/FxBaseChildTunnel.sol/FxBaseChildTunnel.dbg.json +4 -0
- package/artifacts/contracts/external/polygon/tunnel/FxBaseChildTunnel.sol/FxBaseChildTunnel.json +86 -0
- package/artifacts/contracts/external/polygon/tunnel/FxBaseChildTunnel.sol/IFxMessageProcessor.dbg.json +4 -0
- package/artifacts/contracts/external/polygon/tunnel/FxBaseChildTunnel.sol/IFxMessageProcessor.json +34 -0
- package/artifacts/contracts/external/polygon/tunnel/FxBaseRootTunnel.sol/FxBaseRootTunnel.dbg.json +4 -0
- package/artifacts/contracts/external/polygon/tunnel/FxBaseRootTunnel.sol/FxBaseRootTunnel.json +108 -0
- package/artifacts/contracts/external/polygon/tunnel/FxBaseRootTunnel.sol/ICheckpointManager.dbg.json +4 -0
- package/artifacts/contracts/external/polygon/tunnel/FxBaseRootTunnel.sol/ICheckpointManager.json +50 -0
- package/artifacts/contracts/external/polygon/tunnel/FxBaseRootTunnel.sol/IFxStateSender.dbg.json +4 -0
- package/artifacts/contracts/external/polygon/tunnel/FxBaseRootTunnel.sol/IFxStateSender.json +29 -0
- package/artifacts/contracts/insured-bridge/BridgeAdmin.sol/BridgeAdmin.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/BridgeAdmin.sol/BridgeAdmin.json +662 -0
- package/artifacts/contracts/insured-bridge/BridgeDepositBox.sol/BridgeDepositBox.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/BridgeDepositBox.sol/BridgeDepositBox.json +391 -0
- package/artifacts/contracts/insured-bridge/BridgeDepositBox.sol/TokenLike.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/BridgeDepositBox.sol/TokenLike.json +30 -0
- package/artifacts/contracts/insured-bridge/BridgeDepositBox.sol/WETH9Like.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/BridgeDepositBox.sol/WETH9Like.json +31 -0
- package/artifacts/contracts/insured-bridge/BridgePool.sol/BridgePool.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/BridgePool.sol/BridgePool.json +1709 -0
- package/artifacts/contracts/insured-bridge/BridgePool.sol/BridgePoolProd.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/BridgePool.sol/BridgePoolProd.json +1709 -0
- package/artifacts/contracts/insured-bridge/BridgePool.sol/WETH9Like.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/BridgePool.sol/WETH9Like.json +31 -0
- package/artifacts/contracts/insured-bridge/avm/AVM_BridgeDepositBox.sol/AVM_BridgeDepositBox.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/avm/AVM_BridgeDepositBox.sol/AVM_BridgeDepositBox.json +564 -0
- package/artifacts/contracts/insured-bridge/avm/AVM_BridgeDepositBox.sol/StandardBridgeLike.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/avm/AVM_BridgeDepositBox.sol/StandardBridgeLike.json +45 -0
- package/artifacts/contracts/insured-bridge/avm/Arbitrum_CrossDomainEnabled.sol/Arbitrum_CrossDomainEnabled.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/avm/Arbitrum_CrossDomainEnabled.sol/Arbitrum_CrossDomainEnabled.json +24 -0
- package/artifacts/contracts/insured-bridge/avm/Arbitrum_Messenger.sol/Arbitrum_Messenger.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/avm/Arbitrum_Messenger.sol/Arbitrum_Messenger.json +191 -0
- package/artifacts/contracts/insured-bridge/interfaces/BridgeAdminInterface.sol/BridgeAdminInterface.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/interfaces/BridgeAdminInterface.sol/BridgeAdminInterface.json +319 -0
- package/artifacts/contracts/insured-bridge/interfaces/BridgePoolInterface.sol/BridgePoolInterface.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/interfaces/BridgePoolInterface.sol/BridgePoolInterface.json +63 -0
- package/artifacts/contracts/insured-bridge/interfaces/MessengerInterface.sol/MessengerInterface.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/interfaces/MessengerInterface.sol/MessengerInterface.json +54 -0
- package/artifacts/contracts/insured-bridge/ovm/OVM_BridgeDepositBox.sol/OVM_BridgeDepositBox.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/ovm/OVM_BridgeDepositBox.sol/OVM_BridgeDepositBox.json +528 -0
- package/artifacts/contracts/insured-bridge/ovm/OVM_CrossDomainEnabled.sol/OVM_CrossDomainEnabled.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/ovm/OVM_CrossDomainEnabled.sol/OVM_CrossDomainEnabled.json +35 -0
- package/artifacts/contracts/insured-bridge/ovm/OVM_OETH_BridgeDepositBox.sol/OVM_OETH_BridgeDepositBox.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/ovm/OVM_OETH_BridgeDepositBox.sol/OVM_OETH_BridgeDepositBox.json +572 -0
- package/artifacts/contracts/insured-bridge/ovm/Optimism_Messenger.sol/Optimism_Messenger.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/ovm/Optimism_Messenger.sol/Optimism_Messenger.json +130 -0
- package/artifacts/contracts/insured-bridge/ovm/Optimism_Wrapper.sol/Optimism_Wrapper.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/ovm/Optimism_Wrapper.sol/Optimism_Wrapper.json +142 -0
- package/artifacts/contracts/insured-bridge/ovm/Optimism_Wrapper.sol/WETH9Like.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/ovm/Optimism_Wrapper.sol/WETH9Like.json +55 -0
- package/artifacts/contracts/insured-bridge/ovm/iOVM_CrossDomainMessenger.sol/iOVM_CrossDomainMessenger.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/ovm/iOVM_CrossDomainMessenger.sol/iOVM_CrossDomainMessenger.json +86 -0
- package/artifacts/contracts/insured-bridge/test/Arbitrum_InboxMock.sol/Arbitrum_BridgeMock.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/test/Arbitrum_InboxMock.sol/Arbitrum_BridgeMock.json +68 -0
- package/artifacts/contracts/insured-bridge/test/Arbitrum_InboxMock.sol/Arbitrum_InboxMock.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/test/Arbitrum_InboxMock.sol/Arbitrum_InboxMock.json +78 -0
- package/artifacts/contracts/insured-bridge/test/Arbitrum_InboxMock.sol/Arbitrum_OutboxMock.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/test/Arbitrum_InboxMock.sol/Arbitrum_OutboxMock.json +24 -0
- package/artifacts/contracts/insured-bridge/test/BridgeDepositBoxMock.sol/BridgeDepositBoxMock.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/test/BridgeDepositBoxMock.sol/BridgeDepositBoxMock.json +510 -0
- package/artifacts/contracts/insured-bridge/test/MessengerMock.sol/MessengerMock.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/test/MessengerMock.sol/MessengerMock.json +85 -0
- package/artifacts/contracts/insured-bridge/test/OVM_L1CrossDomainMessengerMock.sol/OVM_L1CrossDomainMessengerMock.dbg.json +4 -0
- package/artifacts/contracts/insured-bridge/test/OVM_L1CrossDomainMessengerMock.sol/OVM_L1CrossDomainMessengerMock.json +110 -0
- package/artifacts/contracts/oracle/implementation/Constants.sol/OptimisticOracleConstraints.dbg.json +4 -0
- package/artifacts/contracts/oracle/implementation/Constants.sol/OptimisticOracleConstraints.json +24 -0
- package/artifacts/contracts/oracle/implementation/Constants.sol/OracleInterfaces.dbg.json +4 -0
- package/artifacts/contracts/oracle/implementation/Constants.sol/OracleInterfaces.json +141 -0
- package/artifacts/contracts/oracle/interfaces/FinderInterface.sol/FinderInterface.dbg.json +4 -0
- package/artifacts/contracts/oracle/interfaces/FinderInterface.sol/FinderInterface.json +48 -0
- package/artifacts/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol/IdentifierWhitelistInterface.dbg.json +4 -0
- package/artifacts/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol/IdentifierWhitelistInterface.json +56 -0
- package/artifacts/contracts/oracle/interfaces/OptimisticOracleInterface.sol/OptimisticOracleInterface.dbg.json +4 -0
- package/artifacts/contracts/oracle/interfaces/OptimisticOracleInterface.sol/OptimisticOracleInterface.json +555 -0
- package/artifacts/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol/SkinnyOptimisticOracleInterface.dbg.json +4 -0
- package/artifacts/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol/SkinnyOptimisticOracleInterface.json +853 -0
- package/artifacts/contracts/oracle/interfaces/StoreInterface.sol/StoreInterface.dbg.json +4 -0
- package/artifacts/contracts/oracle/interfaces/StoreInterface.sol/StoreInterface.json +124 -0
- package/contracts/common/implementation/AncillaryData.sol +144 -0
- package/contracts/common/implementation/FixedPoint.sol +763 -0
- package/contracts/common/implementation/Lockable.sol +61 -0
- package/contracts/common/implementation/MultiCaller.sol +27 -0
- package/contracts/common/implementation/Testable.sol +52 -0
- package/contracts/common/implementation/Timer.sol +30 -0
- package/contracts/common/interfaces/AddressWhitelistInterface.sol +12 -0
- package/contracts/external/avm/AVM_CrossDomainEnabled.sol +43 -0
- package/contracts/external/avm/interfaces/ArbSys.sol +79 -0
- package/contracts/external/avm/interfaces/iArbitrum_Inbox.sol +28 -0
- package/contracts/external/avm/interfaces/iArbitrum_Outbox.sol +26 -0
- package/contracts/external/chainbridge/Bridge.sol +454 -0
- package/contracts/external/chainbridge/handlers/GenericHandler.sol +237 -0
- package/contracts/external/chainbridge/interfaces/IBridge.sol +20 -0
- package/contracts/external/chainbridge/interfaces/IDepositExecute.sol +29 -0
- package/contracts/external/chainbridge/interfaces/IERCHandler.sol +33 -0
- package/contracts/external/chainbridge/interfaces/IGenericHandler.sol +23 -0
- package/contracts/external/ovm/OVM_CrossDomainEnabled.sol +114 -0
- package/contracts/external/polygon/lib/Merkle.sol +36 -0
- package/contracts/external/polygon/lib/MerklePatriciaProof.sol +139 -0
- package/contracts/external/polygon/lib/RLPReader.sol +251 -0
- package/contracts/external/polygon/test/FxChildMock.sol +42 -0
- package/contracts/external/polygon/test/FxRootMock.sol +32 -0
- package/contracts/external/polygon/test/StateSyncMock.sol +26 -0
- package/contracts/external/polygon/tunnel/FxBaseChildTunnel.sol +80 -0
- package/contracts/external/polygon/tunnel/FxBaseRootTunnel.sol +185 -0
- package/contracts/insured-bridge/BridgeAdmin.sol +394 -0
- package/contracts/insured-bridge/BridgeDepositBox.sol +245 -0
- package/contracts/insured-bridge/BridgePool.sol +980 -0
- package/contracts/insured-bridge/avm/AVM_BridgeDepositBox.sol +144 -0
- package/contracts/insured-bridge/avm/Arbitrum_CrossDomainEnabled.sol +67 -0
- package/contracts/insured-bridge/avm/Arbitrum_Messenger.sol +72 -0
- package/contracts/insured-bridge/interfaces/BridgeAdminInterface.sol +44 -0
- package/contracts/insured-bridge/interfaces/BridgePoolInterface.sol +14 -0
- package/contracts/insured-bridge/interfaces/MessengerInterface.sol +18 -0
- package/contracts/insured-bridge/ovm/OVM_BridgeDepositBox.sol +135 -0
- package/contracts/insured-bridge/ovm/OVM_CrossDomainEnabled.sol +84 -0
- package/contracts/insured-bridge/ovm/OVM_OETH_BridgeDepositBox.sol +89 -0
- package/contracts/insured-bridge/ovm/Optimism_Messenger.sol +34 -0
- package/contracts/insured-bridge/ovm/Optimism_Wrapper.sol +59 -0
- package/contracts/insured-bridge/ovm/iOVM_CrossDomainMessenger.sol +41 -0
- package/contracts/insured-bridge/test/Arbitrum_InboxMock.sol +50 -0
- package/contracts/insured-bridge/test/BridgeDepositBoxMock.sol +113 -0
- package/contracts/insured-bridge/test/MessengerMock.sol +32 -0
- package/contracts/insured-bridge/test/OVM_L1CrossDomainMessengerMock.sol +16 -0
- package/contracts/oracle/implementation/Constants.sol +29 -0
- package/contracts/oracle/interfaces/FinderInterface.sol +22 -0
- package/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol +28 -0
- package/contracts/oracle/interfaces/OptimisticOracleInterface.sol +263 -0
- package/contracts/oracle/interfaces/SkinnyOptimisticOracleInterface.sol +251 -0
- package/contracts/oracle/interfaces/StoreInterface.sol +46 -0
- package/package.json +60 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import "../BridgeDepositBox.sol";
|
|
5
|
+
import "../../external/avm/AVM_CrossDomainEnabled.sol";
|
|
6
|
+
|
|
7
|
+
interface StandardBridgeLike {
|
|
8
|
+
function outboundTransfer(
|
|
9
|
+
address _l1Token,
|
|
10
|
+
address _to,
|
|
11
|
+
uint256 _amount,
|
|
12
|
+
bytes calldata _data
|
|
13
|
+
) external payable returns (bytes memory);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @notice AVM specific bridge deposit box.
|
|
18
|
+
* @dev Uses AVM cross-domain-enabled logic for access control.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
contract AVM_BridgeDepositBox is BridgeDepositBox, AVM_CrossDomainEnabled {
|
|
22
|
+
// Address of the L1 contract that acts as the owner of this Bridge deposit box.
|
|
23
|
+
address public crossDomainAdmin;
|
|
24
|
+
|
|
25
|
+
// Address of the Arbitrum L2 token gateway.
|
|
26
|
+
address public l2GatewayRouter;
|
|
27
|
+
|
|
28
|
+
event SetXDomainAdmin(address indexed newAdmin);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @notice Construct the Arbitrum Bridge Deposit Box
|
|
32
|
+
* @param _l2GatewayRouter Address of the Arbitrum L2 token gateway router for sending tokens from L2->L1.
|
|
33
|
+
* @param _crossDomainAdmin Address of the L1 contract that can call admin functions on this contract from L1.
|
|
34
|
+
* @param _minimumBridgingDelay Minimum second that must elapse between L2->L1 token transfer to prevent dos.
|
|
35
|
+
* @param _chainId L2 Chain identifier this deposit box is deployed on.
|
|
36
|
+
* @param _l1Weth Address of Weth on L1. Used to inform if the deposit should wrap ETH to WETH, if deposit is ETH.
|
|
37
|
+
* @param timerAddress Timer used to synchronize contract time in testing. Set to 0x000... in production.
|
|
38
|
+
*/
|
|
39
|
+
constructor(
|
|
40
|
+
address _l2GatewayRouter,
|
|
41
|
+
address _crossDomainAdmin,
|
|
42
|
+
uint64 _minimumBridgingDelay,
|
|
43
|
+
uint256 _chainId,
|
|
44
|
+
address _l1Weth,
|
|
45
|
+
address timerAddress
|
|
46
|
+
) BridgeDepositBox(_minimumBridgingDelay, _chainId, _l1Weth, timerAddress) {
|
|
47
|
+
l2GatewayRouter = _l2GatewayRouter;
|
|
48
|
+
_setCrossDomainAdmin(_crossDomainAdmin);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**************************************
|
|
52
|
+
* ADMIN FUNCTIONS *
|
|
53
|
+
**************************************/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @notice Changes the L1 contract that can trigger admin functions on this L2 deposit deposit box.
|
|
57
|
+
* @dev This should be set to the address of the L1 contract that ultimately relays a cross-domain message, which
|
|
58
|
+
* is expected to be the Arbitrum_Messenger.
|
|
59
|
+
* @dev Only callable by the existing crossDomainAdmin via the Arbitrum cross domain messenger.
|
|
60
|
+
* @param newCrossDomainAdmin address of the new L1 admin contract.
|
|
61
|
+
*/
|
|
62
|
+
function setCrossDomainAdmin(address newCrossDomainAdmin) public onlyFromCrossDomainAccount(crossDomainAdmin) {
|
|
63
|
+
_setCrossDomainAdmin(newCrossDomainAdmin);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @notice Changes the minimum time in seconds that must elapse between withdraws from L2->L1.
|
|
68
|
+
* @dev Only callable by the existing crossDomainAdmin via the Arbitrum cross domain messenger.
|
|
69
|
+
* @param newMinimumBridgingDelay the new minimum delay.
|
|
70
|
+
*/
|
|
71
|
+
function setMinimumBridgingDelay(uint64 newMinimumBridgingDelay)
|
|
72
|
+
public
|
|
73
|
+
onlyFromCrossDomainAccount(crossDomainAdmin)
|
|
74
|
+
{
|
|
75
|
+
_setMinimumBridgingDelay(newMinimumBridgingDelay);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @notice Enables L1 owner to whitelist a L1 Token <-> L2 Token pair for bridging.
|
|
80
|
+
* @dev Only callable by the existing crossDomainAdmin via the Arbitrum cross domain messenger.
|
|
81
|
+
* @param l1Token Address of the canonical L1 token. This is the token users will receive on Ethereum.
|
|
82
|
+
* @param l2Token Address of the L2 token representation. This is the token users would deposit on Arbitrum.
|
|
83
|
+
* @param l1BridgePool Address of the L1 withdrawal pool linked to this L2+L1 token.
|
|
84
|
+
*/
|
|
85
|
+
function whitelistToken(
|
|
86
|
+
address l1Token,
|
|
87
|
+
address l2Token,
|
|
88
|
+
address l1BridgePool
|
|
89
|
+
) public onlyFromCrossDomainAccount(crossDomainAdmin) {
|
|
90
|
+
_whitelistToken(l1Token, l2Token, l1BridgePool);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @notice L1 owner can enable/disable deposits for a whitelisted token.
|
|
95
|
+
* @dev Only callable by the existing crossDomainAdmin via the Arbitrum cross domain messenger.
|
|
96
|
+
* @param l2Token address of L2 token to enable/disable deposits for.
|
|
97
|
+
* @param depositsEnabled bool to set if the deposit box should accept/reject deposits.
|
|
98
|
+
*/
|
|
99
|
+
function setEnableDeposits(address l2Token, bool depositsEnabled)
|
|
100
|
+
public
|
|
101
|
+
onlyFromCrossDomainAccount(crossDomainAdmin)
|
|
102
|
+
{
|
|
103
|
+
_setEnableDeposits(l2Token, depositsEnabled);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**************************************
|
|
107
|
+
* RELAYER FUNCTIONS *
|
|
108
|
+
**************************************/
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @notice Called by relayer (or any other EOA) to move a batch of funds from the deposit box, through the canonical
|
|
112
|
+
* token bridge, to the L1 Withdraw box.
|
|
113
|
+
* @dev The frequency that this function can be called is rate limited by the `minimumBridgingDelay` to prevent spam
|
|
114
|
+
* on L1 as the finalization of a L2->L1 tx is quite expensive.
|
|
115
|
+
* @param l2Token L2 token to relay over the canonical bridge.
|
|
116
|
+
* @param l1Gas Unused by Arbitrum, but included for potential forward compatibility considerations.
|
|
117
|
+
*/
|
|
118
|
+
function bridgeTokens(address l2Token, uint32 l1Gas) public override nonReentrant() {
|
|
119
|
+
uint256 bridgeDepositBoxBalance = TokenLike(l2Token).balanceOf(address(this));
|
|
120
|
+
require(bridgeDepositBoxBalance > 0, "can't bridge zero tokens");
|
|
121
|
+
require(canBridge(l2Token), "non-whitelisted token or last bridge too recent");
|
|
122
|
+
|
|
123
|
+
whitelistedTokens[l2Token].lastBridgeTime = uint64(getCurrentTime());
|
|
124
|
+
|
|
125
|
+
StandardBridgeLike(l2GatewayRouter).outboundTransfer(
|
|
126
|
+
whitelistedTokens[l2Token].l1Token, // _l1Token. Address of the L1 token to bridge over.
|
|
127
|
+
whitelistedTokens[l2Token].l1BridgePool, // _to. Withdraw, over the bridge, to the l1 withdraw contract.
|
|
128
|
+
bridgeDepositBoxBalance, // _amount. Send the full balance of the deposit box to bridge.
|
|
129
|
+
"" // _data. We don't need to send any data for the bridging action.
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
emit TokensBridged(l2Token, bridgeDepositBoxBalance, l1Gas, msg.sender);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**************************************
|
|
136
|
+
* INTERNAL FUNCTIONS *
|
|
137
|
+
**************************************/
|
|
138
|
+
|
|
139
|
+
function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {
|
|
140
|
+
require(newCrossDomainAdmin != address(0), "Empty address");
|
|
141
|
+
crossDomainAdmin = newCrossDomainAdmin;
|
|
142
|
+
emit SetXDomainAdmin(crossDomainAdmin);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Copied logic from https://github.com/makerdao/arbitrum-dai-bridge/blob/34acc39bc6f3a2da0a837ea3c5dbc634ec61c7de/contracts/l1/L1CrossDomainEnabled.sol
|
|
2
|
+
// with a change to the solidity version.
|
|
3
|
+
pragma solidity ^0.8.0;
|
|
4
|
+
|
|
5
|
+
import "../../external/avm/interfaces/iArbitrum_Inbox.sol";
|
|
6
|
+
import "../../external/avm/interfaces/iArbitrum_Outbox.sol";
|
|
7
|
+
|
|
8
|
+
abstract contract Arbitrum_CrossDomainEnabled {
|
|
9
|
+
iArbitrum_Inbox public immutable inbox;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param _inbox Contract that sends generalized messages to the Arbitrum chain.
|
|
13
|
+
*/
|
|
14
|
+
constructor(address _inbox) {
|
|
15
|
+
inbox = iArbitrum_Inbox(_inbox);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// More details about retryable ticket parameters here: https://developer.offchainlabs.com/docs/l1_l2_messages#parameters
|
|
19
|
+
// This function will not apply aliassing to the `user` address on L2.
|
|
20
|
+
// Note: If `l1CallValue > 0`, then this contract must contain at least that much ETH to send as msg.value to the
|
|
21
|
+
// inbox.
|
|
22
|
+
function sendTxToL2NoAliassing(
|
|
23
|
+
address target, // Address where transaction will initiate on L2.
|
|
24
|
+
address user, // Address where excess gas is credited on L2.
|
|
25
|
+
uint256 l1CallValue, // msg.value deposited to `user` on L2.
|
|
26
|
+
uint256 maxSubmissionCost, // Amount of ETH allocated to pay for base submission fee. The user is charged this
|
|
27
|
+
// fee to cover the storage costs of keeping their retryable ticket's calldata in the retry buffer. This should
|
|
28
|
+
// also cover the `l2CallValue`, but we set that to 0. This amount is proportional to the size of `data`.
|
|
29
|
+
uint256 maxGas, // Gas limit for immediate L2 execution attempt.
|
|
30
|
+
uint256 gasPriceBid, // L2 gas price bid for immediate L2 execution attempt.
|
|
31
|
+
bytes memory data // ABI encoded data to send to target.
|
|
32
|
+
) internal returns (uint256) {
|
|
33
|
+
// createRetryableTicket API: https://developer.offchainlabs.com/docs/sol_contract_docs/md_docs/arb-bridge-eth/bridge/inbox#createretryableticketaddress-destaddr-uint256-l2callvalue-uint256-maxsubmissioncost-address-excessfeerefundaddress-address-callvaluerefundaddress-uint256-maxgas-uint256-gaspricebid-bytes-data-%E2%86%92-uint256-external
|
|
34
|
+
// - address destAddr: destination L2 contract address
|
|
35
|
+
// - uint256 l2CallValue: call value for retryable L2 message
|
|
36
|
+
// - uint256 maxSubmissionCost: Max gas deducted from user's L2 balance to cover base submission fee
|
|
37
|
+
// - address excessFeeRefundAddress: maxgas x gasprice - execution cost gets credited here on L2
|
|
38
|
+
// - address callValueRefundAddress: l2CallValue gets credited here on L2 if retryable txn times out or gets cancelled
|
|
39
|
+
// - uint256 maxGas: Max gas deducted from user's L2 balance to cover L2 execution
|
|
40
|
+
// - uint256 gasPriceBid: price bid for L2 execution
|
|
41
|
+
// - bytes data: ABI encoded data of L2 message
|
|
42
|
+
uint256 seqNum =
|
|
43
|
+
inbox.createRetryableTicketNoRefundAliasRewrite{ value: l1CallValue }(
|
|
44
|
+
target,
|
|
45
|
+
0, // we always assume that l2CallValue = 0
|
|
46
|
+
maxSubmissionCost,
|
|
47
|
+
user,
|
|
48
|
+
user,
|
|
49
|
+
maxGas,
|
|
50
|
+
gasPriceBid,
|
|
51
|
+
data
|
|
52
|
+
);
|
|
53
|
+
return seqNum;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Copied mostly from: https://github.com/makerdao/arbitrum-dai-bridge/blob/34acc39bc6f3a2da0a837ea3c5dbc634ec61c7de/contracts/l1/L1CrossDomainEnabled.sol#L31
|
|
57
|
+
modifier onlyFromCrossDomainAccount(address l2Counterpart) {
|
|
58
|
+
// a message coming from the counterpart gateway was executed by the bridge
|
|
59
|
+
IBridge bridge = IBridge(inbox.bridge());
|
|
60
|
+
require(msg.sender == address(bridge), "NOT_FROM_BRIDGE");
|
|
61
|
+
|
|
62
|
+
// and the outbox reports that the L2 address of the sender is the counterpart gateway
|
|
63
|
+
address l2ToL1Sender = iArbitrum_Outbox(bridge.activeOutbox()).l2ToL1Sender();
|
|
64
|
+
require(l2ToL1Sender == l2Counterpart, "ONLY_COUNTERPART_GATEWAY");
|
|
65
|
+
_;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import "./Arbitrum_CrossDomainEnabled.sol";
|
|
5
|
+
import "../interfaces/MessengerInterface.sol";
|
|
6
|
+
import "@openzeppelin/contracts/access/Ownable.sol";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @notice Sends cross chain messages Arbitrum L2 network.
|
|
10
|
+
* @dev This contract's owner should be set to the BridgeAdmin deployed on the same L1 network so that only the
|
|
11
|
+
* BridgeAdmin can call cross-chain administrative functions on the L2 DepositBox via this messenger.
|
|
12
|
+
* @dev This address will be the sender of any L1 --> L2 retryable tickets, so it should be set as the cross domain
|
|
13
|
+
* owner for L2 contracts that expect to receive cross domain messages.
|
|
14
|
+
*/
|
|
15
|
+
contract Arbitrum_Messenger is Ownable, Arbitrum_CrossDomainEnabled, MessengerInterface {
|
|
16
|
+
event RelayedMessage(
|
|
17
|
+
address indexed from,
|
|
18
|
+
address indexed to,
|
|
19
|
+
uint256 indexed seqNum,
|
|
20
|
+
address userToRefund,
|
|
21
|
+
uint256 l1CallValue,
|
|
22
|
+
uint256 gasLimit,
|
|
23
|
+
uint256 gasPrice,
|
|
24
|
+
uint256 maxSubmissionCost,
|
|
25
|
+
bytes data
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param _inbox Contract that sends generalized messages to the Arbitrum chain.
|
|
30
|
+
*/
|
|
31
|
+
constructor(address _inbox) Arbitrum_CrossDomainEnabled(_inbox) {}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @notice Sends a message to an account on L2. If this message reverts on l2 for any reason it can either be
|
|
35
|
+
* resent on L1, or redeemed on L2 manually. To learn more see how "retryable tickets" work on Arbitrum
|
|
36
|
+
* https://developer.offchainlabs.com/docs/l1_l2_messages#parameters
|
|
37
|
+
* @param target The intended recipient on L2.
|
|
38
|
+
* @param userToRefund User on L2 to refund extra fees to.
|
|
39
|
+
* @param l1CallValue Amount of ETH deposited to `target` contract on L2. Used to pay for L2 submission fee and
|
|
40
|
+
* l2CallValue. This will usually be > 0.
|
|
41
|
+
* @param gasLimit The gasLimit for the receipt of the message on L2.
|
|
42
|
+
* @param gasPrice Gas price bid for L2 execution.
|
|
43
|
+
* @param maxSubmissionCost: Max gas deducted from user's L2 balance to cover base submission fee.
|
|
44
|
+
* This amount is proportional to the size of `data`.
|
|
45
|
+
* @param message The data to send to the target (usually calldata to a function with
|
|
46
|
+
* `onlyFromCrossDomainAccount()`)
|
|
47
|
+
*/
|
|
48
|
+
function relayMessage(
|
|
49
|
+
address target,
|
|
50
|
+
address userToRefund,
|
|
51
|
+
uint256 l1CallValue,
|
|
52
|
+
uint256 gasLimit,
|
|
53
|
+
uint256 gasPrice,
|
|
54
|
+
uint256 maxSubmissionCost,
|
|
55
|
+
bytes memory message
|
|
56
|
+
) external payable override onlyOwner {
|
|
57
|
+
// Since we know the L2 target's address in advance, we don't need to alias an L1 address.
|
|
58
|
+
uint256 seqNumber =
|
|
59
|
+
sendTxToL2NoAliassing(target, userToRefund, l1CallValue, maxSubmissionCost, gasLimit, gasPrice, message);
|
|
60
|
+
emit RelayedMessage(
|
|
61
|
+
msg.sender,
|
|
62
|
+
target,
|
|
63
|
+
seqNumber,
|
|
64
|
+
userToRefund,
|
|
65
|
+
l1CallValue,
|
|
66
|
+
gasLimit,
|
|
67
|
+
gasPrice,
|
|
68
|
+
maxSubmissionCost,
|
|
69
|
+
message
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @notice Helper view methods designed to be called by BridgePool contracts.
|
|
6
|
+
*/
|
|
7
|
+
interface BridgeAdminInterface {
|
|
8
|
+
event SetDepositContracts(
|
|
9
|
+
uint256 indexed chainId,
|
|
10
|
+
address indexed l2DepositContract,
|
|
11
|
+
address indexed l2MessengerContract
|
|
12
|
+
);
|
|
13
|
+
event SetCrossDomainAdmin(uint256 indexed chainId, address indexed newAdmin);
|
|
14
|
+
event SetRelayIdentifier(bytes32 indexed identifier);
|
|
15
|
+
event SetOptimisticOracleLiveness(uint32 indexed liveness);
|
|
16
|
+
event SetProposerBondPct(uint64 indexed proposerBondPct);
|
|
17
|
+
event WhitelistToken(uint256 chainId, address indexed l1Token, address indexed l2Token, address indexed bridgePool);
|
|
18
|
+
event SetMinimumBridgingDelay(uint256 indexed chainId, uint64 newMinimumBridgingDelay);
|
|
19
|
+
event DepositsEnabled(uint256 indexed chainId, address indexed l2Token, bool depositsEnabled);
|
|
20
|
+
event BridgePoolsAdminTransferred(address[] bridgePools, address indexed newAdmin);
|
|
21
|
+
event SetLpFeeRate(address indexed bridgePool, uint64 newLpFeeRatePerSecond);
|
|
22
|
+
|
|
23
|
+
function finder() external view returns (address);
|
|
24
|
+
|
|
25
|
+
struct DepositUtilityContracts {
|
|
26
|
+
address depositContract; // L2 deposit contract where cross-chain relays originate.
|
|
27
|
+
address messengerContract; // L1 helper contract that can send a message to the L2 with the mapped network ID.
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function depositContracts(uint256) external view returns (DepositUtilityContracts memory);
|
|
31
|
+
|
|
32
|
+
struct L1TokenRelationships {
|
|
33
|
+
mapping(uint256 => address) l2Tokens; // L2 Chain Id to l2Token address.
|
|
34
|
+
address bridgePool;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function whitelistedTokens(address, uint256) external view returns (address l2Token, address bridgePool);
|
|
38
|
+
|
|
39
|
+
function optimisticOracleLiveness() external view returns (uint32);
|
|
40
|
+
|
|
41
|
+
function proposerBondPct() external view returns (uint64);
|
|
42
|
+
|
|
43
|
+
function identifier() external view returns (bytes32);
|
|
44
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
interface BridgePoolInterface {
|
|
7
|
+
function l1Token() external view returns (IERC20);
|
|
8
|
+
|
|
9
|
+
function changeAdmin(address newAdmin) external;
|
|
10
|
+
|
|
11
|
+
function setLpFeeRatePerSecond(uint64 _newLpFeeRatePerSecond) external;
|
|
12
|
+
|
|
13
|
+
function setRelaysEnabled(bool _relaysEnabled) external;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @notice Sends cross chain messages to contracts on a specific L2 network. The `relayMessage` implementation will
|
|
6
|
+
* differ for each L2.
|
|
7
|
+
*/
|
|
8
|
+
interface MessengerInterface {
|
|
9
|
+
function relayMessage(
|
|
10
|
+
address target,
|
|
11
|
+
address userToRefund,
|
|
12
|
+
uint256 l1CallValue,
|
|
13
|
+
uint256 gasLimit,
|
|
14
|
+
uint256 gasPrice,
|
|
15
|
+
uint256 maxSubmissionCost,
|
|
16
|
+
bytes memory message
|
|
17
|
+
) external payable;
|
|
18
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import "../BridgeDepositBox.sol";
|
|
5
|
+
import "@eth-optimism/contracts/libraries/bridge/CrossDomainEnabled.sol";
|
|
6
|
+
import "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol";
|
|
7
|
+
import "@eth-optimism/contracts/L2/messaging/IL2ERC20Bridge.sol";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @notice OVM specific bridge deposit box.
|
|
11
|
+
* @dev Uses OVM cross-domain-enabled logic for access control.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
contract OVM_BridgeDepositBox is BridgeDepositBox, CrossDomainEnabled {
|
|
15
|
+
// Address of the L1 contract that acts as the owner of this Bridge deposit box.
|
|
16
|
+
address public crossDomainAdmin;
|
|
17
|
+
|
|
18
|
+
event SetXDomainAdmin(address indexed newAdmin);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @notice Construct the Optimism Bridge Deposit Box
|
|
22
|
+
* @param _crossDomainAdmin Address of the L1 contract that can call admin functions on this contract from L1.
|
|
23
|
+
* @param _minimumBridgingDelay Minimum second that must elapse between L2->L1 token transfer to prevent dos.
|
|
24
|
+
* @param _chainId L2 Chain identifier this deposit box is deployed on.
|
|
25
|
+
* @param _l1Weth Address of Weth on L1. Used to inform if the deposit should wrap ETH to WETH, if deposit is ETH.
|
|
26
|
+
* @param timerAddress Timer used to synchronize contract time in testing. Set to 0x000... in production.
|
|
27
|
+
*/
|
|
28
|
+
constructor(
|
|
29
|
+
address _crossDomainAdmin,
|
|
30
|
+
uint64 _minimumBridgingDelay,
|
|
31
|
+
uint256 _chainId,
|
|
32
|
+
address _l1Weth,
|
|
33
|
+
address timerAddress
|
|
34
|
+
)
|
|
35
|
+
CrossDomainEnabled(Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER)
|
|
36
|
+
BridgeDepositBox(_minimumBridgingDelay, _chainId, _l1Weth, timerAddress)
|
|
37
|
+
{
|
|
38
|
+
_setCrossDomainAdmin(_crossDomainAdmin);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**************************************
|
|
42
|
+
* ADMIN FUNCTIONS *
|
|
43
|
+
**************************************/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @notice Changes the L1 contract that can trigger admin functions on this L2 deposit deposit box.
|
|
47
|
+
* @dev This should be set to the address of the L1 contract that ultimately relays a cross-domain message, which
|
|
48
|
+
* is expected to be the Optimism_Messenger.
|
|
49
|
+
* @dev Only callable by the existing admin via the Optimism cross domain messenger.
|
|
50
|
+
* @param newCrossDomainAdmin address of the new L1 admin contract.
|
|
51
|
+
*/
|
|
52
|
+
function setCrossDomainAdmin(address newCrossDomainAdmin) public onlyFromCrossDomainAccount(crossDomainAdmin) {
|
|
53
|
+
_setCrossDomainAdmin(newCrossDomainAdmin);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @notice Changes the minimum time in seconds that must elapse between withdraws from L2->L1.
|
|
58
|
+
* @dev Only callable by the existing crossDomainAdmin via the optimism cross domain messenger.
|
|
59
|
+
* @param newMinimumBridgingDelay the new minimum delay.
|
|
60
|
+
*/
|
|
61
|
+
function setMinimumBridgingDelay(uint64 newMinimumBridgingDelay)
|
|
62
|
+
public
|
|
63
|
+
onlyFromCrossDomainAccount(crossDomainAdmin)
|
|
64
|
+
{
|
|
65
|
+
_setMinimumBridgingDelay(newMinimumBridgingDelay);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @notice Enables L1 owner to whitelist a L1 Token <-> L2 Token pair for bridging.
|
|
70
|
+
* @dev Only callable by the existing crossDomainAdmin via the optimism cross domain messenger.
|
|
71
|
+
* @param l1Token Address of the canonical L1 token. This is the token users will receive on Ethereum.
|
|
72
|
+
* @param l2Token Address of the L2 token representation. This is the token users would deposit on optimism.
|
|
73
|
+
* @param l1BridgePool Address of the L1 withdrawal pool linked to this L2+L1 token.
|
|
74
|
+
*/
|
|
75
|
+
function whitelistToken(
|
|
76
|
+
address l1Token,
|
|
77
|
+
address l2Token,
|
|
78
|
+
address l1BridgePool
|
|
79
|
+
) public onlyFromCrossDomainAccount(crossDomainAdmin) {
|
|
80
|
+
_whitelistToken(l1Token, l2Token, l1BridgePool);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @notice L1 owner can enable/disable deposits for a whitelisted token.
|
|
85
|
+
* @dev Only callable by the existing crossDomainAdmin via the optimism cross domain messenger.
|
|
86
|
+
* @param l2Token address of L2 token to enable/disable deposits for.
|
|
87
|
+
* @param depositsEnabled bool to set if the deposit box should accept/reject deposits.
|
|
88
|
+
*/
|
|
89
|
+
function setEnableDeposits(address l2Token, bool depositsEnabled)
|
|
90
|
+
public
|
|
91
|
+
onlyFromCrossDomainAccount(crossDomainAdmin)
|
|
92
|
+
{
|
|
93
|
+
_setEnableDeposits(l2Token, depositsEnabled);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**************************************
|
|
97
|
+
* RELAYER FUNCTIONS *
|
|
98
|
+
**************************************/
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @notice Called by relayer (or any other EOA) to move a batch of funds from the deposit box, through the canonical
|
|
102
|
+
* token bridge, to the L1 Withdraw box.
|
|
103
|
+
* @dev The frequency that this function can be called is rate limited by the `minimumBridgingDelay` to prevent spam
|
|
104
|
+
* on L1 as the finalization of a L2->L1 tx is quite expensive.
|
|
105
|
+
* @param l2Token L2 token to relay over the canonical bridge.
|
|
106
|
+
* @param l1Gas Unused by optimism, but included for potential forward compatibility considerations.
|
|
107
|
+
*/
|
|
108
|
+
function bridgeTokens(address l2Token, uint32 l1Gas) public virtual override nonReentrant() {
|
|
109
|
+
uint256 bridgeDepositBoxBalance = TokenLike(l2Token).balanceOf(address(this));
|
|
110
|
+
require(bridgeDepositBoxBalance > 0, "can't bridge zero tokens");
|
|
111
|
+
require(canBridge(l2Token), "non-whitelisted token or last bridge too recent");
|
|
112
|
+
|
|
113
|
+
whitelistedTokens[l2Token].lastBridgeTime = uint64(getCurrentTime());
|
|
114
|
+
|
|
115
|
+
IL2ERC20Bridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo(
|
|
116
|
+
l2Token, // _l2Token. Address of the L2 token to bridge over.
|
|
117
|
+
whitelistedTokens[l2Token].l1BridgePool, // _to. Withdraw, over the bridge, to the l1 withdraw contract.
|
|
118
|
+
bridgeDepositBoxBalance, // _amount. Send the full balance of the deposit box to bridge.
|
|
119
|
+
l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations
|
|
120
|
+
"" // _data. We don't need to send any data for the bridging action.
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
emit TokensBridged(l2Token, bridgeDepositBoxBalance, l1Gas, msg.sender);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**************************************
|
|
127
|
+
* INTERNAL FUNCTIONS *
|
|
128
|
+
**************************************/
|
|
129
|
+
|
|
130
|
+
function _setCrossDomainAdmin(address newCrossDomainAdmin) internal {
|
|
131
|
+
require(newCrossDomainAdmin != address(0), "Bad bridge router address");
|
|
132
|
+
crossDomainAdmin = newCrossDomainAdmin;
|
|
133
|
+
emit SetXDomainAdmin(crossDomainAdmin);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Copied directly from https://github.com/ethereum-optimism/optimism/blob/7ffb83509c589bd35c2e5f9cb2c6ccbd5f346175/packages/contracts/contracts/optimistic-ethereum/libraries/bridge/OVM_CrossDomainEnabled.sol
|
|
2
|
+
// with a change to the solidity version. Old line is commented out for transparency.
|
|
3
|
+
|
|
4
|
+
// SPDX-License-Identifier: MIT
|
|
5
|
+
// pragma solidity >0.5.0 <0.8.0;
|
|
6
|
+
pragma solidity ^0.8.0;
|
|
7
|
+
|
|
8
|
+
/* Interface Imports */
|
|
9
|
+
import "./iOVM_CrossDomainMessenger.sol";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @title OVM_CrossDomainEnabled
|
|
13
|
+
* @dev Helper contract for contracts performing cross-domain communications
|
|
14
|
+
*
|
|
15
|
+
* Compiler used: defined by inheriting contract
|
|
16
|
+
* Runtime target: defined by inheriting contract
|
|
17
|
+
*/
|
|
18
|
+
contract OVM_CrossDomainEnabled {
|
|
19
|
+
/*************
|
|
20
|
+
* Variables *
|
|
21
|
+
*************/
|
|
22
|
+
|
|
23
|
+
// Messenger contract used to send and recieve messages from the other domain.
|
|
24
|
+
address public messenger;
|
|
25
|
+
|
|
26
|
+
/***************
|
|
27
|
+
* Constructor *
|
|
28
|
+
***************/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param _messenger Address of the CrossDomainMessenger on the current layer.
|
|
32
|
+
*/
|
|
33
|
+
constructor(address _messenger) {
|
|
34
|
+
messenger = _messenger;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**********************
|
|
38
|
+
* Function Modifiers *
|
|
39
|
+
**********************/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Enforces that the modified function is only callable by a specific cross-domain account.
|
|
43
|
+
* @param _sourceDomainAccount The only account on the originating domain which is
|
|
44
|
+
* authenticated to call this function.
|
|
45
|
+
*/
|
|
46
|
+
modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {
|
|
47
|
+
require(msg.sender == address(getCrossDomainMessenger()), "OVM_XCHAIN: messenger contract unauthenticated");
|
|
48
|
+
|
|
49
|
+
require(
|
|
50
|
+
getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,
|
|
51
|
+
"OVM_XCHAIN: wrong sender of cross-domain message"
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
_;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**********************
|
|
58
|
+
* Internal Functions *
|
|
59
|
+
**********************/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Gets the messenger, usually from storage. This function is exposed in case a child contract
|
|
63
|
+
* needs to override.
|
|
64
|
+
* @return The address of the cross-domain messenger contract which should be used.
|
|
65
|
+
*/
|
|
66
|
+
function getCrossDomainMessenger() internal virtual returns (iOVM_CrossDomainMessenger) {
|
|
67
|
+
return iOVM_CrossDomainMessenger(messenger);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Sends a message to an account on another domain
|
|
72
|
+
* @param _crossDomainTarget The intended recipient on the destination domain
|
|
73
|
+
* @param _message The data to send to the target (usually calldata to a function with
|
|
74
|
+
* `onlyFromCrossDomainAccount()`)
|
|
75
|
+
* @param _gasLimit The gasLimit for the receipt of the message on the target domain.
|
|
76
|
+
*/
|
|
77
|
+
function sendCrossDomainMessage(
|
|
78
|
+
address _crossDomainTarget,
|
|
79
|
+
uint32 _gasLimit,
|
|
80
|
+
bytes memory _message
|
|
81
|
+
) internal {
|
|
82
|
+
getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
pragma solidity ^0.8.0;
|
|
2
|
+
|
|
3
|
+
import "./OVM_BridgeDepositBox.sol";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @title OVM_OETH_BridgeDepositBox
|
|
7
|
+
* @dev Modified version of OVM_BridgeDepositBox that supports Optimism ETH being sent over the canonical bridge as ETH.
|
|
8
|
+
* This is re-wrapped to WETH on L2. All other functionality remains the same.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
contract OVM_OETH_BridgeDepositBox is OVM_BridgeDepositBox {
|
|
12
|
+
// l2Eth is ETH on Optimism. This acts as both an ERC20 and ETH on the OVM. In production is deployed at address
|
|
13
|
+
// 0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000. We need to know the address in this contract as the Optimism bridge
|
|
14
|
+
// does not support WETH so we need to unwrap to ETH first then send over ETH.
|
|
15
|
+
address public l2Eth;
|
|
16
|
+
// The L1 ETH Wrapper contract receives ETH, wraps it to WETH and sends it to the BridgePool. This enables the
|
|
17
|
+
// us to keep the same L1 contracts while supporting Optimsim.
|
|
18
|
+
address public l1EthWrapper;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @notice Construct the Optimism Bridge Deposit Box
|
|
22
|
+
* @param _crossDomainAdmin Address of the L1 contract that can call admin functions on this contract from L1.
|
|
23
|
+
* @param _minimumBridgingDelay Minimum second that must elapse between L2->L1 token transfer to prevent dos.
|
|
24
|
+
* @param _chainId L2 Chain identifier this deposit box is deployed on.
|
|
25
|
+
* @param _l1Weth Address of Weth on L1. Used to inform if a bridging action should wrap ETH to WETH, if the desired
|
|
26
|
+
* asset-to-bridge is for a whitelisted token mapped to this L1 Weth token.
|
|
27
|
+
* @param _l2Eth Address of ETH on L2. If someone wants to bridge L2 Weth from this contract to L1, then L2 ETH
|
|
28
|
+
* should be sent over the Optimism bridge.
|
|
29
|
+
* @param _l1EthWrapper Address of custom ETH wrapper on L1. Any ETH sent to this contract will be wrapped to WETH
|
|
30
|
+
* and sent to the WETH Bridge Pool.
|
|
31
|
+
* @param timerAddress Timer used to synchronize contract time in testing. Set to 0x000... in production.
|
|
32
|
+
*/
|
|
33
|
+
constructor(
|
|
34
|
+
address _crossDomainAdmin,
|
|
35
|
+
uint64 _minimumBridgingDelay,
|
|
36
|
+
uint256 _chainId,
|
|
37
|
+
address _l1Weth,
|
|
38
|
+
address _l2Eth,
|
|
39
|
+
address _l1EthWrapper,
|
|
40
|
+
address timerAddress
|
|
41
|
+
) OVM_BridgeDepositBox(_crossDomainAdmin, _minimumBridgingDelay, _chainId, _l1Weth, timerAddress) {
|
|
42
|
+
l2Eth = _l2Eth;
|
|
43
|
+
l1EthWrapper = _l1EthWrapper;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @notice Called by relayer (or any other EOA) to move a batch of funds from the deposit box, through the canonical
|
|
48
|
+
* token bridge, to the L1 Withdraw box. Implementation is exactly the same as the standard OVM_BridgeDepositBox
|
|
49
|
+
* except constructed to work with Optimism ETH by first unwrapping WETH then bridging OETH. The target on L1 is
|
|
50
|
+
* not the bridgePool but to the l1EthWrapper that takes any ETH sent to it, wraps it and sends to the BridgePool.
|
|
51
|
+
* @dev The frequency that this function can be called is rate limited by the `minimumBridgingDelay` to prevent spam
|
|
52
|
+
* on L1 as the finalization of a L2->L1 tx is quite expensive.
|
|
53
|
+
* @param l2Token L2 token to relay over the canonical bridge.
|
|
54
|
+
* @param l1Gas Unused by optimism, but included for potential forward compatibility considerations.
|
|
55
|
+
*/
|
|
56
|
+
function bridgeTokens(address l2Token, uint32 l1Gas) public override nonReentrant() {
|
|
57
|
+
uint256 bridgeDepositBoxBalance = TokenLike(l2Token).balanceOf(address(this));
|
|
58
|
+
require(bridgeDepositBoxBalance > 0, "can't bridge zero tokens");
|
|
59
|
+
require(canBridge(l2Token), "non-whitelisted token or last bridge too recent");
|
|
60
|
+
|
|
61
|
+
whitelistedTokens[l2Token].lastBridgeTime = uint64(getCurrentTime());
|
|
62
|
+
|
|
63
|
+
address bridgePool = whitelistedTokens[l2Token].l1BridgePool;
|
|
64
|
+
|
|
65
|
+
// If the l1Token mapping to the l2Token is l1Weth, then to work with the canonical optimism bridge, we first
|
|
66
|
+
// unwrap it to ETH then bridge the newly unwraped L2 ETH over the canonical bridge. On L1 the l1EthWrapper will
|
|
67
|
+
// re-wrap the ETH to WETH and send it to the WETH bridge pool.
|
|
68
|
+
if (whitelistedTokens[l2Token].l1Token == l1Weth) {
|
|
69
|
+
WETH9Like(l2Token).withdraw(bridgeDepositBoxBalance);
|
|
70
|
+
l2Token = l2Eth;
|
|
71
|
+
bridgePool = l1EthWrapper;
|
|
72
|
+
}
|
|
73
|
+
IL2ERC20Bridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo(
|
|
74
|
+
l2Token, // _l2Token. Address of the L2 token to bridge over.
|
|
75
|
+
bridgePool, // _to. Withdraw, over the bridge, to the l1 withdraw contract.
|
|
76
|
+
bridgeDepositBoxBalance, // _amount. Send the full balance of the deposit box to bridge.
|
|
77
|
+
l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations
|
|
78
|
+
"" // _data. We don't need to send any data for the bridging action.
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
emit TokensBridged(l2Token, bridgeDepositBoxBalance, l1Gas, msg.sender);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Fallback function to enable this contract to receive ETH sent to it via WETH unwrapping. When l2ETH is unwrapped
|
|
85
|
+
// from l2WETH, the l2ETH is sent to this contract before being sent over the canonical Optimism's bridge.
|
|
86
|
+
receive() external payable {}
|
|
87
|
+
|
|
88
|
+
fallback() external payable {}
|
|
89
|
+
}
|