Skip to content

Conversation

abdullahabro
Copy link
Contributor

NOTE

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


  • If you would like to add a tvl adapter please submit the PR here.
  1. 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.
  2. Please fill the form below only if the PR is for listing a new protocol else it can be ignored/replaced with reason/details about the PR
  3. For updating listing info It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data4.ts, you can edit it there and put up a PR
  4. Do not edit/push poackage.json/package-lock.json file as part of your changes
  5. No need to go to our discord/other channel and announce that you've created a PR, we monitor all PRs and will review it asap

Name (to be shown on DefiLlama):
Twitter Link:
List of audit links if any:
Website Link:
Logo (High resolution, will be shown with rounded borders):
Current TVL:
Treasury Addresses (if the protocol has treasury)
Chain:
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):
Token address and ticker if any:
Category (full list at https://defillama.com/categories) *Please choose only one:
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):
methodology (what is being counted as tvl, how is tvl being calculated):
Github org/user (Optional, if your code is open source, we can track activity):

@llamabutler
Copy link

The bluefin-alphalend.ts adapter exports:

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

🦙 Running BLUEFIN-ALPHALEND.TS adapter 🦙
---------------------------------------------------
Start Date:	Mon, 13 Oct 2025 08:49:47 GMT
End Date:	Tue, 14 Oct 2025 08:49:47 GMT
---------------------------------------------------

TypeError: Cannot read properties of undefined (reading 'startTimestamp')
    at fetch (/home/runner/work/dimension-adapters/dimension-adapters/fees/bluefin-alphalend.ts:11:69)
    at getChainResult (/home/runner/work/dimension-adapters/dimension-adapters/adapters/utils/runAdapter.ts:220:25)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
    at async _runAdapter (/home/runner/work/dimension-adapters/dimension-adapters/adapters/utils/runAdapter.ts:173:20)
    at async /home/runner/work/dimension-adapters/dimension-adapters/cli/testAdapter.ts:69:24 {
  chain: 'sui'
}

@abdullahabro
Copy link
Contributor Author

abdullahabro commented Oct 14, 2025

Hey team
I have a couple of queries

  • What is the frequency of fetching Fees data? I assume it's per hour

  • I am observing Incorrect daily fee bars on Defilama, and the reason for that, I suppose, is because, for the fetch call at, for example, 00:10 UTC, the new day starts, and we return fees for the new day, but the adapter registers those fees against the previous day, which becomes under-reported as the day has just started.
    As a concrete example from our logs, there was one fetch data performed at 2025-10-13 23:52:12.238 while after that the next operation was performed at 2025-10-14 01:20:57.648, and the result of that was stored in for 13th which is quite confusing.

  • To cater to this, I have added timestamps in the API so the data is fetched based on start and end timestamps of the day, but seems like the options in the Fetch function are not provided.
    Can you recommend what field I should use here for the purpose

@treeoflife2

@treeoflife2 treeoflife2 self-assigned this Oct 14, 2025
@treeoflife2
Copy link
Member

@abdullahabro
for verion 2 adapter frequency is per hour, for today, we fetch last 24h data(so if current utc time is 10am, then we fetch previous day 10am to current day 10am), and at the end of the day, it will be replaced with correct current day 24h range(00:00 utc to 24:00 utc), if api only returns the daily data then i suggest you conver this to version 1. no need to handle it like this. version 1 will automatically handle it(as it's fetched once a day at UTC 00:00) to fetch previous day info.

lmk if there is still confusion

@llamabutler
Copy link

The bluefin-alphalend.ts adapter exports:

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

🦙 Running BLUEFIN-ALPHALEND.TS adapter 🦙
---------------------------------------------------
Start Date:	Mon, 13 Oct 2025 00:00:00 GMT
End Date:	Tue, 14 Oct 2025 00:00:00 GMT
---------------------------------------------------

SUI 👇
Backfill start time: 17/6/2025
Daily fees: 13.16 k
Daily user fees: 13.16 k
Daily revenue: 2.14 k
Daily holders revenue: 0
Daily protocol revenue: 2.14 k
Daily supply side revenue: 11.02 k

@abdullahabro
Copy link
Contributor Author

@abdullahabro for verion 2 adapter frequency is per hour, for today, we fetch last 24h data(so if current utc time is 10am, then we fetch previous day 10am to current day 10am), and at the end of the day, it will be replaced with correct current day 24h range(00:00 utc to 24:00 utc), if api only returns the daily data then i suggest you conver this to version 1. no need to handle it like this. version 1 will automatically handle it(as it's fetched once a day at UTC 00:00) to fetch previous day info.

lmk if there is still confusion

@treeoflife2 one more question
For version 1, the job triggers strictly at UTC 00:00 or maybe even before?
I'm asking so that I can modify the API accordingly. Right now, the API strictly returns Fees accumulated during the day, i.e. (00:00 to 23:59:59), based on the request time. So, if a request is coming even a few seconds into the new day, it will return fees for that new day.

@treeoflife2
Copy link
Member

@abdullahabro for verion 2 adapter frequency is per hour, for today, we fetch last 24h data(so if current utc time is 10am, then we fetch previous day 10am to current day 10am), and at the end of the day, it will be replaced with correct current day 24h range(00:00 utc to 24:00 utc), if api only returns the daily data then i suggest you conver this to version 1. no need to handle it like this. version 1 will automatically handle it(as it's fetched once a day at UTC 00:00) to fetch previous day info.
lmk if there is still confusion

@treeoflife2 one more question For version 1, the job triggers strictly at UTC 00:00 or maybe even before? I'm asking so that I can modify the API accordingly. Right now, the API strictly returns Fees accumulated during the day, i.e. (00:00 to 23:59:59), based on the request time. So, if a request is coming even a few seconds into the new day, it will return fees for that new day.

API should respond with the fees generated in requested time, without modifying anything in backend API, in version 1 it will strictly pass the start and end time as the previous day start(00:00 UTC) and end time as end(23:59 UTC)

@llamabutler
Copy link

The bluefin-alphalend.ts adapter exports:

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

🦙 Running BLUEFIN-ALPHALEND.TS adapter 🦙
---------------------------------------------------
Start Date:	Tue, 14 Oct 2025 00:00:00 GMT
End Date:	Wed, 15 Oct 2025 00:00:00 GMT
---------------------------------------------------

SUI 👇
Backfill start time: 17/6/2025
Daily fees: 11.14 k
Daily user fees: 11.14 k
Daily revenue: 1.80 k
Daily holders revenue: 0
Daily protocol revenue: 1.80 k
Daily supply side revenue: 9.34 k

@abdullahabro
Copy link
Contributor Author

abdullahabro commented Oct 15, 2025

@treeoflife2 Sounds good, can you please review the PR
Also just to confirm the start and end timestamps from options param are provided in ms ? because API supports in ms.
Let me know so i can convert accordingly

@treeoflife2
Copy link
Member

@abdullahabro api gives same results,
https://lend.api.sui-prod.bluefin.io/api/v1/fees/daily?startTime=1760400000&endTime=1760486400
https://lend.api.sui-prod.bluefin.io/api/v1/fees/daily?startTime=1760400000000&endTime=1760486400000

options.startTimestamp is in seconds.

@treeoflife2 treeoflife2 merged commit 6230cd9 into DefiLlama:master Oct 15, 2025
2 checks passed
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