back to docs
contributions

OpenTrade

Track OpenTrade stablecoin vault fees/revenue

My sixth contribution to DefiLlama, tracking fees and revenue for OpenTrade’s tokenized money market vaults across multiple chains.

  • Protocol: OpenTrade
  • Type: Tokenized money market vaults (stablecoin yield)
  • Chains: Avalanche, Ethereum, Plume Mainnet
  • Start Date: Varies by vault deployment
  • Approach: On-chain vault data with management fee calculations
Status

Status: Merged (after fixes and refactor)

PR: #5413

Merged: January 1, 2026

Commits: 3 (Initial → Fix → Refactor)

1. Background story

a. After Provenance success

After Provenance merged as-is, I was feeling confident. But I knew not to get overconfident. That’s what happened before Bitfi!

I found OpenTrade, a tokenized money market protocol with stablecoin yield vaults. This looked interesting because:

  • Multiple chains (AVAX, Ethereum, Plume)
  • Multiple vaults per chain
  • Management fee structure: 0.50% annual (split: 0.10% advisor + 0.20% platform + 0.20% liquidity)

b. Understanding the model

OpenTrade’s vaults:

  • Users deposit stablecoins
  • Protocol invests in corporate bonds, treasury bills, etc.
  • Users earn yield (minus fees)
  • Protocol takes 0.50% annual management fee

Fee structure:

Total Yield → Users get most of it (supply side)
           → Protocol takes 0.50% annually (protocol revenue)

2. Initial implementation (commit 1)

a. My first attempt

I created the adapter with vault configurations and fee calculations. Looking at the reviewer comments, I made three mistakes:

3. The review: three issues found

a. Issue 1: missing vaults

Reviewer comment (line 100-103):

“Missing some vaults from here https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/opentrade/index.js”

What I did wrong: I didn’t include all vaults that were already tracked in DefiLlama’s TVL adapter.

Why this matters:

  • DefiLlama already tracks OpenTrade’s TVL
  • The TVL adapter (projects/opentrade/index.js) has the complete vault list
  • My fee adapter should track fees for all those vaults
  • Incomplete vault list = incomplete fee tracking

The fix: Check the TVL adapter and add all missing vault addresses.

b. Issue 2: fee calculation method

Reviewer comment (line 153-156):

“I think fees is applied to total collateral as whole than just on daily yield, https://docs.opentrade.io/stablecoin-yield/stablecoin-yield-vaults/high-yield-corporate-bond-vault/interest-rate-exchange-rate-fees”

What I did wrong: I calculated fees based on daily yield earned.

What I should have done: Calculate fees on total collateral (TVL).

The difference:

// My approach (WRONG)
dailyFee = dailyYield * 0.005  // 0.5% of daily yield

// Correct approach
dailyFee = totalCollateral * (0.005 / 365)  // 0.5% annual on total TVL

Why this matters:

  • Management fees are charged on Assets Under Management (AUM)
  • Not on the yield generated
  • Similar to how traditional funds charge fees on portfolio value, not returns

The documentation link showed:

  • “Management Fee: 0.50% per annum”
  • “Applied to the total value of assets”
  • Not “applied to yields”

This was a conceptual error about how management fees work!

c. Issue 3: fee breakdown missing

Reviewer comment (line 156-159):

“Can you add fee breakdown and breakdown methodology , please refer https://github.com/DefiLlama/dimension-adapters/blob/master/fees/autofinance/index.ts”

What I did wrong: Only returned total fees without breaking down components.

What I should have done: Show fee breakdown structure.

The reference adapter (autofinance) showed how to structure returns:

return {
  dailyFees,
  dailyRevenue,
  dailyProtocolRevenue,
  dailySupplySideRevenue,
  dailyHoldersRevenue,
}

With methodology explaining each:

methodology: {
  Fees: "Total fees explanation",
  Revenue: "Revenue breakdown",
  ProtocolRevenue: "Protocol share",
  SupplySideRevenue: "LP share",
  HoldersRevenue: "Token holder share",
}

OpenTrade structure:

dailyFees = Total fees collected (0.5% annual on AUM)
├─ dailyProtocolRevenue = Fees kept by protocol
│  ├─ Advisor fee: 0.10%
│  ├─ Platform fee: 0.20%
│  └─ Liquidity fee: 0.20%
└─ dailySupplySideRevenue = Net yield to depositors (after fees)

4. My fix (commit 2)

a. Response

I responded: “Fixed as requested. Please review.”

In commit c0e6c42, I fixed:

  1. Added missing vault addresses from TVL adapter
  2. Changed fee calculation from yield-based to collateral-based
  3. Added fee breakdown structure with methodology

b. Test results after fix

llamabutler showed updated results:

> [email protected] test
> ts-node --transpile-only cli/testAdapter.ts fees opentrade.ts

🦙 Running OPENTRADE.TS adapter 🦙
---------------------------------------------------
Start Date:	Tue, 30 Dec 2025 03:15:45 GMT
End Date:	Wed, 31 Dec 2025 03:15:45 GMT
---------------------------------------------------

chain         | Daily fees | Daily revenue | Daily protocol revenue | Daily supply side revenue | Start Time
---           | ---        | ---           | ---                    | ---                       | ---
avax          | 3.88 k     | 782.00        | 782.00                 | 3.10 k                    | 2/9/2024
ethereum      | 908.00     | 175.00        | 175.00                 | 733.00                    | 12/8/2023
plume_mainnet | 0.00       | 0.00          | 0.00                   | 0.00                      | 15/5/2025
Aggregate     | 4.79 k     | 957.00        | 957.00                 | 3.83 k                    |

Much better! Now showing:

  • Total fees collected
  • Protocol’s share (management fees)
  • Supply side’s share (net yield to users)

5. The refactor (commit 3)

a. Maintainer cleanup

bheluga made a final commit: “refactor”

This was code cleanup/optimization, not fixing errors. The maintainer:

  • Cleaned up code structure
  • Optimized calculations
  • Improved readability

b. Then merged

After the refactor, bheluga merged it on January 1, 2026.

6. What I learned

a. Cross-reference existing adapters

Mistake: Not checking DefiLlama’s existing TVL adapter for the protocol.

Lesson: Always check if protocol already exists in DefiLlama:

  • projects/ folder for TVL adapters
  • Use their vault lists as reference
  • Ensure fee tracking covers same vaults as TVL tracking

How to check:

# Search for protocol in DefiLlama-Adapters repo
https://github.com/DefiLlama/DefiLlama-Adapters/tree/main/projects/{protocol-name}

b. Management fees ≠ performance fees

Critical conceptual difference:

Fee TypeCharged OnExample
Management FeeTotal AUM/TVL0.5% of $1M TVL = $5k/year
Performance FeeProfits/Yields20% of $100k profit = $20k

OpenTrade charges management fees (on TVL), not performance fees (on yield).

Formula:

// Annual: 0.5% of TVL
annualFee = TVL * 0.005

// Daily: Divide by 365
dailyFee = TVL * (0.005 / 365)

c. Fee breakdown structure

Not enough:

return { dailyFees, dailyRevenue }

Better:

return {
  dailyFees,              // Total fees
  dailyProtocolRevenue,   // Protocol keeps
  dailySupplySideRevenue, // Users get (yield - fees)
}

methodology: {
  Fees: "Explain total",
  ProtocolRevenue: "Explain protocol share",
  SupplySideRevenue: "Explain user share",
}

This gives users a complete picture of where fees go.

d. Documentation is your friend

The reviewer linked to OpenTrade docs:

https://docs.opentrade.io/…/interest-rate-exchange-rate-fees

What I should have done: Read protocol docs thoroughly before implementing.

