Skip to main content

Overview

AppFeeRouter is the first stop for all fees collected from app activity (buys, sells, transfers). It determines which downstream contracts receive what portion of each fee.

Key Functions

Read

FunctionReturnsDescription
getRoutes(uint256 appId)Route[]Fee routing config for an app
defaultRoutes()Route[]Protocol-default routing
protocolFeeRate()uint256Protocol fee in basis points

Write

FunctionAccessDescription
routeFees(uint256 appId, address token, uint256 amount)InternalRoute collected fees to destinations
setDefaultRoutes(Route[] calldata routes)GovernanceUpdate default routing
setAppRoutes(uint256 appId, Route[] calldata routes)App ownerOverride routing for specific app

Route Struct

struct Route {
    address destination;     // Receiving contract
    uint256 shareBps;        // Share in basis points
    bytes4 callbackSelector; // Optional callback on receive
}

Default Fee Flow

App Activity
  → FeeCollector (collects raw fees)
  → AppFeeRouter (splits by route)
    → ContributorSplit (app team share)
    → FeeSwapper (protocol share → swap to USDC/ELTA)
    → TreasuryUSDCVault (treasury share)

Events

EventEmitted When
FeesRouted(uint256 appId, address token, uint256 amount)Fees distributed
RoutesUpdated(uint256 appId)App routing changed
DefaultRoutesUpdated()Default routing changed