Skip to main content

Overview

FeeManager (deployed as FeeCollector) tracks all protocol fees in structured buckets. Each fee entry records which app generated it, what kind of fee it is, and which asset was collected.

Key Functions

Read

FunctionReturnsDescription
getBalance(uint256 appId, FeeKind kind, address token)uint256Accrued balance for a bucket
totalCollected(address token)uint256Total fees collected in a token
feeKinds()FeeKind[]All fee categories

Write

FunctionAccessDescription
collectFee(uint256 appId, FeeKind kind, address token, uint256 amount)Authorized contractsRecord a fee
flush(uint256 appId, FeeKind kind, address token)Keeper / GovernanceSend accrued fees to router
flushAll(uint256 appId)Keeper / GovernanceFlush all buckets for an app

Fee Kinds

KindSource
BUYBonding curve purchases
SELLBonding curve sales
TRANSFERApp token transfers with tax
GRADUATIONCurve graduation event

Accounting Model

Fees are accrued in buckets keyed by (appId, kind, token). Flushing moves the accrued balance to the AppFeeRouter for distribution. This two-step model allows batching and gas optimization.

Events

EventEmitted When
FeeCollected(uint256 appId, FeeKind kind, address token, uint256 amount)Fee recorded
FeeFlushed(uint256 appId, FeeKind kind, address token, uint256 amount)Fees sent to router