A unified system for collecting and converting fees from arbitrary revenue sources on arbitrary chains.
- Overview
- Goals
- Architecture
- Economic Incentives
- Fault Tolerance
- Deployment Architecture
- Development
- Governance Proposal
- Security
- Future Development
- Contributing
- License
- Support
Uniswap Fee Collection is a maximally fault-tolerant system designed to collect fees from any revenue source on any blockchain and convert them efficiently. The system uses competitive economic incentives to ensure timely fee collection while maintaining decentralized governance through immutable smart contracts.
- Universal Support: Collect fees from arbitrary revenue sources across arbitrary chains
- Maximum Fault Tolerance: Recover from chain downtime, bridge failures, and other infrastructure issues
- Economic Efficiency: Competitive mechanisms ensure optimal fee collection and conversion
The Uniswap system consists of three core layers that work together across all supported chains:
Each chain deploys a local Token Jar - an immutable smart contract that serves as the collection point for all fees on that chain.
Fee Sources β Token Jar β Releaser β Fee Conversion
Key Properties:
- Universal Collector: Receives fees from all sources on the chain
- Single Admin: Only the
releasercan withdraw assets - Atomic Operations: Full balance transfers only
The Token Jar defines one role: the releaser, which can atomically transfer the full balance of specified assets to a recipient address.
Fee Sources are adapter contracts that channel fees from various protocols into the local Token Jar. They handle the diversity of fee collection mechanisms across different protocols.
Push Sources (e.g., Uniswap V2):
- Fees automatically flow to Token Jar
- Direct integration with protocol fee recipients
- Minimal ongoing maintenance
Pull Sources (e.g., Uniswap V3/V4):
- Require explicit collection calls
- Adapter contracts enable permissionless collection
- Anyone can trigger fee collection to Token Jar
Uniswap V2
- LP tokens minted directly to Token Jar
- 1/6 of swap fees collected as protocol revenue
- Zero additional infrastructure required
Uniswap V3
- V3FeeAdapter contract owns factory privileges
- Permissionless protocol fee collection
- Configurable fee rates per fee tier
Uniswap V4 (TBD)
- V4FeeAdapter as ProtocolFeeAdapter
- Not included as part of the initial fee enablement
Releasers are smart contracts that serve as the releaser for Token Jars. They implement the business logic for converting collected fees into protocol value.
On Ethereum mainnet where UNI tokens exist:
Searcher β Pay UNI β Releaser β Release Assets β Burn UNI
Mechanism:
- Searcher pays a fixed UNI amount to Releaser
- Releaser releases Token Jar contents to searcher's specified recipient
- UNI tokens are burned, reducing total supply
- Searcher profits from asset value exceeding UNI burn cost
Note: Cross-chain value accrual is not ready at this time, below we outline our expectations
For chains without native UNI:
Searcher β Burn UNI (Mainnet) β Bridge Message β Release Assets (Spoke)
Mechanism:
- Searcher burns UNI on Ethereum mainnet
- Cross-chain message triggers asset release on spoke chain
- Monotonic nonce ensures strict ordering
- Bundled multicalls optimize gas efficiency
The system relies on economic competition to ensure efficient operation:
- Profit Motive: Searchers compete when asset value exceeds burn costs
- Automatic Timing: No manual intervention required
- Gas Optimization: Bundled operations reduce transaction costs
- MEV Resistance: Fixed burn amounts prevent extraction
Uniswap is designed to handle infrastructure failures gracefully:
- Bridge Failures: Each chain operates independently
- Chain Downtime: Fees accumulate until chain recovery
- Oracle Failures: Economic incentives work without price feeds
Ethereum Mainnet
βββ Token Jar
βββ UNI Burn Releaser (Firepit.sol)
βββ V2 Fee Source (feeTo)
βββ V3 Fee Source (V3FeeAdapter.sol)
Crosschain system coming at a later date
# Clone the repository
git clone https://github.com/Uniswap/protocol-fees
cd protocol-fees
# Install dependencies
forge install
# Build contracts
forge build# Run all tests
forge test
# Run with verbosity
forge test -vvv
# Generate coverage
forge coveragesrc/
βββ TokenJar.sol // General purpose contract for receiving fees
βββ Deployer.sol // A deployer contract to instantiate the initial contracts
βββ base
β βββ Nonce.sol // Utility contract to safely sequence multiple pending transactions
β βββ ResourceManager.sol. // Utility contract for defining the `RESOURCE` token and its amount requirements
βββ feeAdapters
β βββ V3FeeAdapter.sol // Logic for Uniswap v3 fee-setting and collection
β βββ V4FeeAdapter.sol // Work-in-progress logic for Uniswap v4 fee-setting and collection
βββ interfaces/ // interfaces
βββ libraries
β βββ ArrayLib.sol // Utility library
βββ releasers
βββ ExchangeReleaser.sol // Utility contract to exchange a RESOURCE for Token Jar assets
βββ Firepit.sol // Burns UNI (resource) in exchange for Token Jar assets
test
βββ TokenJar.t.sol
βββ Deployer.t.sol // Test Deployer configures the system properly
βββ ExchangeReleaser.t.sol
βββ Firepit.t.sol
βββ ProtocolFees.fork.t.sol // Fork tests against Ethereum Mainnet, using Deployer.sol
βββ V3FeeAdapter.t.sol
βββ V4FeeAdapter.t.sol
βββ interfaces/ // interfaces for integrations
βββ mocks/ // mocks and examples
βββ utils
βββ ProtocolFeesTestBase.sol // Test base that configures the system
For additional commentary and information please see Uniswap Governance Proposal #92
With the system already deployed, Uniswap Governance can elect into the system by executing the following calls:
| Contract | Address | Calldata | function | function signature | parameters |
|---|---|---|---|---|---|
| UniswapV3Factory | 0x1F98431c8aD98523631AE4a59f267346ea31F984 | 0x13af40350000000000000000000000001a9c8182c09f50c8318d769245bea52c32be35bc |
setOwner(address _owner) |
0x13af4035 |
0xTOKENJAR |
| FeeToSetter | 0x18e433c7Bf8A2E1d0197CE5d8f9AFAda1A771360 | 0xa2e74af60000000000000000000000001a9c8182c09f50c8318d769245bea52c32be35bc |
setFeeToSetter(address feeToSetter_) |
0xa2e74af6 |
0x1a9C8182C09F50C8318d769245beA52c32BE35BC |
| UniswapV2Factory | 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f | 0xf46901ed0000000000000000000000001a9c8182c09f50c8318d769245bea52c32be35bc |
setFeeTo(address _feeTo) |
0xf46901ed |
0xTOKENJAR |
Audits: Audit reports available in audit/
- OpenZeppelin
- Spearbit
Advanced mechanism design for optimizing fee collection efficiency through auction-based competition.
- Uniswap v4
- UniswapX fee integration
- Interface fee collection
- Third-party protocol adapters
- Additional L2 and L1 chain support
- Alternative bridge integrations
- Rollup-specific optimizations
- Fork the repository
- Create a feature branch
- Implement changes with comprehensive tests
- Submit a pull request
This project is licensed under AGPL-3.0-only.
For questions or issues, please open an issue in the repository.