Skip to content

Conversation

@0x4r45h
Copy link
Contributor

@0x4r45h 0x4r45h commented Dec 6, 2025

I could calculate fees and revenue based on volume, but I thought tracking the treasury address might be a better approach, in case they add new sources of revenue in the future.

@llamabutler
Copy link

The stabull adapter exports:

> adapters@1.0.0 test
> ts-node --transpile-only cli/testAdapter.ts dexs stabull

🦙 Running STABULL adapter 🦙
---------------------------------------------------
Start Date:	Fri, 05 Dec 2025 02:11:55 GMT
End Date:	Sat, 06 Dec 2025 02:11:55 GMT
---------------------------------------------------

Token transfers: Failed to use indexer, falling back to logs base Llama Indexer v2 URL/api key is not set
Token transfers: Failed to use indexer, falling back to logs ethereum Llama Indexer v2 URL/api key is not set
Token transfers: Failed to use indexer, falling back to logs polygon Llama Indexer v2 URL/api key is not set
chain     | Daily volume | Daily revenue | Daily fees | Start Time
---       | ---          | ---           | ---        | ---       
ethereum  | 72.00        | 0.00          | 0.00       | 29/4/2024 
polygon   | 11.62 k      | 5.00          | 17.00      | 29/4/2024 
base      | 8.25 k       | 4.00          | 12.00      | 8/7/2025  
Aggregate | 19.94 k      | 9.00          | 29.00      |           

options,
balances: dailyFees,
targets: [configs[options.chain].treasury], // Treasury address
fromAdddesses,
Copy link
Member

Choose a reason for hiding this comment

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

even though you are restricting the source here, it still has room for bugs and a bit inefficient as we are pulling two sets of logs when trade log already has fee info, also what happens when they change the treasury address?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the feeData on the event is raw and needs some calculations based on Oracle data at that exact moment to figure out the exact fee amount , unfortunately there is no event to read the calculated amount.
here is the respective code:
https://basescan.org/address/0x1246B19c59FfF6A92E875b57402743cf576C86bB#code#L2184

for the treasury address i can dynamically read it from curve contracts
https://basescan.org/address/0x86Ba17ebf8819f7fd32Cf1A43AbCaAe541A5BEbf#readContract#F10

if you still think this way of calculation of fee/revenue is inefficient, i can discard all of these and calculate fees based on volume. since the rates are fixed i think it will achieve the same result

})

for (const event of tradeEvents) {
dailyVolume.addToken(event.origin, event.originAmount)
Copy link
Member

Choose a reason for hiding this comment

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

can you use the addOneToken here, not strictly necessary, what it does is, if one of the token is well known like eth or a stablecoin, uses that for fees, this way, we are more likely to have price support for the given token

const logs = await options.getLogs({
target: address,
eventAbi: events.newCurve,
onlyArgs: true,
Copy link
Member

Choose a reason for hiding this comment

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

can you add cacheInCloud: true here, this caches the log response

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah i was looking for a way to cache this data, didn't know about this. thanks

Copy link
Member

@g1nt0ki g1nt0ki left a comment

Choose a reason for hiding this comment

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

.

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