From f02eff59c6306149c041ab7dfb10c7efd0a28511 Mon Sep 17 00:00:00 2001 From: Flux <175354924+0xiamflux@users.noreply.github.com> Date: Tue, 2 Sep 2025 10:57:01 -0400 Subject: [PATCH 1/2] refactor: add FeeVault.withdraw refactor --- specs/protocol/jovian/predeploys.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/specs/protocol/jovian/predeploys.md b/specs/protocol/jovian/predeploys.md index 0c1f9f9da..41e383bf7 100644 --- a/specs/protocol/jovian/predeploys.md +++ b/specs/protocol/jovian/predeploys.md @@ -13,6 +13,7 @@ - [`recipient`](#recipient) - [`minWithdrawalAmount`](#minwithdrawalamount) - [`withdrawalNetwork`](#withdrawalnetwork) + - [`withdraw`](#withdraw) - [Events](#events) - [`MinWithdrawalAmountUpdated`](#minwithdrawalamountupdated) - [`RecipientUpdated`](#recipientupdated) @@ -96,6 +97,8 @@ sequenceDiagram Legacy immutables are preserved for network-specific config, and storage-based overrides are enabled via getters. Each getter returns the storage value if set; otherwise, it falls back to the immutable. Setters write the storage value to opt-in to overrides. There will be a flag to track whether the storage variable was set or not. +The `withdraw` function returns the value that was withdrawn from the vault at the time of the function call. + ### Functions #### `setMinWithdrawalAmount` @@ -169,6 +172,19 @@ function withdrawalNetwork() external view returns (WithdrawalNetwork) - MUST return the storage-configured network if a storage override has been set via `setWithdrawalNetwork`. - MUST otherwise return the legacy immutable withdrawal network. +#### `withdraw` + +Withdraws the funds stored in the vault to the recipient. If the recipient is an address on L2, a `SafeCall.send` is performed; if it's an address on L1, `IL2ToL1MessagePasser.initiateWithdrawal` is used. Returns the value of the withdrawal. + +```solidity +function withdraw() external returns(uint256) +``` + +- MUST revert if the vault's balance is below `minWithdrawalAmount()`. +- MUST emit the `Withdrawal(uint256 value, address to, address from)` event. +- MUST emit the `Withdrawal(uint256 value, address to, address from, WithdrawalNetwork withdrawalNetwork)` event. +- MUST send the vault's total balance to the appropriate recipient. + ### Events #### `MinWithdrawalAmountUpdated` From a8038b5436f4d9e80033f4830315b33ff671321c Mon Sep 17 00:00:00 2001 From: Flux <175354924+0xiamflux@users.noreply.github.com> Date: Wed, 3 Sep 2025 16:33:21 -0400 Subject: [PATCH 2/2] chore: add totalProcessed invariant --- specs/protocol/jovian/predeploys.md | 1 + 1 file changed, 1 insertion(+) diff --git a/specs/protocol/jovian/predeploys.md b/specs/protocol/jovian/predeploys.md index 41e383bf7..2346c4d72 100644 --- a/specs/protocol/jovian/predeploys.md +++ b/specs/protocol/jovian/predeploys.md @@ -181,6 +181,7 @@ function withdraw() external returns(uint256) ``` - MUST revert if the vault's balance is below `minWithdrawalAmount()`. +- MUST increment `totalProcessed` by the balance the vault had at the time of the function call. - MUST emit the `Withdrawal(uint256 value, address to, address from)` event. - MUST emit the `Withdrawal(uint256 value, address to, address from, WithdrawalNetwork withdrawalNetwork)` event. - MUST send the vault's total balance to the appropriate recipient.