diff --git a/contracts/docs/StatusNetwork.md b/contracts/docs/StatusNetwork.md new file mode 100644 index 00000000..2b696e46 --- /dev/null +++ b/contracts/docs/StatusNetwork.md @@ -0,0 +1,99 @@ +# Status Network + +## Devnet + +### 📬 Devnet Deployed Contracts + +These are the official contract deployments on the **Holesky** for L1 and Status Devnet for L2. + +| Chain | Contract | Address | +|---------|----------------------------------|-----------------------------------------------------------------------------------------------------| +| Holesky | **Yield Manager** | [0xcaf71dee9d59d0095ec37c1ffa7e4b8fd3114bc2](https://holesky.etherscan.io/address/0xcaf71dee9d59d0095ec37c1ffa7e4b8fd3114bc2#code)| +| Holesky | **L1ETHBridge (Proxy)** | [0xF62923E542BdEA2DeC8Da020480197A54c4CE53A](https://holesky.etherscan.io/address/0xF62923E542BdEA2DeC8Da020480197A54c4CE53A#code)| +| Holesky | **L1ETHBridge (Implementation)** | [0x99751ad60328abf73e8c938c0b7a9f9fd370f453](https://holesky.etherscan.io/address/0x99751ad60328abf73e8c938c0b7a9f9fd370f453#code)| +| Status Devnet | **L2ETHBridge (Proxy)** | [0x99751AD60328ABf73e8c938c0B7A9F9FD370f453](https://pumpi-blockscout.eu-north-2.gateway.fm/address/0x99751AD60328ABf73e8c938c0B7A9F9FD370f453)| +| Status Devnet | **L2ETHBridge (Implementation)** | [0xCaF71dEe9d59d0095eC37c1FFa7E4b8fD3114Bc2](https://pumpi-blockscout.eu-north-2.gateway.fm/address/0xCaF71dEe9d59d0095eC37c1FFa7E4b8fD3114Bc2)| + + + +The devnet test deployer is `0xD631542acd56eeBe466F16CBfEb937637b8b43c1`. + +### YieldManager + +Deploy a Dummy YieldManager contract on the Status Devnet. + +```bash +export ETH_FROM=0xD631542acd56eeBe466F16CBfEb937637b8b43c1 + +forge script \ + script/yield/bridge/l1/DeployDummyYieldManager.s.sol \ + --rpc-url https://ethereum-holesky-rpc.publicnode.com \ + --private-key $STATUS_DEVNET_DEPLOYER_KEY \ + --broadcast +``` + +Verify the contract on Etherscan: + +```bash +forge verify-contract --chain holesky CONTRACT_ADDRESS ETHYieldManagerMock +``` + +### L1ETHBridge + +Update the deployment config (`script/yield/bridge/l1/DeploymentConfig.s.sol`) to include the address of the `YieldManager` contract deployed above. + +The deployment config requires the address of the `L2ETHBridge` contract, which is the bridge on the L2 chain (Status Devnet). +If it's the first deployment, you won't have the `L2ETHBridge` deployed yet, so you need to set a temporary one like 0x1 +in the config script that must different from the zero address otherwise the deployment will fail. + +```bash +export ETH_FROM=0xD631542acd56eeBe466F16CBfEb937637b8b43c1 + +forge script \ + script/yield/bridge/l1/DeployL1ETHBridge.s.sol \ + --rpc-url https://ethereum-holesky-rpc.publicnode.com \ + --private-key $STATUS_DEVNET_DEPLOYER_KEY \ + --broadcast +``` + + +### L2ETHBridge + + +Update the deployment config (`script/yield/bridge/l2/DeploymentConfig.s.sol`) to include the address of the `L1ETHBridge` contract deployed above. + +```bash +export ETH_FROM=0xD631542acd56eeBe466F16CBfEb937637b8b43c1 + +forge script \ + script/yield/bridge/l2/DeployL2ETHBridge.s.sol \ + --rpc-url https://pumpi-rpc.eu-north-2.gateway.fm/ \ + --private-key $STATUS_DEVNET_DEPLOYER_KEY \ + --broadcast +``` + +Verify the implementation contract on Blockscout: + +```bash +forge verify-contract \ + --verifier blockscout \ + --compilation-profile london \ + --verifier-url https://pumpi-blockscout.eu-north-2.gateway.fm/api \ + --chain 762355666 \ + IMPLEMENTATION_ADDRESS \ + L2ETHBridge +``` + +Verify the proxy contract in case it hasn't been verified yet automatically by Blockscout: + +```bash +forge verify-contract \ + --verifier blockscout \ + --compilation-profile london \ + --verifier-url https://pumpi-blockscout.eu-north-2.gateway.fm/api \ + --chain 762355666 \ + PROXY_ADDRESS \ + node_modules/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy +``` + +Remember to set the `L2ETHBridge` address in the `L1ETHBridge` contract calling the `setRemoteSender` function. diff --git a/contracts/foundry.toml b/contracts/foundry.toml index ff7b9c82..840bd75d 100644 --- a/contracts/foundry.toml +++ b/contracts/foundry.toml @@ -20,5 +20,6 @@ additional_compiler_profiles = [ { name = "london", evm_version = "london" } ] compilation_restrictions = [ { paths = "./**/L2MessageService.sol", evm_version = "london" }, { paths = "./**/L2YieldMessageService.sol", evm_version = "london" }, + { paths = "./**/L2ETHBridge.sol", evm_version = "london" }, { paths = "./**/TokenBridge.sol", evm_version = "london" }, ] diff --git a/contracts/script/yield/bridge/l1/DeployDummyYieldManager.s.sol b/contracts/script/yield/bridge/l1/DeployDummyYieldManager.s.sol new file mode 100644 index 00000000..57a3862d --- /dev/null +++ b/contracts/script/yield/bridge/l1/DeployDummyYieldManager.s.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +import { BaseScript } from "../Base.s.sol"; +import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; + +import { DeploymentConfig } from "./DeploymentConfig.s.sol"; +import { ETHYieldManagerMock } from "../../../../test/foundry/bridging/eth/mocks/ETHYieldManagerMock.sol"; + +contract DeployDummyYieldManager is BaseScript { + function run() public returns (address, ETHYieldManagerMock) { + DeploymentConfig deploymentConfig = new DeploymentConfig(broadcaster); + (address deployer, address messageService, address remoteSender, address yieldManager) = deploymentConfig + .activeNetworkConfig(); + + vm.startBroadcast(deployer); + + ETHYieldManagerMock impl = new ETHYieldManagerMock(); + + vm.stopBroadcast(); + + return (deployer, impl); + } +} + diff --git a/contracts/script/yield/bridge/l1/DeploymentConfig.s.sol b/contracts/script/yield/bridge/l1/DeploymentConfig.s.sol index dc1b22de..5dc76c61 100644 --- a/contracts/script/yield/bridge/l1/DeploymentConfig.s.sol +++ b/contracts/script/yield/bridge/l1/DeploymentConfig.s.sol @@ -9,6 +9,15 @@ contract DeploymentConfig is Script { error DeploymentConfig_InvalidDeployerAddress(); error DeploymentConfig_NoConfigForChain(uint256); + // solhint-disable-next-line var-name-mixedcase + address internal LINEA_ROLLUP_ADDRESS_HOLESKY = 0xA12cc7568d08f848869707996dF47877C506466f; + + // solhint-disable-next-line var-name-mixedcase + address internal L2_ETH_BRIDGE_ADDRESS_DEVNET = 0x0000000000000000000000000000000000000001; + + // solhint-disable-next-line var-name-mixedcase + address internal YIELD_MANAGER_ADDRESS_HOLESKY = 0xCaF71dEe9d59d0095eC37c1FFa7E4b8fD3114Bc2; // ETHYieldManagerMock + struct NetworkConfig { address deployer; address messageService; @@ -25,6 +34,8 @@ contract DeploymentConfig is Script { deployer = _broadcaster; if (block.chainid == 31_337) { activeNetworkConfig = getOrCreateAnvilEthConfig(deployer); + } else if (block.chainid == 17_000) { + activeNetworkConfig = getOrCreateHoleskyEthConfig(deployer); } else { revert DeploymentConfig_NoConfigForChain(block.chainid); } @@ -43,6 +54,16 @@ contract DeploymentConfig is Script { }); } + function getOrCreateHoleskyEthConfig(address _deployer) public returns (NetworkConfig memory) { + return + NetworkConfig({ + deployer: _deployer, + messageService: LINEA_ROLLUP_ADDRESS_HOLESKY, + remoteSender: L2_ETH_BRIDGE_ADDRESS_DEVNET, + yieldManager: YIELD_MANAGER_ADDRESS_HOLESKY + }); + } + // This function is a hack to have it excluded by `forge coverage` until // https://github.com/foundry-rs/foundry/issues/2988 is fixed. // See: https://github.com/foundry-rs/foundry/issues/2988#issuecomment-1437784542 diff --git a/contracts/script/yield/bridge/l2/DeploymentConfig.s.sol b/contracts/script/yield/bridge/l2/DeploymentConfig.s.sol index cc25cd14..30a40cb9 100644 --- a/contracts/script/yield/bridge/l2/DeploymentConfig.s.sol +++ b/contracts/script/yield/bridge/l2/DeploymentConfig.s.sol @@ -18,11 +18,19 @@ contract DeploymentConfig is Script { address private deployer; + // solhint-disable-next-line var-name-mixedcase + address internal L2_MESSAGE_SERVICE_ADDRESS_DEVNET = 0x630fA6067c817542E85ADC368f188Fc90E4EB5ce; + + // solhint-disable-next-line var-name-mixedcase + address internal L1_ETH_BRIDGE_ADDRESS_DEVNET = 0xF62923E542BdEA2DeC8Da020480197A54c4CE53A; + constructor(address _broadcaster) { if (_broadcaster == address(0)) revert DeploymentConfig_InvalidDeployerAddress(); deployer = _broadcaster; if (block.chainid == 31_337) { activeNetworkConfig = getOrCreateAnvilEthConfig(deployer); + } else if (block.chainid == 762355666) { + activeNetworkConfig = getOrCreateStatusDevnetEthConfig(deployer); } else { revert DeploymentConfig_NoConfigForChain(block.chainid); } @@ -37,6 +45,15 @@ contract DeploymentConfig is Script { }); } + function getOrCreateStatusDevnetEthConfig(address _deployer) public returns (NetworkConfig memory) { + return + NetworkConfig({ + deployer: _deployer, + l2MessageService: L2_MESSAGE_SERVICE_ADDRESS_DEVNET, + l1ETHBridge: L1_ETH_BRIDGE_ADDRESS_DEVNET + }); + } + // This function is a hack to have it excluded by `forge coverage` until // https://github.com/foundry-rs/foundry/issues/2988 is fixed. // See: https://github.com/foundry-rs/foundry/issues/2988#issuecomment-1437784542