OverridableFeeManager

The OverridableFeeManager routes fee computation to different managers based on the calling pool.

Source: contracts/periphery/OverridableFeeManager.sol

Overview

OverridableFeeManager allows:

  • Per-pool fee manager customization

  • Default fee manager for pools without overrides

  • Runtime configuration changes

State Variables

defaultFeeManager

address public defaultFeeManager;

The fee manager used when no override is set for a pool.

feeManagerOverride

mapping(address => address) public feeManagerOverride;

Pool-specific fee manager overrides.

Constructor

Parameter
Description

_defaultFeeManager

Default fee manager for pools without overrides

Example:

Functions

computeFee

Routes fee computation to the appropriate manager.

Modifiers: nonReentrant - Prevents reentrancy attacks via malicious fee managers

Logic:

Flow:


setFeeManagerOverride

Sets a fee manager override for a specific pool.

Access Control: Owner only

Parameters:

Name
Type
Description

pool

address

Pool address to override

newFeeManager

address

Fee manager for this pool (address(0) to remove override)

Example:


setDefaultFeeManager

Updates the default fee manager.

Access Control: Owner only

Parameters:

Name
Type
Description

_defaultFeeManager

address

New default fee manager

Usage Patterns

Different Managers for Different Pool Types

Gradual Rollout

Emergency Disable

Configuration Examples

Stable Pairs No Discount

Premium Pools

Test vs Production

Querying Configuration

Gas Considerations

OverridableFeeManager adds one extra external call:

Approximate Additional Gas: ~2,600 (SLOAD for mapping lookup)

Security Considerations

Reentrancy Protection

The contract inherits from ReentrancyGuard and uses the nonReentrant modifier on computeFee() to prevent reentrancy attacks via malicious fee managers.

Manager Validation

The contract doesn't validate that override addresses implement IFeeManager:

Access Control

Only owner can modify configuration:

  • Consider using multisig

  • Add timelock for production deployments

  • Log all configuration changes

Default Manager Trust

All pools without overrides use the default:

  • Ensure default manager is well-tested

  • Be cautious changing default on live systems

Inheritance

The contract inherits:

  • IFeeManager - Fee computation interface

  • Ownable - Access control for configuration

  • ReentrancyGuard - Reentrancy protection

Last updated