Commit 87b2819d authored by dapperscene6's avatar dapperscene6

update PR based off review comments

parent 549f5837
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
"baseFeeVaultRecipient": "0xBcd4042DE499D14e55001CcbB24a551F3b954096", "baseFeeVaultRecipient": "0xBcd4042DE499D14e55001CcbB24a551F3b954096",
"l1FeeVaultRecipient": "0x71bE63f3384f5fb98995898A86B02Fb2426c5788", "l1FeeVaultRecipient": "0x71bE63f3384f5fb98995898A86B02Fb2426c5788",
"sequencerFeeVaultRecipient": "0x71bE63f3384f5fb98995898A86B02Fb2426c5788", "sequencerFeeVaultRecipient": "0x71bE63f3384f5fb98995898A86B02Fb2426c5788",
"baseFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "baseFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"l1FeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "l1FeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"sequencerFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "sequencerFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
...@@ -29,7 +30,6 @@ ...@@ -29,7 +30,6 @@
"l1FeeVaultWithdrawalNetwork": 0, "l1FeeVaultWithdrawalNetwork": 0,
"sequencerFeeVaultWithdrawalNetwork": 0, "sequencerFeeVaultWithdrawalNetwork": 0,
"l1ERC721BridgeProxy": "0xff000000000000000000000000000000000000ff", "l1ERC721BridgeProxy": "0xff000000000000000000000000000000000000ff",
"l1StandardBridgeProxy": "0xff000000000000000000000000000000000000fd", "l1StandardBridgeProxy": "0xff000000000000000000000000000000000000fd",
"l1CrossDomainMessengerProxy": "0xff000000000000000000000000000000000000dd", "l1CrossDomainMessengerProxy": "0xff000000000000000000000000000000000000dd",
......
...@@ -15,6 +15,8 @@ import { OptimismMintableERC20 } from "../universal/OptimismMintableERC20.sol"; ...@@ -15,6 +15,8 @@ import { OptimismMintableERC20 } from "../universal/OptimismMintableERC20.sol";
import { OptimismPortal } from "../L1/OptimismPortal.sol"; import { OptimismPortal } from "../L1/OptimismPortal.sol";
import { L1CrossDomainMessenger } from "../L1/L1CrossDomainMessenger.sol"; import { L1CrossDomainMessenger } from "../L1/L1CrossDomainMessenger.sol";
import { L2CrossDomainMessenger } from "../L2/L2CrossDomainMessenger.sol"; import { L2CrossDomainMessenger } from "../L2/L2CrossDomainMessenger.sol";
import { SequencerFeeVault } from "../L2/SequencerFeeVault.sol";
import { FeeVault } from "../universal/FeeVault.sol";
import { AddressAliasHelper } from "../vendor/AddressAliasHelper.sol"; import { AddressAliasHelper } from "../vendor/AddressAliasHelper.sol";
import { LegacyERC20ETH } from "../legacy/LegacyERC20ETH.sol"; import { LegacyERC20ETH } from "../legacy/LegacyERC20ETH.sol";
import { Predeploys } from "../libraries/Predeploys.sol"; import { Predeploys } from "../libraries/Predeploys.sol";
...@@ -488,6 +490,20 @@ contract ERC721Bridge_Initializer is Messenger_Initializer { ...@@ -488,6 +490,20 @@ contract ERC721Bridge_Initializer is Messenger_Initializer {
} }
} }
contract FeeVault_Initializer is Bridge_Initializer {
SequencerFeeVault vault = SequencerFeeVault(payable(Predeploys.SEQUENCER_FEE_WALLET));
address constant recipient = address(1024);
event Withdrawal(uint256 value, address to, address from);
event Withdrawal(
uint256 value,
address to,
address from,
FeeVault.WithdrawalNetwork withdrawalNetwork
);
}
contract FFIInterface is Test { contract FFIInterface is Test {
function getProveWithdrawalTransactionInputs(Types.WithdrawalTransaction memory _tx) function getProveWithdrawalTransactionInputs(Types.WithdrawalTransaction memory _tx)
external external
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
import { Bridge_Initializer } from "./CommonTest.t.sol"; import { FeeVault_Initializer } from "./CommonTest.t.sol";
import { FeeVault } from "../universal/FeeVault.sol"; import { FeeVault } from "../universal/FeeVault.sol";
import { SequencerFeeVault } from "../L2/SequencerFeeVault.sol"; import { SequencerFeeVault } from "../L2/SequencerFeeVault.sol";
import { StandardBridge } from "../universal/StandardBridge.sol"; import { StandardBridge } from "../universal/StandardBridge.sol";
import { Predeploys } from "../libraries/Predeploys.sol"; import { Predeploys } from "../libraries/Predeploys.sol";
contract SequencerFeeVault_Test is Bridge_Initializer { contract SequencerFeeVault_Test is FeeVault_Initializer {
SequencerFeeVault vault = SequencerFeeVault(payable(Predeploys.SEQUENCER_FEE_WALLET));
address constant recipient = address(256);
event Withdrawal(
uint256 value,
address to,
address from,
FeeVault.WithdrawalNetwork withdrawalNetwork
);
function setUp() public override { function setUp() public override {
super.setUp(); super.setUp();
vm.etch( vm.etch(
...@@ -63,6 +53,8 @@ contract SequencerFeeVault_Test is Bridge_Initializer { ...@@ -63,6 +53,8 @@ contract SequencerFeeVault_Test is Bridge_Initializer {
// No ether has been withdrawn yet // No ether has been withdrawn yet
assertEq(vault.totalProcessed(), 0); assertEq(vault.totalProcessed(), 0);
vm.expectEmit(true, true, true, true, address(Predeploys.SEQUENCER_FEE_WALLET));
emit Withdrawal(address(vault).balance, vault.RECIPIENT(), address(this));
vm.expectEmit(true, true, true, true, address(Predeploys.SEQUENCER_FEE_WALLET)); vm.expectEmit(true, true, true, true, address(Predeploys.SEQUENCER_FEE_WALLET));
emit Withdrawal( emit Withdrawal(
address(vault).balance, address(vault).balance,
...@@ -87,20 +79,31 @@ contract SequencerFeeVault_Test is Bridge_Initializer { ...@@ -87,20 +79,31 @@ contract SequencerFeeVault_Test is Bridge_Initializer {
// The withdrawal was successful // The withdrawal was successful
assertEq(vault.totalProcessed(), amount); assertEq(vault.totalProcessed(), amount);
assertEq(address(vault).balance, ZERO_VALUE);
assertEq(Predeploys.L2_TO_L1_MESSAGE_PASSER.balance, amount);
} }
}
function test_withdraw_toL2_succeeds() external { contract SequencerFeeVault_L2Withdrawal_Test is FeeVault_Initializer {
function setUp() public override {
super.setUp();
vm.etch( vm.etch(
Predeploys.SEQUENCER_FEE_WALLET, Predeploys.SEQUENCER_FEE_WALLET,
address(new SequencerFeeVault(recipient, NON_ZERO_VALUE, FeeVault.WithdrawalNetwork.L2)) address(new SequencerFeeVault(recipient, NON_ZERO_VALUE, FeeVault.WithdrawalNetwork.L2))
.code .code
); );
vm.label(Predeploys.SEQUENCER_FEE_WALLET, "SequencerFeeVault");
}
function test_withdraw_toL2_succeeds() external {
uint256 amount = vault.MIN_WITHDRAWAL_AMOUNT() + 1; uint256 amount = vault.MIN_WITHDRAWAL_AMOUNT() + 1;
vm.deal(address(vault), amount); vm.deal(address(vault), amount);
// No ether has been withdrawn yet // No ether has been withdrawn yet
assertEq(vault.totalProcessed(), 0); assertEq(vault.totalProcessed(), 0);
vm.expectEmit(true, true, true, true, address(Predeploys.SEQUENCER_FEE_WALLET));
emit Withdrawal(address(vault).balance, vault.RECIPIENT(), address(this));
vm.expectEmit(true, true, true, true, address(Predeploys.SEQUENCER_FEE_WALLET)); vm.expectEmit(true, true, true, true, address(Predeploys.SEQUENCER_FEE_WALLET));
emit Withdrawal( emit Withdrawal(
address(vault).balance, address(vault).balance,
...@@ -116,5 +119,7 @@ contract SequencerFeeVault_Test is Bridge_Initializer { ...@@ -116,5 +119,7 @@ contract SequencerFeeVault_Test is Bridge_Initializer {
// The withdrawal was successful // The withdrawal was successful
assertEq(vault.totalProcessed(), amount); assertEq(vault.totalProcessed(), amount);
assertEq(address(vault).balance, ZERO_VALUE);
assertEq(recipient.balance, amount);
} }
} }
...@@ -46,6 +46,17 @@ abstract contract FeeVault { ...@@ -46,6 +46,17 @@ abstract contract FeeVault {
*/ */
uint256 public totalProcessed; uint256 public totalProcessed;
/**
* @notice Emitted each time a withdrawal occurs. This event will be deprecated
* in favor of the Withdrawal event containing the WithdrawalNetwork parameter.
*
* @param value Amount that was withdrawn (in wei).
* @param to Address that the funds were sent to.
* @param from Address that triggered the withdrawal.
*
*/
event Withdrawal(uint256 value, address to, address from);
/** /**
* @notice Emitted each time a withdrawal occurs. * @notice Emitted each time a withdrawal occurs.
* *
...@@ -88,10 +99,11 @@ abstract contract FeeVault { ...@@ -88,10 +99,11 @@ abstract contract FeeVault {
uint256 value = address(this).balance; uint256 value = address(this).balance;
totalProcessed += value; totalProcessed += value;
emit Withdrawal(value, RECIPIENT, msg.sender);
emit Withdrawal(value, RECIPIENT, msg.sender, WITHDRAWAL_NETWORK); emit Withdrawal(value, RECIPIENT, msg.sender, WITHDRAWAL_NETWORK);
if (WITHDRAWAL_NETWORK == WithdrawalNetwork.L2) { if (WITHDRAWAL_NETWORK == WithdrawalNetwork.L2) {
SafeCall.call(RECIPIENT, gasleft(), value, bytes("")); SafeCall.send(RECIPIENT, gasleft(), value);
} else { } else {
L2StandardBridge(payable(Predeploys.L2_STANDARD_BRIDGE)).bridgeETHTo{ value: value }( L2StandardBridge(payable(Predeploys.L2_STANDARD_BRIDGE)).bridgeETHTo{ value: value }(
RECIPIENT, RECIPIENT,
......
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
"finalizationPeriodSeconds": 12, "finalizationPeriodSeconds": 12,
"proxyAdminOwner": "ADMIN", "proxyAdminOwner": "ADMIN",
"baseFeeVaultRecipient": "ADMIN", "baseFeeVaultRecipient": "ADMIN",
"l1FeeVaultRecipient": "ADMIN", "l1FeeVaultRecipient": "ADMIN",
"sequencerFeeVaultRecipient": "ADMIN", "sequencerFeeVaultRecipient": "ADMIN",
"baseFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "baseFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"l1FeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "l1FeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"sequencerFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "sequencerFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
"baseFeeVaultRecipient": "0xBc1233d0C3e6B5d53Ab455cF65A6623F6dCd7e4f", "baseFeeVaultRecipient": "0xBc1233d0C3e6B5d53Ab455cF65A6623F6dCd7e4f",
"l1FeeVaultRecipient": "0xBc1233d0C3e6B5d53Ab455cF65A6623F6dCd7e4f", "l1FeeVaultRecipient": "0xBc1233d0C3e6B5d53Ab455cF65A6623F6dCd7e4f",
"sequencerFeeVaultRecipient": "0xBc1233d0C3e6B5d53Ab455cF65A6623F6dCd7e4f", "sequencerFeeVaultRecipient": "0xBc1233d0C3e6B5d53Ab455cF65A6623F6dCd7e4f",
"baseFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "baseFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"l1FeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "l1FeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"sequencerFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "sequencerFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
......
...@@ -27,6 +27,13 @@ ...@@ -27,6 +27,13 @@
"l1FeeVaultRecipient": "0x858F0751ef8B4067f0d2668C076BDB50a8549fbF", "l1FeeVaultRecipient": "0x858F0751ef8B4067f0d2668C076BDB50a8549fbF",
"sequencerFeeVaultRecipient": "0x858F0751ef8B4067f0d2668C076BDB50a8549fbF", "sequencerFeeVaultRecipient": "0x858F0751ef8B4067f0d2668C076BDB50a8549fbF",
"baseFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"l1FeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"sequencerFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"baseFeeVaultWithdrawalNetwork": 0,
"l1FeeVaultWithdrawalNetwork": 0,
"sequencerFeeVaultWithdrawalNetwork": 0,
"governanceTokenName": "Optimism", "governanceTokenName": "Optimism",
"governanceTokenSymbol": "OP", "governanceTokenSymbol": "OP",
"governanceTokenOwner": "0x858F0751ef8B4067f0d2668C076BDB50a8549fbF", "governanceTokenOwner": "0x858F0751ef8B4067f0d2668C076BDB50a8549fbF",
......
...@@ -29,6 +29,7 @@ const config: DeployConfig = { ...@@ -29,6 +29,7 @@ const config: DeployConfig = {
baseFeeVaultRecipient: '0x90F79bf6EB2c4f870365E785982E1f101E93b906', baseFeeVaultRecipient: '0x90F79bf6EB2c4f870365E785982E1f101E93b906',
l1FeeVaultRecipient: '0x90F79bf6EB2c4f870365E785982E1f101E93b906', l1FeeVaultRecipient: '0x90F79bf6EB2c4f870365E785982E1f101E93b906',
sequencerFeeVaultRecipient: '0x90F79bf6EB2c4f870365E785982E1f101E93b906', sequencerFeeVaultRecipient: '0x90F79bf6EB2c4f870365E785982E1f101E93b906',
baseFeeVaultMinimumWithdrawalAmount: '0x8ac7230489e80000', baseFeeVaultMinimumWithdrawalAmount: '0x8ac7230489e80000',
l1FeeVaultMinimumWithdrawalAmount: '0x8ac7230489e80000', l1FeeVaultMinimumWithdrawalAmount: '0x8ac7230489e80000',
sequencerFeeVaultMinimumWithdrawalAmount: '0x8ac7230489e80000', sequencerFeeVaultMinimumWithdrawalAmount: '0x8ac7230489e80000',
......
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
"baseFeeVaultRecipient": "0xa3d596EAfaB6B13Ab18D40FaE1A962700C84ADEa", "baseFeeVaultRecipient": "0xa3d596EAfaB6B13Ab18D40FaE1A962700C84ADEa",
"l1FeeVaultRecipient": "0xa3d596EAfaB6B13Ab18D40FaE1A962700C84ADEa", "l1FeeVaultRecipient": "0xa3d596EAfaB6B13Ab18D40FaE1A962700C84ADEa",
"sequencerFeeVaultRecipient": "0xa3d596EAfaB6B13Ab18D40FaE1A962700C84ADEa", "sequencerFeeVaultRecipient": "0xa3d596EAfaB6B13Ab18D40FaE1A962700C84ADEa",
"baseFeeVaultMinimumWithdrawalAmount": '0x8ac7230489e80000', "baseFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"l1FeeVaultMinimumWithdrawalAmount": '0x8ac7230489e80000', "l1FeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"sequencerFeeVaultMinimumWithdrawalAmount": '0x8ac7230489e80000', "sequencerFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"baseFeeVaultWithdrawalNetwork": 0, "baseFeeVaultWithdrawalNetwork": 0,
"l1FeeVaultWithdrawalNetwork": 0, "l1FeeVaultWithdrawalNetwork": 0,
"sequencerFeeVaultWithdrawalNetwork": 0, "sequencerFeeVaultWithdrawalNetwork": 0,
......
...@@ -136,17 +136,17 @@ interface RequiredDeployConfig { ...@@ -136,17 +136,17 @@ interface RequiredDeployConfig {
proxyAdminOwner: string proxyAdminOwner: string
/** /**
* L1 or L2 address which receives the base fee for the L2 network. * L1 or higher (e.g. L2) address which receives the base fee for the L2 network.
*/ */
baseFeeVaultRecipient: string baseFeeVaultRecipient: string
/** /**
* L1 or L2 address which receives data fees for the L2 network. * L1 or higher (e.g. L2) address which receives data fees for the L2 network.
*/ */
l1FeeVaultRecipient: string l1FeeVaultRecipient: string
/** /**
* L1 or L2 address which receives tip fees for the L2 network. * L1 or higher (e.g. L2) address which receives tip fees for the L2 network.
*/ */
sequencerFeeVaultRecipient: string sequencerFeeVaultRecipient: string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment