Skip to content

bisonfi: add fees adapter - #8398

Open
DaniiRix wants to merge 1 commit into
DefiLlama:masterfrom
DaniiRix:feat/bisonfi
Open

bisonfi: add fees adapter#8398
DaniiRix wants to merge 1 commit into
DefiLlama:masterfrom
DaniiRix:feat/bisonfi

Conversation

@DaniiRix

Copy link
Copy Markdown
Member

Adds a fees/bisonfi adapter for BisonFi, a proprietary Solana AMM that earns revenue from bid/ask spread rather than explicit swap fees.

Changes

  • Added fees/bisonfi.ts using dex_solana.trades (project = 'bisonfi').
  • Estimates fees as the market maker's daily net inventory change (sold − bought per token, valued in USD), matching the methodology used by fees/humidifi.
  • Reports dailyFees = dailyRevenue = dailyProtocolRevenue, with allowNegativeValue: true since inventory PnL can be negative.
  • No supply-side revenue, as BisonFi trades against its own inventory rather than external LPs.

Verification

  • Confirmed on-chain that swaps settle directly against BisonFi vaults with no dedicated fee-recipient account, making spread capture the appropriate revenue model.
  • Independent recomputation matched the adapter within ~1% for the same window.
  • Historical tests produced values between −$1.6k and +$0.8k/day, consistent with the protocol's very tight spreads.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@DaniiRix, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 2 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f1e5be3c-8f01-4d78-aa49-176ce944a26f

📥 Commits

Reviewing files that changed from the base of the PR and between 6b58e3a and 29bd5f9.

📒 Files selected for processing (1)
  • fees/bisonfi.ts
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code

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.

@github-actions

Copy link
Copy Markdown

The bisonfi.ts adapter exports:

> adapters@1.0.0 test
> ts-node --transpile-only cli/testAdapter.ts fees bisonfi.ts

🦙 Running BISONFI.TS adapter 🦙
---------------------------------------------------
Start Date:	Fri, 24 Jul 2026 00:00:00 GMT
End Date:	Sat, 25 Jul 2026 00:00:00 GMT
---------------------------------------------------

------ ERROR ------
Error: DUNE_API_KEYS environment variable is not set
    at getAxiosDune (/home/runner/work/dimension-adapters/dimension-adapters/helpers/dune.ts:17:11)
    at submitQuery (/home/runner/work/dimension-adapters/dimension-adapters/helpers/dune.ts:81:33)
DUNE_API_KEYS environment variable is not set

@bheluga bheluga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@DaniiRix thanks for the PR.
I think this is an incorrect way to estimate fees from spread?
We are just calculating this as trade profits? For eg: ETH was 1800$ in the morning and 2000$ at night , and user sold 1 at morning and bought one at night, doesn't necessarily mean fees was 200$?
Spread should be more about calculating price difference during the trade, but not sure if there is an efficient way?

@bheluga bheluga self-assigned this Jul 25, 2026
@DaniiRix

Copy link
Copy Markdown
Member Author

@DaniiRix thanks for the PR. I think this is an incorrect way to estimate fees from spread? We are just calculating this as trade profits? For eg: ETH was 1800$ in the morning and 2000$ at night , and user sold 1 at morning and bought one at night, doesn't necessarily mean fees was 200$? Spread should be more about calculating price difference during the trade, but not sure if there is an efficient way?

my bad. what if we fix it to diff the two legs within the same swap instead, so there's no option for price movement?

@bheluga

bheluga commented Jul 28, 2026

Copy link
Copy Markdown
Member

@DaniiRix thanks for the PR. I think this is an incorrect way to estimate fees from spread? We are just calculating this as trade profits? For eg: ETH was 1800$ in the morning and 2000$ at night , and user sold 1 at morning and bought one at night, doesn't necessarily mean fees was 200$? Spread should be more about calculating price difference during the trade, but not sure if there is an efficient way?

my bad. what if we fix it to diff the two legs within the same swap instead, so there's no option for price movement?

Can you please give an example of how it can be done?

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.

2 participants