The docs clearly stated:

  • “Management Fee: 0.50% per annum”
  • “Applied to the total value of assets”

Not reading carefully → wrong calculation method.

7. The pattern: review → fix → refactor

This contribution followed a healthy pattern:

Initial → Review (3 issues) → Fix → Refactor → Merge

Not like:

  • Provenance: No review needed (merged as-is)
  • Bitfi: Closed, maintainer rewrote

But rather:

  • Issues caught in review
  • I fixed them
  • Maintainer polished
  • Then merged

This is normal, healthy collaboration!

8. Comparison with previous contributions

a. Evolution:

  1. Taiko

    • Reviewer fixed calculation
    • I didn’t fix it myself
  2. Bitfi

    • Closed, full rewrite
  3. Solomon

    • Fixed after feedback
    • Multiple commits
  4. Variational

    • Workflow issue
  5. Provenance

    • No fixes needed
    • Milestone!
  6. OpenTrade

    • Fixes needed, but I did them
    • Review → Fix → Merge
    • Maintainer just polished

b. Key difference:

Provenance was unique (no fixes). But OpenTrade shows sustainable progress:

  • Issues found: Expected
  • I fixed them: Growth
  • Maintainer refined: Normal
  • Merged: Success

Not every contribution will be perfect. What matters is fixing issues when they’re found.

9. Technical highlights

a. Multi-chain vault tracking

const vaultConfigs = {
  [CHAIN.AVAX]: [
    { address: "0x...", name: "High Yield Corp Bond" },
    { address: "0x...", name: "Money Market" },
    // ... more vaults
  ],
  [CHAIN.ETHEREUM]: [
    // ... vaults
  ],
}

Organized structure for multiple vaults across chains.

b. Proper fee calculation

// Annual management fee: 0.5%
const ANNUAL_FEE_RATE = 0.005

// Daily calculation
const dailyFeeRate = ANNUAL_FEE_RATE / 365

// Applied to total collateral
const dailyFees = totalCollateral * dailyFeeRate

c. Revenue split

// Management fee breakdown:
// - Advisor: 0.10%
// - Platform: 0.20%
// - Liquidity: 0.20%
// Total: 0.50% (all goes to protocol)

const dailyProtocolRevenue = dailyFees  // Protocol keeps all mgmt fees
const dailySupplySideRevenue = totalYield - dailyFees  // Users get yield minus fees

10. Resources

11. Key takeaways

a. What I did wrong:

  1. Didn’t check existing TVL adapter for complete vault list
  2. Calculated fees on yield instead of AUM (conceptual error)
  3. Didn’t provide fee breakdown structure

b. What I did right:

  1. Responded quickly to feedback (“Fixed as requested”)
  2. Fixed all three issues in one commit
  3. Proper multi-chain structure
  4. Asked for validation upfront

c. Key lessons:

Cross-reference existing work:

# Always check first
DefiLlama-Adapters/projects/{protocol}/
dimension-adapters/fees/{similar-protocol}/

Understand fee types:

  • Management fees → charged on AUM
  • Performance fees → charged on profits

Provide complete breakdown:

  • Don’t just show totals
  • Show where fees go (protocol vs supply side)
  • Document methodology clearly

Read docs carefully:

  • Protocol documentation > assumptions
  • Fee structure is usually documented
  • Don’t guess when docs exist

d. The healthy pattern:

Submit → Review → Fix → Polish → Merge

This is normal software development. Not every PR merges as-is (like Provenance). Most go through review cycles. What matters is responding to feedback and being able to fix issues.

Collaborative Success

OpenTrade shows sustainable progress:

Not perfect on first try, but:

  • Issues caught in review
  • Fixed them myself (not maintainer)
  • Maintainer just polished
  • Merged successfully

This is what real collaboration looks like. Review → Fix → Merge. Not always perfect, but always improving!

Command Palette
Search for a command to run...