Skip to content

Add DexFi adapter and remove legacy Dexfinance adapters#18625

Open
badgerdf wants to merge 4 commits intoDefiLlama:mainfrom
dexfinance-com:dexfi
Open

Add DexFi adapter and remove legacy Dexfinance adapters#18625
badgerdf wants to merge 4 commits intoDefiLlama:mainfrom
dexfinance-com:dexfi

Conversation

@badgerdf
Copy link
Copy Markdown

@badgerdf badgerdf commented Apr 2, 2026

PR note for reviewer: I've deleted dexfinance adapters, because all of them was written by me and it's no longer relevant. All associated with them smart contracts were being migrated into DexFi ecosystem. I'll going to push treasury and fee calculating later as soon as we'll define what we need to show into this sections

NOTE

Please enable "Allow edits by maintainers" while putting up the PR.


  1. If you would like to add a volume/fees/revenue adapter please submit the PR here.

  2. Once your adapter has been merged, it takes time to show on the UI. If more than 24 hours have passed, please let us know in Discord.

  3. Sorry, We no longer accept fetch adapter for new projects, we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you.

  4. For updating listing info It is a different repo, you can find your listing in this file, you can edit it there and put up a PR

  5. Please do not add new npm dependencies, do not edit/push pnpm-lock.yaml file as part of your changes


(Needs to be filled only for new listings)

Name (to be shown on DefiLlama): DexFi
Twitter Link: https://x.com/DexFinance
List of audit links if any:
Website Link: https://dexfi.com/
Logo (High resolution, will be shown with rounded borders): https://drive.google.com/file/d/1skNsGqyKuQ0Efeir6iDyMeBpgA7EAdQD/view
Current TVL: $2.9m
Treasury Addresses (if the protocol has treasury):

later

Chain: BASE, ETH, BNB, ARB, AVAX, SONIC
Coingecko ID (so your TVL can appear on Coingecko, leave empty if not listed): (https://api.coingecko.com/api/v3/coins/list) -
Coinmarketcap ID (so your TVL can appear on Coinmarketcap, leave empty if not listed): (https://api.coinmarketcap.com/data-api/v3/map/all?listing_status=active,inactive,untracked&start=1&limit=10000) -
Short Description (to be shown on DefiLlama): DexFi offers an ecosystem of financial products designed to empower users and simplify the DeFi experience. DexFi’s AiLM (Automated Intelligent Liquidity Manager), powers DeFi’s most sophisticated yield aggregator to actively manage v3/v4 liquidity positions.
Token address and ticker if any: gDEX

0x53Cb59D32a8d08fC6D3f81454f150946A028A44d

Category (full list at https://defillama.com/categories) *Please choose only one: Yield Aggregator (https://defillama.com/protocols/yield-aggregator)
Oracle Provider(s): Specify the oracle(s) used (e.g., Chainlink, Band, API3, TWAP, etc.): -
Implementation Details: Briefly describe how the oracle is integrated into your project: -
Documentation/Proof: Provide links to documentation or any other resources that verify the oracle's usage: -
forkedFrom (Does your project originate from another project): No
methodology (what is being counted as tvl, how is tvl being calculated): Each vault handles deposited liquidity over specific farm/pool/gauge implementation, so most of operations goes via Native token on each chain. To estimation of TVL we use estimation of withdraw a piece of deposit amount and extrapolated this value on entire size, ofc it also calculates via Native token(details inside of adapter)
Github org/user (Optional, if your code is open source, we can track activity): https://github.com/dexfi-com
Does this project have a referral program?: No

Summary by CodeRabbit

Release Notes

  • New Features

    • Added dexfi protocol adapter with comprehensive total value locked calculations across multiple blockchains
    • Included staking and liquidity pool tracking capabilities
  • Refactor

    • Consolidated dexfinance protocol modules into streamlined data structure for improved maintainability
    • Reorganized adapter architecture to enhance system efficiency

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

📝 Walkthrough

Walkthrough

This pull request consolidates DexFinance protocol integrations by introducing a new projects/dexfi/index.js module that unifies TVL calculations across multiple blockchains, while removing three separate legacy adapter modules (dexfinance, dexfinance-etf, dexfinance-vault) and their associated treasury configuration file.

Changes

Cohort / File(s) Summary
New DexFi Integration
projects/dexfi/index.js
Added unified module with chain-specific TVL and pool2 calculations for Sonic, Avalanche, BNB Chain, Ethereum, Base, and Arbitrum. Includes vault/farm fetching, connector resolution, liquidity estimation, and staking configuration for Base chain.
Legacy DexFinance Modules
projects/dexfinance/index.js, projects/dexfinance-etf/index.js, projects/dexfinance-vault/index.js, projects/dexfinance/abi.js
Removed four files containing deprecated per-chain TVL implementations, ABI definitions, and standalone farm/vault adapters totaling 252 deleted lines.
Treasury Configuration
projects/treasury/dexfinance.js
Removed legacy treasury export configuration that defined token address lists for arbitrum, avax, optimism, manta, and base networks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 The files once scattered, now unite with grace,
Old adapters fade to make room and space,
DexFi rises, consolidation's art,
Four modules merge into one beating heart! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description is well-structured and provides substantial information about the new DexFi listing, including audits, chains, methodology, and token details. It appropriately notes that old dexfinance adapters were deleted and treasury/fee details will follow.
Title check ✅ Passed The title accurately summarizes the main change: adding a new DexFi adapter while removing three legacy Dexfinance adapter modules, which aligns with the file changes and PR objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@llamabutler
Copy link
Copy Markdown

The adapter at projects/dexfi exports TVL:

base                      2.43 M
base-staking              1.02 M
staking                   1.02 M
base-pool2                325.00 k
pool2                     325.00 k
ethereum                  127.96 k
arbitrum                  63.10 k
bsc                       57.86 k
sonic                     17.32 k
avax                      14.98 k

total                    2.71 M 

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
projects/dexfi/index.js (1)

111-127: Mark this adapter as misrepresentedTokens.

tvl is adding quoted wrapped-native equivalents, not the actual vault assets. Setting misrepresentedTokens: true will keep the token breakdown honest without changing the USD totals.

🏷️ Suggested export tweak
 module.exports = {
+  misrepresentedTokens: true,
   methodology: "TVL is calculated by converting locked staking token liquidity to native token equivalent via on-chain swap estimation across all vaults",
Based on learnings: In the AFI Protocol adapter, the TVL adapter correctly uses `misrepresentedTokens: true` and adds raw `totalSupply` values rather than converting to underlying assets, since the pricing layer already handles the vault token prices.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@projects/dexfi/index.js` around lines 111 - 127, Add a top-level
misrepresentedTokens: true property to the exported adapter object (the object
assigned to module.exports) so the adapter is marked as using wrapped/quoted
native equivalents; update the export that currently lists methodology,
hallmarks, sonic/avax/bsc/ethereum/base/arbitrum and functions like tvl,
staking(STAKING_CONTRACT, GDEX_TOKEN), and pool2 to include
misrepresentedTokens: true alongside them, leaving existing tvl and staking
logic unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@projects/dexfi/index.js`:
- Around line 111-127: Add a top-level misrepresentedTokens: true property to
the exported adapter object (the object assigned to module.exports) so the
adapter is marked as using wrapped/quoted native equivalents; update the export
that currently lists methodology, hallmarks,
sonic/avax/bsc/ethereum/base/arbitrum and functions like tvl,
staking(STAKING_CONTRACT, GDEX_TOKEN), and pool2 to include
misrepresentedTokens: true alongside them, leaving existing tvl and staking
logic unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b9e3cd3d-dd36-4423-b6f2-a30ca997cdb5

📥 Commits

Reviewing files that changed from the base of the PR and between 5f3060c and 75c1bea.

📒 Files selected for processing (7)
  • projects/dexfi/abi.js
  • projects/dexfi/index.js
  • projects/dexfinance-etf/index.js
  • projects/dexfinance-vault/index.js
  • projects/dexfinance/abi.js
  • projects/dexfinance/index.js
  • projects/treasury/dexfinance.js
💤 Files with no reviewable changes (5)
  • projects/dexfinance/abi.js
  • projects/dexfinance-etf/index.js
  • projects/treasury/dexfinance.js
  • projects/dexfinance/index.js
  • projects/dexfinance-vault/index.js

@badgerdf badgerdf changed the title DexFi protocol (Old Dexfinance) Add DexFi adapter and remove legacy Dexfinance adapters Apr 2, 2026
@RohanNero RohanNero self-assigned this Apr 6, 2026
@RohanNero
Copy link
Copy Markdown
Contributor

Hello, thank you for the PR, I refactored it in #18705. We don't remove existing adapters from the repo even when contracts are deprecated for reasons described here: #13020

My refactor keeps the existing dexfinance adapters and adds a new dexfinance-vault-v2 adapter for the new contracts. Does this work for you?

@badgerdf
Copy link
Copy Markdown
Author

badgerdf commented Apr 9, 2026

@RohanNero

Hi, thanks for the review.
It’s important for us to note the following details:

  • DexFinance no longer exists. Currently, only DexFi is active, and we’d like to see DexFi used as the primary name (and link) for the protocol on your platform.
  • None of the old contracts are supported anymore and have no liquidity.
  • The TVL calculation in your PR does not reflect our approach (we evaluate wnative for assets deposited into the wallet), nor does it allow for the quick addition of new connector types. Also, the TVL value in your PR is significantly lower than it actually is. Could you explain why your solution is designed this way? (I would need to spend time validating the correctness of the token values returned by your solution. I would like to avoid that.)

btw https://github.com/DefiLlama/dimension-adapters/pulls fees pr is also ready to review

@RohanNero
Copy link
Copy Markdown
Contributor

@badgerdf Hello, to address each point:

  1. Ok we can update the metadata in the server, the existing listing uses the dexfi.com website so the only change would be the name right? "DexFinance" -> "DexFi"
  2. Since the tvl is being tracked onchain, we prefer to continue tracking them despite them being deprecated/near empty.
  3. I believe the 'swap estimation' was pricing gDEX positions in WETH, which tracks it under tvl instead of staking. The difference between the two PRs is that your adapter uses getAmountOutStakingTokenToNative to view simulated swap amounts, while mine adds staking tokens to api using the connector's liquidity() value.

For example, if you replace line 79 with this: const vaultFarmsWithConnectors = (await getVaultsConnectors(api, vaultFarms)).filter((_, i) => i === 170);, we can see what tvl is being reported for vault 170. Currently, your adapter reports ~205k WETH, while mine reports 212k gDEX. If we look at vault 170's connector, we can see the stakingToken is gdex, and the liquidity is 16726673346529994538030. (16,726.67 gDEX at $12.74 = ~$212k)

More gDEX vault examples: 276 ($98k gDEX -> WETH), 1623 ($86k gDEX -> WETH), 275 (~$73k gDEX -> WETH)

Additionally, the total value being reported by our adapters is roughly the same, I just classify gdex under staking instead of substituting it for WETH. For example, on base only:

  • 18625: $2.5M tvl + $1.1M staking + $350k pool2 = $3.9M total
  • 18705: $1.75M tvl + $2.11M staking = $3.86M total

On all chains:

  • 18625: $2.97M tvl + $1.1M staking + $350k pool2 = $4.4M total
  • 18705: $2.21M tvl + $2.11M staking = $4.32M total

Furthermore, you can see a token breakdown in my test output instead of only wrapped native tokens:

image image

@badgerdf
Copy link
Copy Markdown
Author

badgerdf commented Apr 10, 2026

@RohanNero
Got it, thanks a lot for clarification!

Couple of questions

  1. Do you also track Uniswap V4 positions? Don't see code that handles it
  2. Sometimes we add new type of connectors, so do I need to rewrite adapter by myself to support new connector and tracks TVL or ping you somehow?

@RohanNero
Copy link
Copy Markdown
Contributor

@badgerdf No problem!

  1. Good catch, I just added tracking for the v4 positions I was missing
  2. You can either open a PR to update the existing adapter yourself, or ping me here/discord, and I can update it

@badgerdf
Copy link
Copy Markdown
Author

@RohanNero
Thanks!
I'll double check value from your adapter In nearest days and let you know (or will make a pr) if anything is wrong, but It looks good at first glance(tvl is almost as on our UI minus gDex tokens) Probably you could close this pr and push your own adapter.

Also how you guys could start indexing all tvl/fees to show values from the start date field? I just see here fees only from the moment of adapter push https://defillama.com/protocol/dexfi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants