Skip to content

Commit

Permalink
fix: use snakecase for immutable members
Browse files Browse the repository at this point in the history
Signed-off-by: 0xRaccoon <[email protected]>
  • Loading branch information
0xRaccoon committed Oct 28, 2024
1 parent 29f8629 commit 1404bca
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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});
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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)
);
}
Expand All @@ -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)
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 1404bca

Please sign in to comment.