diff --git a/packages/contracts-bedrock/contracts/L1/interfaces/winddown/IBalanceClaimer.sol b/packages/contracts-bedrock/contracts/L1/interfaces/winddown/IBalanceClaimer.sol index 28d1248827c0..57662a83ee42 100644 --- a/packages/contracts-bedrock/contracts/L1/interfaces/winddown/IBalanceClaimer.sol +++ b/packages/contracts-bedrock/contracts/L1/interfaces/winddown/IBalanceClaimer.sol @@ -29,13 +29,13 @@ interface IBalanceClaimer { error InvalidMerkleRoot(); /// @notice the root of the merkle tree - function root() external view returns (bytes32); + function ROOT() external view returns (bytes32); /// @notice OptimismPortal ethBalanceWithdrawer contract - function ethBalanceWithdrawer() external view returns (IEthBalanceWithdrawer); + function ETH_BALANCE_WITHDRAWER() external view returns (IEthBalanceWithdrawer); /// @notice erc20BalanceWithdrawer contract - function erc20BalanceWithdrawer() external view returns (IErc20BalanceWithdrawer); + function ERC20_BALANCE_WITHDRAWER() external view returns (IErc20BalanceWithdrawer); /// @notice return users who claimed their balances function claimed(address) external view returns (bool); diff --git a/packages/contracts-bedrock/contracts/L1/winddown/BalanceClaimer.sol b/packages/contracts-bedrock/contracts/L1/winddown/BalanceClaimer.sol index 53f7b4d0221b..8fb3f34aa7bb 100644 --- a/packages/contracts-bedrock/contracts/L1/winddown/BalanceClaimer.sol +++ b/packages/contracts-bedrock/contracts/L1/winddown/BalanceClaimer.sol @@ -16,13 +16,13 @@ import { Semver } from "../../universal/Semver.sol"; */ contract BalanceClaimer is Semver, IBalanceClaimer { /// @inheritdoc IBalanceClaimer - bytes32 public immutable root; + bytes32 public immutable ROOT; /// @inheritdoc IBalanceClaimer - IEthBalanceWithdrawer public immutable ethBalanceWithdrawer; + IEthBalanceWithdrawer public immutable ETH_BALANCE_WITHDRAWER; /// @inheritdoc IBalanceClaimer - IErc20BalanceWithdrawer public immutable erc20BalanceWithdrawer; + IErc20BalanceWithdrawer public immutable ERC20_BALANCE_WITHDRAWER; /// @inheritdoc IBalanceClaimer mapping(address => bool) public claimed; @@ -35,9 +35,9 @@ contract BalanceClaimer is Semver, IBalanceClaimer { */ constructor(address _ethBalanceWithdrawer, address _erc20BalanceWithdrawer, bytes32 _root) Semver(1, 0, 0) { if (_root == 0) revert InvalidMerkleRoot(); - ethBalanceWithdrawer = IEthBalanceWithdrawer(_ethBalanceWithdrawer); - erc20BalanceWithdrawer = IErc20BalanceWithdrawer(_erc20BalanceWithdrawer); - root = _root; + ETH_BALANCE_WITHDRAWER = IEthBalanceWithdrawer(_ethBalanceWithdrawer); + ERC20_BALANCE_WITHDRAWER = IErc20BalanceWithdrawer(_erc20BalanceWithdrawer); + ROOT = _root; } /// @inheritdoc IBalanceClaimer @@ -51,11 +51,11 @@ contract BalanceClaimer is Semver, IBalanceClaimer { claimed[_user] = true; if (_erc20Claim.length != 0) { - erc20BalanceWithdrawer.withdrawErc20Balance(_user, _erc20Claim); + ERC20_BALANCE_WITHDRAWER.withdrawErc20Balance(_user, _erc20Claim); } if (_ethBalance != 0) { - ethBalanceWithdrawer.withdrawEthBalance(_user, _ethBalance); + ETH_BALANCE_WITHDRAWER.withdrawEthBalance(_user, _ethBalance); } emit BalanceClaimed({user: _user, ethBalance: _ethBalance, erc20TokenBalances: _erc20Claim}); @@ -72,6 +72,6 @@ contract BalanceClaimer is Semver, IBalanceClaimer { bytes32 _leaf = keccak256(bytes.concat(keccak256(abi.encode(_user, _ethBalance, _erc20Claim)))); - _canClaimTokens = MerkleProof.verify(_proof, root, _leaf); + _canClaimTokens = MerkleProof.verify(_proof, ROOT, _leaf); } } \ No newline at end of file diff --git a/packages/contracts-bedrock/contracts/test/winddown/integration/BalanceClaimer.t.sol b/packages/contracts-bedrock/contracts/test/winddown/integration/BalanceClaimer.t.sol index d907055348bd..9b1c0fe2cfc7 100644 --- a/packages/contracts-bedrock/contracts/test/winddown/integration/BalanceClaimer.t.sol +++ b/packages/contracts-bedrock/contracts/test/winddown/integration/BalanceClaimer.t.sol @@ -95,10 +95,10 @@ contract BalanceClaimerIntegration_Test is Bridge_Initializer { leaves = _getLeaves(_claimParams); tree = _mockRoot(leaves); - deal(token1, address(balanceClaimerProxy.erc20BalanceWithdrawer()), 600); - deal(token2, address(balanceClaimerProxy.erc20BalanceWithdrawer()), 600); - deal(token3, address(balanceClaimerProxy.erc20BalanceWithdrawer()), 900); - vm.deal(address(balanceClaimerProxy.ethBalanceWithdrawer()), 600); + deal(token1, address(balanceClaimerProxy.ERC20_BALANCE_WITHDRAWER()), 600); + deal(token2, address(balanceClaimerProxy.ERC20_BALANCE_WITHDRAWER()), 600); + deal(token3, address(balanceClaimerProxy.ERC20_BALANCE_WITHDRAWER()), 900); + vm.deal(address(balanceClaimerProxy.ETH_BALANCE_WITHDRAWER()), 600); } /// @dev Get the leaves for the merkle tree @@ -155,10 +155,10 @@ contract BalanceClaimerIntegration_Test is Bridge_Initializer { ); // Assertions - assertEq(address(balanceClaimerProxy.ethBalanceWithdrawer()).balance, 0); - assertEq(ERC20(token1).balanceOf(address(balanceClaimerProxy.erc20BalanceWithdrawer())), 0); - assertEq(ERC20(token2).balanceOf(address(balanceClaimerProxy.erc20BalanceWithdrawer())), 0); - assertEq(ERC20(token3).balanceOf(address(balanceClaimerProxy.erc20BalanceWithdrawer())), 0); + assertEq(address(balanceClaimerProxy.ETH_BALANCE_WITHDRAWER()).balance, 0); + assertEq(ERC20(token1).balanceOf(address(balanceClaimerProxy.ERC20_BALANCE_WITHDRAWER())), 0); + assertEq(ERC20(token2).balanceOf(address(balanceClaimerProxy.ERC20_BALANCE_WITHDRAWER())), 0); + assertEq(ERC20(token3).balanceOf(address(balanceClaimerProxy.ERC20_BALANCE_WITHDRAWER())), 0); assertEq(aliceClaimer.balance, aliceClaimParams.ethBalance); assertEq(ERC20(token2).balanceOf(aliceClaimer), aliceClaimParams.erc20TokenBalances[0].balance); diff --git a/packages/contracts-bedrock/contracts/test/winddown/unit/BalanceClaimer.t.sol b/packages/contracts-bedrock/contracts/test/winddown/unit/BalanceClaimer.t.sol index 9e04d840fa94..861885dcf45e 100644 --- a/packages/contracts-bedrock/contracts/test/winddown/unit/BalanceClaimer.t.sol +++ b/packages/contracts-bedrock/contracts/test/winddown/unit/BalanceClaimer.t.sol @@ -43,9 +43,9 @@ contract BalanceClaimer_Constructor_Test is BalanceClaimer_TestBase { /// @dev Test that the constructor sets the correct values. function test_constructor_succeeds() external { - assertEq(balanceClaimerProxy.root(), mockRoot); - assertEq(address(balanceClaimerProxy.ethBalanceWithdrawer()), mockOptimismPortal); - assertEq(address(balanceClaimerProxy.erc20BalanceWithdrawer()), mockL1StandardBridge); + assertEq(balanceClaimerProxy.ROOT(), mockRoot); + assertEq(address(balanceClaimerProxy.ETH_BALANCE_WITHDRAWER()), mockOptimismPortal); + assertEq(address(balanceClaimerProxy.ERC20_BALANCE_WITHDRAWER()), mockL1StandardBridge); } } @@ -165,13 +165,13 @@ contract BalanceClaimer_Test is BalanceClaimer_TestBase { return; } vm.mockCall( - address(balanceClaimerProxy.erc20BalanceWithdrawer()), + address(balanceClaimerProxy.ERC20_BALANCE_WITHDRAWER()), abi.encodeWithSelector(IErc20BalanceWithdrawer.withdrawErc20Balance.selector, _user, _erc20Claim), abi.encode(true) ); vm.expectCall( - address(balanceClaimerProxy.erc20BalanceWithdrawer()), + address(balanceClaimerProxy.ERC20_BALANCE_WITHDRAWER()), abi.encodeWithSelector(IErc20BalanceWithdrawer.withdrawErc20Balance.selector, _user, _erc20Claim) ); } @@ -182,13 +182,13 @@ contract BalanceClaimer_Test is BalanceClaimer_TestBase { return; } vm.mockCall( - address(balanceClaimerProxy.ethBalanceWithdrawer()), + address(balanceClaimerProxy.ETH_BALANCE_WITHDRAWER()), abi.encodeWithSelector(IEthBalanceWithdrawer.withdrawEthBalance.selector, _user, _ethBalance), abi.encode(true) ); vm.expectCall( - address(balanceClaimerProxy.ethBalanceWithdrawer()), + address(balanceClaimerProxy.ETH_BALANCE_WITHDRAWER()), abi.encodeWithSelector(IEthBalanceWithdrawer.withdrawEthBalance.selector, _user, _ethBalance) ); } diff --git a/packages/contracts-bedrock/package.json b/packages/contracts-bedrock/package.json index 7ae14a50c8b8..743c74d50a89 100644 --- a/packages/contracts-bedrock/package.json +++ b/packages/contracts-bedrock/package.json @@ -25,8 +25,8 @@ "autogen:artifacts": "ts-node scripts/generate-artifacts.ts", "autogen:invariant-docs": "ts-node scripts/invariant-doc-gen.ts", "deploy": "hardhat deploy", - "upgrade-prod:windown": "bash -c 'source .env && forge script scripts/winddown-upgrade/prod/Winddown.s.sol:WinddownUpgrade --rpc-url $ETHEREUM_MAINNET_RPC --broadcast'", - "upgrade-local:windown": "bash -c 'source .env && forge script scripts/winddown-upgrade/local/Winddown.s.sol:WinddownUpgrade --rpc-url $LOCAL_RPC --unlocked --broadcast'", + "upgrade-prod:winddown": "bash -c 'source .env && forge script scripts/winddown-upgrade/prod/Winddown.s.sol:WinddownUpgrade --rpc-url $ETHEREUM_MAINNET_RPC --broadcast'", + "upgrade-local:winddown": "bash -c 'source .env && forge script scripts/winddown-upgrade/local/Winddown.s.sol:WinddownUpgrade --rpc-url $LOCAL_RPC --unlocked --broadcast'", "test": "yarn build:differential && yarn build:fuzz && forge test", "coverage": "yarn build:differential && yarn build:fuzz && forge coverage", "coverage:lcov": "yarn build:differential && yarn build:fuzz && forge coverage --report lcov", diff --git a/packages/contracts-bedrock/scripts/winddown-upgrade/local/Winddown.s.sol b/packages/contracts-bedrock/scripts/winddown-upgrade/local/Winddown.s.sol index 08d9b46d049a..29134f31c8d3 100644 --- a/packages/contracts-bedrock/scripts/winddown-upgrade/local/Winddown.s.sol +++ b/packages/contracts-bedrock/scripts/winddown-upgrade/local/Winddown.s.sol @@ -45,9 +45,9 @@ contract WinddownUpgrade is Script { balanceClaimerProxy.upgradeTo(address(balanceClaimerImpl)); // BalanceClaimer assertions - assert(address(BalanceClaimer(address(balanceClaimerProxy)).ethBalanceWithdrawer()) == address(optimismPortalProxy)); - assert(address(BalanceClaimer(address(balanceClaimerProxy)).erc20BalanceWithdrawer()) == address(l1StandardBridgeProxy)); - assert(BalanceClaimer(address(balanceClaimerProxy)).root() == WinddownConstants.MERKLE_ROOT); + assert(address(BalanceClaimer(address(balanceClaimerProxy)).ETH_BALANCE_WITHDRAWER()) == address(optimismPortalProxy)); + assert(address(BalanceClaimer(address(balanceClaimerProxy)).ERC20_BALANCE_WITHDRAWER()) == address(l1StandardBridgeProxy)); + assert(BalanceClaimer(address(balanceClaimerProxy)).ROOT() == WinddownConstants.MERKLE_ROOT); vm.stopBroadcast(); diff --git a/packages/contracts-bedrock/scripts/winddown-upgrade/prod/Winddown.s.sol b/packages/contracts-bedrock/scripts/winddown-upgrade/prod/Winddown.s.sol index 9734ebf376d9..37734ee846f6 100644 --- a/packages/contracts-bedrock/scripts/winddown-upgrade/prod/Winddown.s.sol +++ b/packages/contracts-bedrock/scripts/winddown-upgrade/prod/Winddown.s.sol @@ -40,9 +40,9 @@ contract WinddownUpgrade is Script { balanceClaimerProxy.upgradeTo(address(balanceClaimerImpl)); // BalanceClaimer assertions - assert(address(BalanceClaimer(address(balanceClaimerProxy)).ethBalanceWithdrawer()) == address(optimismPortalProxy)); - assert(address(BalanceClaimer(address(balanceClaimerProxy)).erc20BalanceWithdrawer()) == address(l1StandardBridgeProxy)); - assert(BalanceClaimer(address(balanceClaimerProxy)).root() == WinddownConstants.MERKLE_ROOT); + assert(address(BalanceClaimer(address(balanceClaimerProxy)).ETH_BALANCE_WITHDRAWER()) == address(optimismPortalProxy)); + assert(address(BalanceClaimer(address(balanceClaimerProxy)).ERC20_BALANCE_WITHDRAWER()) == address(l1StandardBridgeProxy)); + assert(BalanceClaimer(address(balanceClaimerProxy)).ROOT() == WinddownConstants.MERKLE_ROOT); // Deploy OptimismPortal implementation OptimismPortal opPortalImpl = new OptimismPortal({