You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `FeeVault` is a specialized smart contract designed to accumulate native tokens (ETH or gas tokens) and periodically bridge them to a specific destination chain (e.g., Celestia) via the Hyperlane protocol.
4
+
The `FeeVault` is a specialized smart contract designed to accumulate native tokens (ETH or gas tokens) and automatically split them between bridging to a specific destination chain (e.g., Celestia) and sending to a secondary recipient.
5
5
6
6
## Use Case
7
-
This contract serves as a **fee sink** and **bridging mechanism** for a rollup or chain that wants to redirect collected fees (e.g., EIP-1559 base fees) to another ecosystem.
7
+
This contract serves as a **fee sink** and **bridging mechanism** for a rollup or chain that wants to redirect collected fees (e.g., EIP-1559 base fees) to another ecosystem while retaining a portion for other purposes (e.g., developer rewards, treasury).
8
8
9
9
1.**Fee Accumulation**: The contract receives funds from:
10
10
-**Base Fee Redirect**: The chain's execution layer (e.g., `ev-revm`) can be configured to direct burned base fees directly to this contract's address.
11
11
-**Direct Transfers**: Anyone can send native tokens to the contract via the `receive()` function.
12
12
13
-
2.**Bridging to Celestia**: Once sufficient funds have accumulated, any user can trigger the `sendToCelestia()` function. This converts the native balance into a cross-chain message that mints tokens on the destination chain (Celestia) via the `HypNativeMinter`.
13
+
2.**Splitting & Bridging**: Once sufficient funds have accumulated, any user can trigger the `sendToCelestia()` function. This splits the funds based on a configured percentage:
14
+
-**Bridge Share**: Sent to the destination chain (Celestia) via the `HypNativeMinter`.
15
+
-**Other Share**: Immediately transferred to a configured `otherRecipient` address.
14
16
15
17
## Architecture
16
18
@@ -19,9 +21,10 @@ This contract serves as a **fee sink** and **bridging mechanism** for a rollup o
19
21
-**Admin Controls**: An `owner` manages critical parameters to ensure security and flexibility.
20
22
21
23
### Key Features
22
-
-**Stored Recipient**: The destination domain (Chain ID) and recipient address are stored in the contract state, preventing callers from redirecting funds to arbitrary addresses.
23
-
-**Minimum Threshold**: A `minimumAmount` ensures that bridging only occurs when it is economically viable (avoiding dust transfers).
24
-
-**Caller Incentive/Fee**: A `callFee` is required to trigger the bridge function. This fee is added to the total bridged amount, effectively making the caller pay for the privilege (or potentially subsidizing it if the protocol design changes). *Note: Currently, the caller pays the fee, which is added to the pot.*
24
+
-**Automatic Splitting**: Funds are split automatically upon calling `sendToCelestia`. No manual withdrawal is required for the secondary recipient.
25
+
-**Stored Recipient**: The destination domain (Chain ID) and recipient address are stored in the contract state.
26
+
-**Minimum Threshold**: A `minimumAmount` ensures that bridging only occurs when it is economically viable.
27
+
-**Caller Incentive/Fee**: A `callFee` is required to trigger the bridge function.
25
28
26
29
## Workflow
27
30
@@ -30,22 +33,24 @@ This contract serves as a **fee sink** and **bridging mechanism** for a rollup o
30
33
- Users/Contracts send ETH to `FeeVault`.
31
34
32
35
2.**Trigger Phase**:
33
-
- A keeper or user notices the balance exceeds `minimumAmount`.
36
+
- A keeper or user notices the bridge portion exceeds `minimumAmount`.
34
37
- They call `sendToCelestia{value: callFee}()`.
35
38
- The contract checks:
36
39
-`msg.value >= callFee`
37
-
-`address(this).balance >= minimumAmount`
40
+
-`bridgeAmount >= minimumAmount`
38
41
39
42
3.**Execution Phase**:
40
-
- The contract calls `hypNativeMinter.transferRemote`.
41
-
-The entire balance (accumulated funds + `callFee`) is sent as `msg.value` to the minter.
42
-
-The minter burns/locks the tokens and sends a message to the destination chain.
43
-
-`SentToCelestia`event is emitted.
43
+
- The contract calculates the split based on `bridgeShareBps`.
44
+
-**Other Share**: Transferred immediately to `otherRecipient`.
45
+
-**Bridge Share**: Bridged to Celestia via `hypNativeMinter.transferRemote`.
46
+
-`SentToCelestia`and `FundsSplit` events are emitted.
44
47
45
48
## Configuration Parameters
46
49
| Parameter | Description | Managed By |
47
50
|-----------|-------------|------------|
48
51
|`destinationDomain`| Hyperlane domain ID of the target chain (e.g., Celestia). | Owner |
49
52
|`recipientAddress`| Address on the target chain to receive funds. | Owner |
50
-
|`minimumAmount`| Minimum balance required to trigger a bridge tx. | Owner |
53
+
|`minimumAmount`| Minimum bridge amount required to trigger a bridge tx. | Owner |
51
54
|`callFee`| Fee required from the caller to execute the function. | Owner |
55
+
|`bridgeShareBps`| Basis points (0-10000) determining the % of funds to bridge. | Owner |
56
+
|`otherRecipient`| Address to receive the non-bridged portion of funds. | Owner |
0 commit comments