Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
c91c5af
test: revenue sharing upgrade unit tests
Oct 1, 2025
dab3095
chore: remove temp file after creation in test
Oct 1, 2025
dddf761
chore: remove fork block number
Oct 2, 2025
3986eb1
chore: remove logs
Oct 2, 2025
432ae73
fix: compiler warnings
Oct 2, 2025
352e47a
refactor: cleanup
Oct 2, 2025
4619a0c
refactor: cleanup
Oct 2, 2025
663e174
test: improve opt out scenario tests
Oct 2, 2025
2b68c6f
test: add task for revshare opt out scenario
Oct 2, 2025
d0a501f
fix: regression test
Oct 2, 2025
d269699
chore: remove portal calls struct
Oct 2, 2025
69db45e
refactor: conventional test naming
Oct 2, 2025
b88760b
test: remove mock call from opt out scenario
Oct 2, 2025
254c9c6
refactor: reuse portal calls verifier function
Oct 2, 2025
7d20d2d
test: expected calls with config data
Oct 3, 2025
9ac3368
style: formatting
Oct 3, 2025
5f6c01a
fix: correct variables naming
Oct 3, 2025
b1bf26d
chore: remove redundant comments
Oct 3, 2025
1129106
Merge branch 'sc-feat/revshare-setup' into test/unit-revenue-share-up…
Oct 6, 2025
584d1e6
fix: same task id for examples
Oct 6, 2025
741e0e7
test: add integration tests (not working)
Oct 7, 2025
7aa9b76
fix: wrong folder naming breaking tests
Oct 7, 2025
4c7bcd4
style: formatting
Oct 7, 2025
4020201
test: expect portal events
Oct 7, 2025
bac5d2c
Merge branch 'test/unit-revenue-share-upgrade' into test/integration-…
Oct 7, 2025
dff53cf
test: integration tests
Oct 7, 2025
5681c2c
Merge branch 'sc-feat/revshare-setup' into test/unit-revenue-share-up…
Oct 7, 2025
3de7a1d
test: add simulation
Oct 8, 2025
d2ec8e6
fix: revert due to resource metering
Oct 8, 2025
f48949a
fix: wrong deployment approach
Oct 8, 2025
621e727
test: use simulate
Oct 8, 2025
1d674d7
Merge branch 'sc-feat/revshare-setup' into test/integration-supersim-…
Oct 8, 2025
8857d0b
Merge branch 'sc-feat/revshare-setup' into test/integration-supersim-…
Oct 9, 2025
e490955
test: add tenderly simulations logs
Oct 10, 2025
9ea7747
test: refactor and add opt out path
Oct 10, 2025
b99556f
Merge branch 'sc-feat/revshare-setup' into test/unit-revenue-share-up…
Oct 10, 2025
b575a04
Merge branch 'test/unit-revenue-share-upgrade' into test/integration-…
Oct 10, 2025
c2f80ca
chore: updates the bytecode for vaults, using initialize instead of c…
0xiamflux Oct 14, 2025
d6822b7
chore: remove unused vars
Oct 14, 2025
16d7b98
chore: remove unused deployment gas limit var in opt out revshare config
Oct 14, 2025
a28b513
style: add underscore prefix on function and stack vars
Oct 14, 2025
c1f6eaa
test: add gas limit
Oct 14, 2025
c7b2cee
refactor: improve approach for simulations
Oct 14, 2025
6a69642
docs: add tenderly simulations doc
Oct 15, 2025
8e6cc8d
test: revenue sharing upgrade unit tests (#22)
0xChin Oct 15, 2025
211c2f4
chore: update regression tests
0xiamflux Oct 15, 2025
1559a8c
chore: fmt check
0xiamflux Oct 15, 2025
7d3508c
Merge branch 'sc-feat/revshare-setup' into chore/initialize-vaults-ov…
0xiamflux Oct 15, 2025
2a5c0c4
test: add revenue share upgrade path assertions
Oct 15, 2025
807a28d
docs: add gas from tenderly new simulations
Oct 15, 2025
1c66183
Merge branch 'sc-feat/revshare-setup' into test/integration-supersim-…
Oct 15, 2025
4602d3f
style: formatting
Oct 15, 2025
68f0b51
fix: broken regression tests
Oct 16, 2025
3ecc691
Merge branch 'chore/initialize-vaults-over-constructor' into test/int…
Oct 16, 2025
338981a
chore: improve vars naming'
Oct 16, 2025
c5c2ef0
chore: remove unused imports
Oct 16, 2025
72c41b8
docs: add natspec
Oct 16, 2025
3f639a0
test: assert correct calculator address when opting in
Oct 16, 2025
a23fc52
chore: improve function modifiers
0xChin Oct 16, 2025
1684c11
chore: improve function modifiers
0xChin Oct 16, 2025
b794607
chore: improve function modifiers
Oct 16, 2025
383f384
Merge branch 'sc-feat/revshare-setup' into chore/initialize-vaults-ov…
Oct 16, 2025
7ec5820
test: fix fees depositor regression tests
Oct 16, 2025
f9d2fd5
Merge branch 'chore/initialize-vaults-over-constructor' into test/int…
Oct 16, 2025
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
10 changes: 5 additions & 5 deletions src/libraries/RevShareCodeRepo.sol

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions src/template/DeployFeesDepositor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ contract DeployFeesDepositor is SimpleTaskBase {

/// @notice Sets up the template with implementation configurations from a TOML file.
/// State overrides are not applied yet. Keep this in mind when performing various pre-simulation assertions in this function.
function _templateSetup(string memory _taskConfigFilePath, address _rootSafe) internal override {
function _templateSetup(string memory _taskConfigFilePath, address) internal override {
string memory tomlContent = vm.readFile(_taskConfigFilePath);
salt = tomlContent.readString(".salt");
require(bytes(salt).length > 0, "salt must be set");
Expand Down Expand Up @@ -109,8 +109,7 @@ contract DeployFeesDepositor is SimpleTaskBase {
/// implicitly because if the calculated address of the Proxy would differ from the one we
/// calculated, the task would fail on the check for code to be present, since the changes
/// in build function revert and the parent contract validates that accessed accounts have code.
/// @param _rootSafe The address of the root safe (unused in this implementation).
function _build(address _rootSafe) internal override {
function _build(address) internal override {
// Deploy the FeesDepositor implementation contract using CREATE2
ICreate2Deployer(CREATE2_DEPLOYER).deploy(0, bytes32(bytes(salt)), RevShareCodeRepo.feesDepositorCreationCode);

Expand Down
2 changes: 1 addition & 1 deletion src/template/LateOptInRevenueShare.sol
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ contract LateOptInRevenueShare is SimpleTaskBase {

/// @notice Sets up the template with implementation configurations from a TOML file.
/// State overrides are not applied yet. Keep this in mind when performing various pre-simulation assertions in this function.
function _templateSetup(string memory _taskConfigFilePath, address _rootSafe) internal override {
function _templateSetup(string memory _taskConfigFilePath, address) internal override {
string memory _toml = vm.readFile(_taskConfigFilePath);

portal = simpleAddrRegistry.get("OptimismPortal");
Expand Down
139 changes: 105 additions & 34 deletions src/template/RevenueShareUpgradePath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ interface IFeeSplitter {
function initialize(address _sharesCalculator) external;
}

/// @notice Interface for the vaults in L2.
interface IFeeVault {
function initialize(address _recipient, uint256 _minWithdrawalAmount, uint8 _withdrawalNetwork) external;
}

/// @notice Interface for ProxyAdmin.
interface IProxyAdmin {
function upgrade(address payable _proxy, address _implementation) external;
Expand Down Expand Up @@ -322,20 +327,15 @@ contract RevenueShareV100UpgradePath is SimpleTaskBase {

// Calculate addresses and data to deploy vaults
// Calculate addresses and data to deploy OperatorFeeVault
bytes memory _operatorFeeVaultInitCode = bytes.concat(
RevShareCodeRepo.operatorFeeVaultCreationCode,
abi.encode(
operatorFeeVaultRecipient, operatorFeeVaultMinWithdrawalAmount, operatorFeeVaultWithdrawalNetwork
)
);
bytes memory _operatorFeeVaultInitCode = RevShareCodeRepo.operatorFeeVaultCreationCode;
_operatorFeeVaultPrecalculatedAddress =
Utils.getCreate2Address(_getSalt(saltSeed, "OperatorFeeVault"), _operatorFeeVaultInitCode, CREATE2_DEPLOYER);

_operatorFeeVaultCalldata = abi.encodeCall(
ICreate2Deployer.deploy, (0, _getSalt(saltSeed, "OperatorFeeVault"), _operatorFeeVaultInitCode)
);

// Expected calls for OperatorFeeVault: 2 (deploy + upgrade)
// Expected calls for OperatorFeeVault: 2 (deploy + upgradeAndCall)
_incrementCallsToPortal(
abi.encodeCall(
IOptimismPortal2.depositTransaction,
Expand All @@ -351,20 +351,26 @@ contract RevenueShareV100UpgradePath is SimpleTaskBase {
UPGRADE_GAS_LIMIT,
false,
abi.encodeCall(
IProxyAdmin.upgrade,
(payable(OPERATOR_FEE_VAULT), address(_operatorFeeVaultPrecalculatedAddress))
IProxyAdmin.upgradeAndCall,
(
payable(OPERATOR_FEE_VAULT),
address(_operatorFeeVaultPrecalculatedAddress),
abi.encodeCall(
IFeeVault.initialize,
(
operatorFeeVaultRecipient,
operatorFeeVaultMinWithdrawalAmount,
operatorFeeVaultWithdrawalNetwork
)
)
)
)
)
)
);

// Calculate addresses and data to deploy SequencerFeeVault
bytes memory _sequencerFeeVaultInitCode = bytes.concat(
RevShareCodeRepo.sequencerFeeVaultCreationCode,
abi.encode(
sequencerFeeVaultRecipient, sequencerFeeVaultMinWithdrawalAmount, sequencerFeeVaultWithdrawalNetwork
)
);
bytes memory _sequencerFeeVaultInitCode = RevShareCodeRepo.sequencerFeeVaultCreationCode;
_sequencerFeeVaultPrecalculatedAddress = Utils.getCreate2Address(
_getSalt(saltSeed, "SequencerFeeVault"), _sequencerFeeVaultInitCode, CREATE2_DEPLOYER
);
Expand All @@ -388,24 +394,32 @@ contract RevenueShareV100UpgradePath is SimpleTaskBase {
UPGRADE_GAS_LIMIT,
false,
abi.encodeCall(
IProxyAdmin.upgrade,
(payable(SEQUENCER_FEE_VAULT), address(_sequencerFeeVaultPrecalculatedAddress))
IProxyAdmin.upgradeAndCall,
(
payable(SEQUENCER_FEE_VAULT),
address(_sequencerFeeVaultPrecalculatedAddress),
abi.encodeCall(
IFeeVault.initialize,
(
sequencerFeeVaultRecipient,
sequencerFeeVaultMinWithdrawalAmount,
sequencerFeeVaultWithdrawalNetwork
)
)
)
)
)
)
);

// Calculate addresses and data to deploy BaseFeeVault
bytes memory _baseFeeVaultInitCode = bytes.concat(
RevShareCodeRepo.baseFeeVaultCreationCode,
abi.encode(baseFeeVaultRecipient, baseFeeVaultMinWithdrawalAmount, baseFeeVaultWithdrawalNetwork)
);
bytes memory _baseFeeVaultInitCode = RevShareCodeRepo.baseFeeVaultCreationCode;
_baseFeeVaultPrecalculatedAddress =
Utils.getCreate2Address(_getSalt(saltSeed, "BaseFeeVault"), _baseFeeVaultInitCode, CREATE2_DEPLOYER);
_baseFeeVaultCalldata =
abi.encodeCall(ICreate2Deployer.deploy, (0, _getSalt(saltSeed, "BaseFeeVault"), _baseFeeVaultInitCode));

// Expected calls for BaseFeeVault: 2 (deploy + upgrade)
// Expected calls for BaseFeeVault: 2 (deploy + upgradeAndCall)
_incrementCallsToPortal(
abi.encodeCall(
IOptimismPortal2.depositTransaction,
Expand All @@ -421,23 +435,28 @@ contract RevenueShareV100UpgradePath is SimpleTaskBase {
UPGRADE_GAS_LIMIT,
false,
abi.encodeCall(
IProxyAdmin.upgrade, (payable(BASE_FEE_VAULT), address(_baseFeeVaultPrecalculatedAddress))
IProxyAdmin.upgradeAndCall,
(
payable(BASE_FEE_VAULT),
address(_baseFeeVaultPrecalculatedAddress),
abi.encodeCall(
IFeeVault.initialize,
(baseFeeVaultRecipient, baseFeeVaultMinWithdrawalAmount, baseFeeVaultWithdrawalNetwork)
)
)
)
)
)
);

// Calculate addresses and data to deploy L1FeeVault
bytes memory _l1FeeVaultInitCode = bytes.concat(
RevShareCodeRepo.l1FeeVaultCreationCode,
abi.encode(l1FeeVaultRecipient, l1FeeVaultMinWithdrawalAmount, l1FeeVaultWithdrawalNetwork)
);
bytes memory _l1FeeVaultInitCode = RevShareCodeRepo.l1FeeVaultCreationCode;
_l1FeeVaultPrecalculatedAddress =
Utils.getCreate2Address(_getSalt(saltSeed, "L1FeeVault"), _l1FeeVaultInitCode, CREATE2_DEPLOYER);
_l1FeeVaultCalldata =
abi.encodeCall(ICreate2Deployer.deploy, (0, _getSalt(saltSeed, "L1FeeVault"), _l1FeeVaultInitCode));

// Expected calls for L1FeeVault: 2 (deploy + upgrade)
// Expected calls for L1FeeVault: 2 (deploy + upgradeAndCall)
_incrementCallsToPortal(
abi.encodeCall(
IOptimismPortal2.depositTransaction,
Expand All @@ -453,7 +472,15 @@ contract RevenueShareV100UpgradePath is SimpleTaskBase {
UPGRADE_GAS_LIMIT,
false,
abi.encodeCall(
IProxyAdmin.upgrade, (payable(L1_FEE_VAULT), address(_l1FeeVaultPrecalculatedAddress))
IProxyAdmin.upgradeAndCall,
(
payable(L1_FEE_VAULT),
address(_l1FeeVaultPrecalculatedAddress),
abi.encodeCall(
IFeeVault.initialize,
(l1FeeVaultRecipient, l1FeeVaultMinWithdrawalAmount, l1FeeVaultWithdrawalNetwork)
)
)
)
)
)
Expand All @@ -467,7 +494,7 @@ contract RevenueShareV100UpgradePath is SimpleTaskBase {
_getSalt(saltSeed, "FeeSplitter"), RevShareCodeRepo.feeSplitterCreationCode, CREATE2_DEPLOYER
);

// Expected calls for FeeSplitter: 2 (deploy + upgrade)
// Expected calls for FeeSplitter: 2 (deploy + upgradeAndCall)
_incrementCallsToPortal(
abi.encodeCall(
IOptimismPortal2.depositTransaction,
Expand Down Expand Up @@ -561,7 +588,19 @@ contract RevenueShareV100UpgradePath is SimpleTaskBase {
UPGRADE_GAS_LIMIT,
false,
abi.encodeCall(
IProxyAdmin.upgrade, (payable(OPERATOR_FEE_VAULT), address(_operatorFeeVaultPrecalculatedAddress))
IProxyAdmin.upgradeAndCall,
(
payable(OPERATOR_FEE_VAULT),
address(_operatorFeeVaultPrecalculatedAddress),
abi.encodeCall(
IFeeVault.initialize,
(
operatorFeeVaultRecipient,
operatorFeeVaultMinWithdrawalAmount,
operatorFeeVaultWithdrawalNetwork
)
)
)
)
);

Expand All @@ -575,7 +614,19 @@ contract RevenueShareV100UpgradePath is SimpleTaskBase {
UPGRADE_GAS_LIMIT,
false,
abi.encodeCall(
IProxyAdmin.upgrade, (payable(SEQUENCER_FEE_VAULT), address(_sequencerFeeVaultPrecalculatedAddress))
IProxyAdmin.upgradeAndCall,
(
payable(SEQUENCER_FEE_VAULT),
address(_sequencerFeeVaultPrecalculatedAddress),
abi.encodeCall(
IFeeVault.initialize,
(
sequencerFeeVaultRecipient,
sequencerFeeVaultMinWithdrawalAmount,
sequencerFeeVaultWithdrawalNetwork
)
)
)
)
);

Expand All @@ -588,7 +639,17 @@ contract RevenueShareV100UpgradePath is SimpleTaskBase {
0,
UPGRADE_GAS_LIMIT,
false,
abi.encodeCall(IProxyAdmin.upgrade, (payable(BASE_FEE_VAULT), address(_baseFeeVaultPrecalculatedAddress)))
abi.encodeCall(
IProxyAdmin.upgradeAndCall,
(
payable(BASE_FEE_VAULT),
address(_baseFeeVaultPrecalculatedAddress),
abi.encodeCall(
IFeeVault.initialize,
(baseFeeVaultRecipient, baseFeeVaultMinWithdrawalAmount, baseFeeVaultWithdrawalNetwork)
)
)
)
);

// Deploy the l1 fee vault
Expand All @@ -600,7 +661,17 @@ contract RevenueShareV100UpgradePath is SimpleTaskBase {
0,
UPGRADE_GAS_LIMIT,
false,
abi.encodeCall(IProxyAdmin.upgrade, (payable(L1_FEE_VAULT), address(_l1FeeVaultPrecalculatedAddress)))
abi.encodeCall(
IProxyAdmin.upgradeAndCall,
(
payable(L1_FEE_VAULT),
address(_l1FeeVaultPrecalculatedAddress),
abi.encodeCall(
IFeeVault.initialize,
(l1FeeVaultRecipient, l1FeeVaultMinWithdrawalAmount, l1FeeVaultWithdrawalNetwork)
)
)
)
);
}

Expand Down
Loading