Skip to main content

Why This Matters

Monetize your DeFi integration from day one without building payment infrastructure. The problem: Building payment rails for collecting fees is complex. You need to make new smart contracts for fee collection and separate transactions. Most teams delay monetization for months while building infrastructure. What Compass enables: Fees are embedded directly in transaction payloads and collected atomically with the primary operation. No separate transfers, no new smart contracts and no delays. Charge on yield generated and start generating revenue immediately. Revenue example: User deposits $10,000, earns $500 yield, you charge 20% performance fee = $100 revenue per profitable withdrawal.

How It Works

Example: Withdraw with 20% performance fee on yield User deposited $10,000 USDC, vault grew to $10,500 ($500 yield):
  • $100 USDC (20% of $500 yield) → your fee address
  • $10,400 USDC → user
  • Single atomic transaction
Fee timing:
  • Deposits: Fee deducted BEFORE vault deposit
  • Withdrawals: Fee deducted AFTER vault withdrawal
  • Performance fees: Calculated on realized profit only (FIFO cost basis)
If the operation fails, the fee transfer also reverts. No partial execution.

Fee Object Structure

Fees are configured using a fee object in the /v2/earn/manage endpoint with three parameters:
{
  "recipient": "0xYourFeeAddress",
  "amount": 20,
  "denomination": "PERFORMANCE"
}

Parameters

recipient (string, required)
  • The wallet address that receives the fee
  • Example: "0xb8340945eBc917D2Aa0368a5e4E79C849c461511"
amount (number, required)
  • The fee amount (meaning depends on denomination)
  • For PERCENTAGE: fee as % of transaction (e.g., 1.5 = 1.5%, 10 = 10 bps = 0.1%)
  • For FIXED: fixed amount in token units (e.g., 0.1 = 0.1 USDC)
  • For PERFORMANCE: fee as % of realized profit (e.g., 20 = 20% of profit)
denomination (string, required)
  • The unit type for the fee amount
  • Options: "PERCENTAGE", "FIXED", "PERFORMANCE"
  • Default: "PERCENTAGE"

Implementation Example

Withdraw with Performance Fee

Charge 20% on realized yield when users withdraw. This walk-through withdraws from a vault with an embedded performance fee. Compass calculates profit using FIFO cost basis and collects 20% of any realized gains. Load environment variables and initialize the SDK: Initialize the Compass API client: Generate the unsigned transaction with the embedded performance fee: Sign and broadcast the transaction: What happens:
  • User withdraws from vault
  • Compass calculates realized profit using FIFO cost basis
  • 20% of profit goes to your fee address
  • Remaining amount goes to the user
  • No fee charged if withdrawal results in a loss

Next Steps

Start monetizing your integration: