-
Notifications
You must be signed in to change notification settings - Fork 78
chrismaree/mainnet deployment #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // SPDX-License-Identifier: GPL-3.0-only | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import "./Optimism_SpokePool.sol"; | ||
|
|
||
| /** | ||
| * @notice Boba Spoke pool. Exact copy of the Optimism_SpokePool with no modifications. | ||
| */ | ||
| contract Boba_SpokePool is Optimism_SpokePool { | ||
| /** | ||
| * @notice Construct the OVM Boba SpokePool. | ||
| * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin. | ||
| * @param _hubPool Hub pool address to set. Can be changed by admin. | ||
| * @param timerAddress Timer address to set. | ||
| */ | ||
| constructor( | ||
| address _crossDomainAdmin, | ||
| address _hubPool, | ||
| address timerAddress | ||
| ) Optimism_SpokePool(_crossDomainAdmin, _hubPool, timerAddress) {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| // SPDX-License-Identifier: AGPL-3.0-only | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import "../interfaces/AdapterInterface.sol"; | ||
| import "../interfaces/WETH9.sol"; | ||
|
|
||
| // @dev Use local modified CrossDomainEnabled contract instead of one exported by eth-optimism because we need | ||
| // this contract's state variables to be `immutable` because of the delegateCall call. | ||
| import "./CrossDomainEnabled.sol"; | ||
| import "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol"; | ||
|
|
||
| import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
| import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; | ||
|
|
||
| /** | ||
| * @notice Contract containing logic to send messages from L1 to Boba. This is a modified version of the Optimism adapter | ||
| * that excludes the custom bridging logic. | ||
| * @dev Public functions calling external contracts do not guard against reentrancy because they are expected to be | ||
| * called via delegatecall, which will execute this contract's logic within the context of the originating contract. | ||
| * For example, the HubPool will delegatecall these functions, therefore its only necessary that the HubPool's methods | ||
| * that call this contract's logic guard against reentrancy. | ||
| */ | ||
|
|
||
| // solhint-disable-next-line contract-name-camelcase | ||
| contract Boba_Adapter is CrossDomainEnabled, AdapterInterface { | ||
| using SafeERC20 for IERC20; | ||
| uint32 public immutable l2GasLimit = 2_000_000; | ||
|
|
||
| WETH9 public immutable l1Weth; | ||
|
|
||
| IL1StandardBridge public immutable l1StandardBridge; | ||
|
|
||
| /** | ||
| * @notice Constructs new Adapter. | ||
| * @param _l1Weth WETH address on L1. | ||
| * @param _crossDomainMessenger XDomainMessenger Boba system contract. | ||
| * @param _l1StandardBridge Standard bridge contract. | ||
| */ | ||
| constructor( | ||
| WETH9 _l1Weth, | ||
| address _crossDomainMessenger, | ||
| IL1StandardBridge _l1StandardBridge | ||
| ) CrossDomainEnabled(_crossDomainMessenger) { | ||
| l1Weth = _l1Weth; | ||
| l1StandardBridge = _l1StandardBridge; | ||
| } | ||
|
|
||
| /** | ||
| * @notice Send cross-chain message to target on Boba. | ||
| * @param target Contract on Boba that will receive message. | ||
| * @param message Data to send to target. | ||
| */ | ||
| function relayMessage(address target, bytes calldata message) external payable override { | ||
| sendCrossDomainMessage(target, uint32(l2GasLimit), message); | ||
| emit MessageRelayed(target, message); | ||
| } | ||
|
|
||
| /** | ||
| * @notice Bridge tokens to Boba. | ||
| * @param l1Token L1 token to deposit. | ||
| * @param l2Token L2 token to receive. | ||
| * @param amount Amount of L1 tokens to deposit and L2 tokens to receive. | ||
| * @param to Bridge recipient. | ||
| */ | ||
| function relayTokens( | ||
| address l1Token, | ||
| address l2Token, | ||
| uint256 amount, | ||
| address to | ||
| ) external payable override { | ||
| // If the l1Token is weth then unwrap it to ETH then send the ETH to the standard bridge. | ||
| if (l1Token == address(l1Weth)) { | ||
| l1Weth.withdraw(amount); | ||
| l1StandardBridge.depositETHTo{ value: amount }(to, l2GasLimit, ""); | ||
| } else { | ||
| IL1StandardBridge _l1StandardBridge = l1StandardBridge; | ||
|
|
||
| IERC20(l1Token).safeIncreaseAllowance(address(_l1StandardBridge), amount); | ||
| _l1StandardBridge.depositERC20To(l1Token, l2Token, to, amount, l2GasLimit, ""); | ||
| } | ||
| emit TokensRelayed(l1Token, l2Token, amount, to); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import { L1_ADDRESS_MAP } from "./consts"; | ||
|
|
||
| import "hardhat-deploy"; | ||
| import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; | ||
|
|
||
| const func = async function (hre: HardhatRuntimeEnvironment) { | ||
| const { deployments, getNamedAccounts, getChainId } = hre; | ||
| const { deploy } = deployments; | ||
|
|
||
| const { deployer } = await getNamedAccounts(); | ||
|
|
||
| const chainId = parseInt(await getChainId()); | ||
|
|
||
| await deploy("Boba_Adapter", { | ||
| from: deployer, | ||
| log: true, | ||
| skipIfAlreadyDeployed: true, | ||
| args: [ | ||
| L1_ADDRESS_MAP[chainId].weth, | ||
| L1_ADDRESS_MAP[chainId].bobaCrossDomainMessenger, | ||
| L1_ADDRESS_MAP[chainId].bobaStandardBridge, | ||
| ], | ||
| }); | ||
| }; | ||
|
|
||
| module.exports = func; | ||
| func.dependencies = ["HubPool"]; | ||
| func.tags = ["BobaAdapter", "mainnet"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import "hardhat-deploy"; | ||
| import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; | ||
|
|
||
| const func = async function (hre: HardhatRuntimeEnvironment) { | ||
| const { deployments, getNamedAccounts, companionNetworks } = hre; | ||
| const { deploy } = deployments; | ||
|
|
||
| const { deployer } = await getNamedAccounts(); | ||
|
|
||
| // Grab L1 addresses: | ||
| const { deployments: l1Deployments } = companionNetworks.l1; | ||
| const hubPool = await l1Deployments.get("HubPool"); | ||
| console.log(`Using l1 hub pool @ ${hubPool.address}`); | ||
|
|
||
| // Boba Spoke pool uses the same implementation as optimism, with no changes. | ||
| await deploy("Boba_SpokePool", { | ||
| from: deployer, | ||
| log: true, | ||
| skipIfAlreadyDeployed: true, | ||
| args: [ | ||
| hubPool.address, // Set hub pool as cross domain admin since it delegatecalls the Optimism_Adapter logic. | ||
| hubPool.address, | ||
| "0x0000000000000000000000000000000000000000", // timer | ||
| ], | ||
| }); | ||
| }; | ||
| module.exports = func; | ||
| func.tags = ["BobaSpokePool", "boba"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Across Mainnet Deployment Addresses | ||
|
|
||
| ## Mainnet (1) | ||
|
|
||
| | Contract Name | Address | | ||
| | ------------------- | --------------------------------------------------------------------------------------------------------------------- | | ||
| | LPTokenFactory | [0x7dB69eb9F52eD773E9b03f5068A1ea0275b2fD9d](https://etherscan.io/address/0x7dB69eb9F52eD773E9b03f5068A1ea0275b2fD9d) | | ||
| | HubPool | [0x6Bb9910c5529Cb3b32c4f0e13E8bC38F903b2534](https://etherscan.io/address/0x6Bb9910c5529Cb3b32c4f0e13E8bC38F903b2534) | | ||
| | Optimism_Adapter | [0x22eD83A9eE26236486F57cE8385A247E5bFB71fF](https://etherscan.io/address/0x22eD83A9eE26236486F57cE8385A247E5bFB71fF) | | ||
| | Boba_Adapter | [0x33B0Ec794c15D6Cc705818E70d4CaCe7bCfB5Af3](https://etherscan.io/address/0x33B0Ec794c15D6Cc705818E70d4CaCe7bCfB5Af3) | | ||
| | Arbitrum_Adapter | [0x937958992799bF4A9a656E6596FD10d7Da5c2216](https://etherscan.io/address/0x937958992799bF4A9a656E6596FD10d7Da5c2216) | | ||
| | Ethereum_Adapter | [0x527E872a5c3f0C7c24Fe33F2593cFB890a285084](https://etherscan.io/address/0x527E872a5c3f0C7c24Fe33F2593cFB890a285084) | | ||
| | Ethereum_SpokePool | [0x931A43528779034ac9eb77df799d133557406176](https://etherscan.io/address/0x931A43528779034ac9eb77df799d133557406176) | | ||
| | PolygonTokenBridger | [0x48d990AbDA20afa1fD1da713AbC041B60a922c65](https://etherscan.io/address/0x48d990AbDA20afa1fD1da713AbC041B60a922c65) | | ||
| | Polygon_Adapter | [0x3E94e8d4316a1eBfb2245E45E6F0B8724094CE1A](https://etherscan.io/address/0x3E94e8d4316a1eBfb2245E45E6F0B8724094CE1A) | | ||
| | AcrossConfigStore | [0x3B03509645713718B78951126E0A6de6f10043f5](https://etherscan.io/address/0x3B03509645713718B78951126E0A6de6f10043f5) | | ||
|
|
||
| ## Optimism mainnet (10) | ||
|
|
||
| | Contract Name | Address | | ||
| | ------------------ | -------------------------------------------------------------------------------------------------------------------------------- | | ||
| | Optimism_SpokePool | [0x59485d57EEcc4058F7831f46eE83a7078276b4AE](https://optimistic.etherscan.io/address/0x59485d57EEcc4058F7831f46eE83a7078276b4AE) | | ||
|
|
||
| ## Polygon mainnet(137) | ||
|
|
||
| | Contract Name | Address | | ||
| | ------------------- | ------------------------------------------------------------------------------------------------------------------------ | | ||
| | PolygonTokenBridger | [0x48d990AbDA20afa1fD1da713AbC041B60a922c65](https://polygonscan.com/address/0x48d990AbDA20afa1fD1da713AbC041B60a922c65) | | ||
| | Polygon_SpokePool | [0xD3ddAcAe5aFb00F9B9cD36EF0Ed7115d7f0b584c](https://polygonscan.com/address/0xD3ddAcAe5aFb00F9B9cD36EF0Ed7115d7f0b584c) | | ||
|
|
||
| ## Boba mainnet (288) | ||
|
|
||
| | Contract Name | Address | | ||
| | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | Boba_SpokePool | [0x7229405a2f0c550Ce35182EE1658302B65672443](https://blockexplorer.boba.network/address/0x7229405a2f0c550Ce35182EE1658302B65672443/contracts) | | ||
|
|
||
| ## Arbitrum mainnet (42161) | ||
|
|
||
| | Contract Name | Address | | ||
| | ------------------ | -------------------------------------------------------------------------------------------------------------------- | | ||
| | Arbitrum_SpokePool | [0xe1C367e2b576Ac421a9f46C9cC624935730c36aa](https://arbiscan.io/address/0xe1C367e2b576Ac421a9f46C9cC624935730c36aa) | | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 42161 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewers! see this file