Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/RevShareContractsUpgrader.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ contract RevShareContractsUpgrader {
/// @notice Thrown when array is empty
error EmptyArray();

/// @notice Emitted when a chain's RevShare setup deposits are completed
/// @param portal The portal address for the chain
/// @param chainIndex The index of the chain in the configs array
event ChainProcessed(address portal, uint256 chainIndex);

/// @notice Struct for L1Withdrawer configuration.
/// @param minWithdrawalAmount Minimum withdrawal amount
/// @param recipient Recipient address for withdrawals
Expand Down Expand Up @@ -101,6 +106,8 @@ contract RevShareContractsUpgrader {

// Upgrade all 4 vaults with RevShare configuration (recipient=FeeSplitter, minWithdrawal=0, network=L2)
_upgradeVaultsWithRevShareConfig(config.portal);

emit ChainProcessed(config.portal, i);
}
}

Expand Down Expand Up @@ -131,6 +138,8 @@ contract RevShareContractsUpgrader {

// Configure all 4 vaults for revenue sharing
_configureVaultsForRevShare(config.portal);

emit ChainProcessed(config.portal, i);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/IRevShareContractsUpgrader.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ interface IRevShareContractsUpgrader {
error GasLimitCannotBeZero();
error EmptyArray();

event ChainProcessed(address portal, uint256 chainIndex);

struct L1WithdrawerConfig {
uint256 minWithdrawalAmount;
address recipient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import {IFeeVault} from "src/interfaces/IFeeVault.sol";
/// @title RevShareContractsUpgrader_TestInit
/// @notice Base test contract with shared setup and helpers for RevShareContractsUpgrader tests.
contract RevShareContractsUpgrader_TestInit is Test {
// Events
event ChainProcessed(address portal, uint256 chainIndex);

// Contract under test
RevShareContractsUpgrader internal upgrader;

Expand Down Expand Up @@ -403,7 +406,8 @@ contract RevShareContractsUpgrader_UpgradeAndSetupRevShare_Test is RevShareContr
/// @notice Test that upgradeAndSetupRevShare reverts when gas limit is zero
function test_upgradeAndSetupRevShare_whenGasLimitIsZero_reverts() public {
RevShareContractsUpgrader.RevShareConfig[] memory configs = new RevShareContractsUpgrader.RevShareConfig[](1);
configs[0] = _createRevShareConfig(PORTAL_ONE, MIN_WITHDRAWAL_AMOUNT, L1_RECIPIENT_ONE, 0, CHAIN_FEES_RECIPIENT_ONE);
configs[0] =
_createRevShareConfig(PORTAL_ONE, MIN_WITHDRAWAL_AMOUNT, L1_RECIPIENT_ONE, 0, CHAIN_FEES_RECIPIENT_ONE);

vm.expectRevert(RevShareContractsUpgrader.GasLimitCannotBeZero.selector);
upgrader.upgradeAndSetupRevShare(configs);
Expand Down Expand Up @@ -444,6 +448,10 @@ contract RevShareContractsUpgrader_UpgradeAndSetupRevShare_Test is RevShareContr
_mockAndExpectFeeSplitterDeployAndSetup(_portal, expectedCalculator);
_mockAndExpectAllVaultUpgrades(_portal);

// Expect event
vm.expectEmit(address(upgrader));
emit ChainProcessed(_portal, 0);

// Execute
upgrader.upgradeAndSetupRevShare(configs);
}
Expand Down Expand Up @@ -490,6 +498,10 @@ contract RevShareContractsUpgrader_UpgradeAndSetupRevShare_Test is RevShareContr
_mockAndExpectCalculatorDeploy(portal, expectedL1Withdrawer, chainFeeRecipient);
_mockAndExpectFeeSplitterDeployAndSetup(portal, expectedCalculator);
_mockAndExpectAllVaultUpgrades(portal);

// Expect event for this chain
vm.expectEmit(address(upgrader));
emit ChainProcessed(portal, i);
}

// Execute once with all chains
Expand Down Expand Up @@ -541,7 +553,8 @@ contract RevShareContractsUpgrader_SetupRevShare_Test is RevShareContractsUpgrad
/// @notice Test that setupRevShare reverts when gas limit is zero
function test_setupRevShare_whenGasLimitIsZero_reverts() public {
RevShareContractsUpgrader.RevShareConfig[] memory configs = new RevShareContractsUpgrader.RevShareConfig[](1);
configs[0] = _createRevShareConfig(PORTAL_ONE, MIN_WITHDRAWAL_AMOUNT, L1_RECIPIENT_ONE, 0, CHAIN_FEES_RECIPIENT_ONE);
configs[0] =
_createRevShareConfig(PORTAL_ONE, MIN_WITHDRAWAL_AMOUNT, L1_RECIPIENT_ONE, 0, CHAIN_FEES_RECIPIENT_ONE);

vm.expectRevert(RevShareContractsUpgrader.GasLimitCannotBeZero.selector);
upgrader.setupRevShare(configs);
Expand Down Expand Up @@ -582,6 +595,10 @@ contract RevShareContractsUpgrader_SetupRevShare_Test is RevShareContractsUpgrad
_mockAndExpectFeeSplitterSetCalculator(_portal, expectedCalculator);
_mockAndExpectAllVaultSetters(_portal);

// Expect event
vm.expectEmit(address(upgrader));
emit ChainProcessed(_portal, 0);

// Execute
upgrader.setupRevShare(configs);
}
Expand Down Expand Up @@ -628,6 +645,10 @@ contract RevShareContractsUpgrader_SetupRevShare_Test is RevShareContractsUpgrad
_mockAndExpectCalculatorDeploy(portal, expectedL1Withdrawer, chainFeeRecipient);
_mockAndExpectFeeSplitterSetCalculator(portal, expectedCalculator);
_mockAndExpectAllVaultSetters(portal);

// Expect event for this chain
vm.expectEmit(address(upgrader));
emit ChainProcessed(portal, i);
}

// Execute once with all chains
Expand Down