Purpose of the vault
Flap sends the vault’s share of trading taxes to the token’s strategy vault. The vault swaps that income into USDG and sends it to the revenue router, where the token’s strategy balance is tracked.
The vault is funded by trading taxes rather than user deposits. Each vault belongs to one launched token and is linked to that token’s trading pair, custody account, strategy controller, treasury, and tax split.
One vault per token
The factory creates the token’s vault and calculates its custody address during launch. The vault can be finalized only with that custody address.
The vault stores or resolves:
- the launched token;
- the launch quote or revenue asset;
- the expected and finalized custody account;
- the revenue normalizer and router;
- the strategy-authority hub;
- the original launcher;
- the selected Fixed, DAO, or Delegated control mode;
- the launch-time tax allocation;
- the snapshotted treasury and launchpad fee receiver.
Strategy settings live in the strategy hub. The vault reads the latest version when it displays the strategy.
Tracking new tax income
The vault compares its token balance with the amount it has already recorded. Any new amount becomes tax income waiting to be converted.
This lets tax income arrive over many trades and be processed later in a single conversion.
Swapping into USDG
The strategy uses USDG as collateral. If trading taxes arrive in another asset, the vault swaps them into USDG through an approved route.
The swap includes:
- the launched token and its registered revenue asset;
- the amount of revenue being converted;
- a minimum acceptable USDG output;
- a deadline;
- reviewed route data when a dynamic route is required.
Only the token’s registered vault can run this swap. The USDG returns to the vault and is then sent to the fixed revenue router.
Splitting the USDG
After the swap, the revenue router splits the USDG:
USDG from the vault ├── 75% strategy funds └── 25% protocol treasury
The 75% stays assigned to that token until a keeper sends it to the token’s custody account. The other 25% goes to the protocol treasury.
How the router tracks funds
The router keeps a separate TokenBuckets record for every registered token. The main balances and cumulative counters are:
| Field | Meaning |
|---|---|
strategyCapital | USDG ready to be released to the token’s custody. |
outstandingPrincipal | Capital released to custody or Lighter and not yet returned or finalized as lost. |
settledProfitForBuyback | Returned value classified for token buyback-and-burn. |
settledProfitForDividends | Returned value classified for holder dividends. |
unrecoveredPrincipalLoss | Principal formally written off but still eligible to be restored if value later returns. |
| Cumulative totals | Normalization, protocol revenue, capital release, principal return, loss, profit, buyback, burn, and dividend history. |
The router also tracks totals across all tokens so its USDG balance can be checked against the funds recorded in these token balances.
Releasing strategy capital
A configured keeper can release available strategy capital. The request specifies the token, amount, and scoped action ID. It does not specify a recipient.
The router performs these steps:
- verifies the token registration and keeper role;
- checks the amount against available strategy capital;
- consumes the action ID and payload hash;
- reduces
strategyCapital; - increases
outstandingPrincipal; - transfers USDG to the token’s stored custody address;
- records the router receipt in custody.
Each action has an ID. Retrying the same action is safe, while reusing its ID with a different amount is rejected.
Settlement from Lighter
Secure withdrawals return USDG to the custody contract. The custody contract then settles some or all of that balance back to the router. The settlement request includes the total amount and a keeper-supplied principalReturnPortion.
The router applies the amount in this order:
- restore up to the recorded outstanding principal declared by the request;
- restore eligible finalized principal loss included in the declared amount;
- classify the remaining USDG as strategy profit;
- split that profit into buyback and dividend buckets using the launch configuration.
Principal losses
Outstanding trading capital can be recorded as lost using an amount and unique evidence hash. This updates the router’s accounting without moving funds.
Finalization reduces outstanding principal and records unrecovered loss. If value later returns and the settlement declares it as loss recovery, the router decreases the unrecovered amount and restores the recovered value to strategy capital.
Evidence hashes cannot be reused. The hash provides an immutable reference to the offchain evidence used for the accounting decision, but the contract does not independently prove that the referenced Lighter loss is correct.
What the vault UI reports
The vault exposes read methods for the website and Flap vault interfaces. They combine the launch settings with router, strategy, custody, and market data.
The UI can report:
- strategy activity, mode, authority, and profile version;
- the custody address and Lighter account index;
- portfolio legs, allocations, reserve, and leverage limits;
- governance rules and proposal state;
- capital, principal, profit, loss, buyback, and dividend totals;
- token-tax and strategy-profit allocation.
Amounts are converted to a consistent display format. Asset addresses remain the source used to identify each token.