Curvance
  • Protocol Overview
    • Click Less, Earn More
    • Protocol Architecture
    • Asset Types
    • Liquidity Markets
      • Borrowing
      • Liquidations
      • Interest Rates
      • Oracles
      • Collateral Caps
      • Bad Debt Socialization
    • Application Specific Sequencing
    • New Age Liquidity Mining
      • Protocols
    • How Are New Assets Integrated
    • Plugin System
    • Universal Account Balance
    • Token Approval Management
    • Lending Risks
  • Security
    • Security and Audits
  • Miscellaneous
    • RPCs and Testnet Stability
    • Glossary
    • TL;DR
      • Customer Types and Benefits
    • Brand Assets
    • Weblinks
    • Disclaimer
    • Frequently Asked Questions
  • Developer Docs
    • Overview
    • Quick Start Guides
      • Atlas Fastlane Auctions (coming soon)
      • Plugin Integration
        • List of Delegable Actions
      • Loans & Collateral
        • Lend Assets
        • Deposit into pTokens
        • Withdraw Loans
        • Withdraw pTokens
      • Borrowing & Repayment
        • Borrow
        • Repaying Debt
      • Leverage
        • Leveraging
        • Deleveraging
    • Lending Protocol
      • Market Manager
      • Position Tokens (pToken)
      • Earn Tokens (eTokens)
      • Dynamic Interest Rate Model
      • Universal Balance
    • Position Management
      • Leverage
      • Deleverage / Fold
    • Dynamic Liquidation Engine (DLE)
      • Orderflow Auction System
      • Bad Debt Socialization
    • Plugin & Delegation System
      • Transfer Lock Mechanism
      • Delegable Actions
    • Cross-Chain Functionality
      • Messaging Hub
      • Fee Manager
      • Reward Manager
    • Auxiliary Functionality
Powered by GitBook
On this page
  • 1. Fee Collection
  • Fee Transformation (Swaps/OTC)
  • 3. Cross-Chain Fee Distribution
  • 4. Integration with 1inch/Solvers
Export as PDF
  1. Developer Docs
  2. Cross-Chain Functionality

Fee Manager

PreviousMessaging HubNextReward Manager

Last updated 1 month ago

1. Fee Collection

The FeeManager serves as the central collection point for protocol fees across the Curvance ecosystem. It acts as a unified hub for aggregating fees generated from various protocol operations.

  • Protocol Revenue Streams: Fees collected from lending/borrowing operations, liquidations, and other protocol services flow into the FeeManager.

  • Reward Token Registry: The contract maintains a registry of valid reward tokens that can be accepted as fees, enabling flexibility in fee collection.

Storage Architecture:

  • rewardTokens: Array of supported token addresses.

  • rewardTokenInfo: Mapping tracking token status (including OTC eligibility).

Fee Transformation (Swaps/OTC)

Before cross-chain distribution, collected fees may need transformation into the protocol's primary fee token.

Fee Token Swaps

  • Permissioned Swap Execution: Authorized harvesters can initiate swaps through the multiSwap function.

  • OTC Protection: Tokens marked for OTC are protected from automated swaps.

  • Token Verification: Ensures input tokens are registered reward tokens and output is the fee token.

DAO OTC Mechanism

  • Price Oracle Integration: Uses Oracle Manager to determine fair market value for OTC transactions.

  • Token Earmarking: Tokens can be marked as "for OTC" (value=2), preventing them from being swapped.

  • Price Protection: Includes slippage control and deadline validation to ensure fair execution.

3. Cross-Chain Fee Distribution

The cross-chain distribution of fees is coordinated between the FeeManager and MessagingHub.

Distribution Flow

  1. MessagingHub Pull: The MessagingHub calls pullFees() to retrieve the collected fee tokens

  2. Fee Allocation:

    1. Compounding fees are allocated to DAO address for harvester bot operations.

    2. Remaining fees are sent to MessagingHub for cross-chain distribution.

  3. Cross-Chain Transfer:

    1. MessagingHub uses Circle's CCTP (Cross-Chain Transfer Protocol) and Wormhole for secure cross-chain messaging.

    2. Tokens are distributed proportionally based on points across chains.

  4. Epoch Management:

    1. Rewards are distributed during epoch executions based on points on each chain.

    2. Wormhole's Cross-Chain Query (CCQ) gathers data about locked tokens across chains.

Technology Stack

  • Circle CCTP: Used for transferring fee tokens across chains.

  • Wormhole: Provides the messaging infrastructure for cross-chain communications.

  • Wormhole CCQ: Enables querying of lock points data from other chains.

4. Integration with 1inch/Solvers

FeeManager leverages external liquidity sources to optimize token swaps.

  • Offchain Solvers: Integration with 1inch and potentially other solvers for optimized swap routing

  • Swap Safety:

    • SwapperLib.swapSafe() enforces validation rules.

    • External calldata checker verifies swap transactions.

    • Token approvals are managed automatically.

  • Permissioned Access: Only authorized harvester addresses can execute swaps.

  • Swap Verification:

    • Validates input/output tokens match expected values.

    • Strict swap parameter validation prevents malicious transactions.


The FeeManager's cross-chain architecture enables Curvance to maintain a unified fee management system across multiple blockchains, ensuring proportional reward distribution and efficient token handling throughout the protocol ecosystem.