Skip to content

Commit fd3cc2a

Browse files
authored
add short guide on fee system (#101)
1 parent d0300b3 commit fd3cc2a

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

docs/guide/fee-systems.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Fee Systems Guide: Base Fee Redirect, FeeVault, Native Minting
2+
3+
## Overview
4+
5+
This guide connects three related components that move or manage native token value:
6+
7+
- Base fee redirect: redirects EIP-1559 base fees to a configured sink instead of burning them.
8+
- FeeVault: a contract that accumulates native tokens and can split and bridge them.
9+
- Native minting precompile: a privileged mint/burn interface for controlled supply changes.
10+
11+
These components are independent but commonly deployed together. The base fee redirect is a value transfer, not minting. Native minting is explicit supply change and should remain tightly controlled.
12+
13+
## Base Fee Redirect (execution layer)
14+
15+
**Purpose**: Redirect the EIP-1559 base fee to a sink address (EOA or contract) instead of burning it.
16+
17+
**Mechanics**:
18+
19+
- The EVM handler credits `base_fee_per_gas * gas_used` to the configured sink.
20+
- The redirect only activates at or after `baseFeeRedirectActivationHeight`.
21+
- If no sink is configured, base fee burns proceed as standard Ethereum behavior.
22+
23+
**Chainspec configuration** (inside `config.evolve`):
24+
25+
```json
26+
"evolve": {
27+
"baseFeeSink": "0x00000000000000000000000000000000000000fe",
28+
"baseFeeRedirectActivationHeight": 0
29+
}
30+
```
31+
32+
See `docs/adr/ADR-0001-base-fee-redirect.md` for implementation details.
33+
34+
## FeeVault (contract level)
35+
36+
**Purpose**: Accumulate native tokens and split them between a bridge destination and a secondary recipient.
37+
38+
**Mechanics**:
39+
40+
- Receives base fees when `baseFeeSink` is set to the FeeVault address.
41+
- Anyone can trigger `sendToCelestia` (or equivalent) once the minimum threshold is met.
42+
- Splits balance by `bridgeShareBps`, sends the bridge share to `HypNativeMinter`, and transfers the remainder to `otherRecipient`.
43+
44+
**Why it pairs with base fee redirect**: the redirect funnels base fees into the FeeVault automatically, turning burned fees into recoverable value for treasury or bridging.
45+
46+
See `docs/contracts/fee_vault.md` for parameters and deployment details.
47+
48+
## Native Token Minting Precompile
49+
50+
**Purpose**: Provide a privileged, auditable way to mint or burn the native token.
51+
52+
**Mechanics**:
53+
54+
- Precompile address: `0x000000000000000000000000000000000000f100`.
55+
- `mintAdmin` manages the allowlist; both admin and allowlisted accounts can call `mint` and `burn`.
56+
- Activation is gated by `mintPrecompileActivationHeight`.
57+
- Setting `mintAdmin` to the zero address disables the precompile.
58+
59+
**Chainspec configuration** (inside `config.evolve`):
60+
61+
```json
62+
"evolve": {
63+
"mintAdmin": "0x000000000000000000000000000000000000Ad00",
64+
"mintPrecompileActivationHeight": 0
65+
}
66+
```
67+
68+
See `docs/adr/ADR-0002-native-minting-precompile.md` for the full interface and security notes.
69+
70+
## How They Fit Together
71+
72+
1. **Base fee redirect** credits base fees to a sink address instead of burning them.
73+
2. **FeeVault** can be that sink, so base fees accumulate in a contract with deterministic split logic.
74+
3. **Native minting** is separate and optional; it is used for controlled supply changes (bootstrapping liquidity, treasury operations), not for redirecting fees.
75+
76+
In other words, base fee redirect and FeeVault are about re-routing existing value, while native minting explicitly changes total supply. Keep those responsibilities separate and limit minting access to minimize systemic risk.
77+
78+
## Suggested Deployment Pattern
79+
80+
- Set `baseFeeSink` to the FeeVault address.
81+
- Use `AdminProxy` as the `mintAdmin` and FeeVault owner if you need a safe, upgradeable admin.
82+
- Activate both features at a planned height for existing networks.
83+
84+
References:
85+
86+
- `docs/contracts/admin_proxy.md`
87+
- `docs/contracts/fee_vault.md`
88+
- `docs/adr/ADR-0001-base-fee-redirect.md`
89+
- `docs/adr/ADR-0002-native-minting-precompile.md`

0 commit comments

Comments
 (0)