Skip to content

FEAT-BERADROME: Change holders revenue method #3130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

t0rbik
Copy link
Contributor

@t0rbik t0rbik commented May 8, 2025

Previously added method has two issues:

  1. Wrong decimals (needs to be scaled down by 10^18 to wei).
  2. RewardAdded event includes leftovers from previous emissions.

The fix is to get Distributor events to Beradrome Reward Vault. I couldn't find an api to filter by arg (topic) specifically in getLogs request.

@llamabutler
Copy link

The beradrome adapter exports:

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

🦙 Running BERADROME adapter 🦙
---------------------------------------------------
Start Date:	Wed, 07 May 2025 18:00:05 GMT
End Date:	Thu, 08 May 2025 18:00:05 GMT
---------------------------------------------------

RangeError: Maximum call stack size exceeded
    at getLogs (/home/runner/work/dimension-adapters/dimension-adapters/node_modules/@defillama/sdk/build/util/logs.js:108:14)
    at async addHoldersRevenue (/home/runner/work/dimension-adapters/dimension-adapters/fees/beradrome/index.ts:86:16)
    at async fetch (/home/runner/work/dimension-adapters/dimension-adapters/fees/beradrome/index.ts:112:3)
    at async getChainResult (/home/runner/work/dimension-adapters/dimension-adapters/adapters/utils/runAdapter.ts:74:18)
    at async Promise.all (index 0)
    at async runAdapter (/home/runner/work/dimension-adapters/dimension-adapters/adapters/utils/runAdapter.ts:46:20)
    at async /home/runner/work/dimension-adapters/dimension-adapters/cli/testAdapter.ts:84:21 {
  chain: 'berachain'
}

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.

hi @t0rbik thanks for the PR. the code is mostly good, but can you add a topics filter like here:

https://github.com/DefiLlama/dimension-adapters/blob/master/fees/beraborrow/index.ts#L163

this way, we filter logs while querying the rpc instead of pulling all the logs and then filtering on our end

@t0rbik
Copy link
Contributor Author

t0rbik commented May 9, 2025

@g1nt0ki thank you for taking a look.
The issue is that topics are order-dependent and our RewardVault comes only as a third topic. Do you have any advice how to fill the topic1 and topic2, these are dynamic and can change.

@llamabutler
Copy link

The beradrome adapter exports:

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

🦙 Running BERADROME adapter 🦙
---------------------------------------------------
Start Date:	Mon, 12 May 2025 13:01:47 GMT
End Date:	Tue, 13 May 2025 13:01:47 GMT
---------------------------------------------------

RangeError: Maximum call stack size exceeded
    at getLogs (/home/runner/work/dimension-adapters/dimension-adapters/node_modules/@defillama/sdk/build/util/logs.js:108:14)
    at async addHoldersRevenue (/home/runner/work/dimension-adapters/dimension-adapters/fees/beradrome/index.ts:86:16)
    at async fetch (/home/runner/work/dimension-adapters/dimension-adapters/fees/beradrome/index.ts:112:3)
    at async getChainResult (/home/runner/work/dimension-adapters/dimension-adapters/adapters/utils/runAdapter.ts:75:18)
    at async Promise.all (index 0)
    at async runAdapter (/home/runner/work/dimension-adapters/dimension-adapters/adapters/utils/runAdapter.ts:47:20)
    at async /home/runner/work/dimension-adapters/dimension-adapters/cli/testAdapter.ts:84:21 {
  chain: 'berachain'
}

@llamabutler
Copy link

The beradrome adapter exports:

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

🦙 Running BERADROME adapter 🦙
---------------------------------------------------
Start Date:	Mon, 12 May 2025 13:19:12 GMT
End Date:	Tue, 13 May 2025 13:19:12 GMT
---------------------------------------------------

[Error: Request failed with status code 401] {
  url: 'https://api.dune.com/api/v1/query/3996608/execute',
  method: 'POST',
  axiosError: 'invalid API Key',
  chain: 'berachain'
}

@llamabutler
Copy link

The beradrome adapter exports:

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

🦙 Running BERADROME adapter 🦙
---------------------------------------------------
Start Date:	Mon, 12 May 2025 13:20:47 GMT
End Date:	Tue, 13 May 2025 13:20:47 GMT
---------------------------------------------------

[Error: Request failed with status code 401] {
  url: 'https://api.dune.com/api/v1/query/3996608/execute',
  method: 'POST',
  axiosError: 'invalid API Key',
  chain: 'berachain'
}

@t0rbik t0rbik requested a review from g1nt0ki May 13, 2025 15:51
@g1nt0ki g1nt0ki self-assigned this May 14, 2025
@g1nt0ki
Copy link
Member

g1nt0ki commented May 22, 2025

@g1nt0ki thank you for taking a look. The issue is that topics are order-dependent and our RewardVault comes only as a third topic. Do you have any advice how to fill the topic1 and topic2, these are dynamic and can change.

sorry, missed the message, can you switch back to on chain? we have added an indexer for berachain, you can pass null for topic1 & topic2 like here: https://github.com/DefiLlama/dimension-adapters/blob/master/fees/ethena.ts#L91

@llamabutler
Copy link

The beradrome adapter exports:

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

🦙 Running BERADROME adapter 🦙
---------------------------------------------------
Start Date:	Thu, 22 May 2025 05:59:13 GMT
End Date:	Fri, 23 May 2025 05:59:13 GMT
---------------------------------------------------

BERACHAIN 👇
Backfill start time: 6/2/2025
Daily fees: 3
Daily bribes revenue: 0
Daily holders revenue: 5.75 k
End timestamp: 1747979952 (2025-05-23T05:59:12.000Z)

@t0rbik
Copy link
Contributor Author

t0rbik commented May 23, 2025

@g1nt0ki thank you for taking a look. The issue is that topics are order-dependent and our RewardVault comes only as a third topic. Do you have any advice how to fill the topic1 and topic2, these are dynamic and can change.

sorry, missed the message, can you switch back to on chain? we have added an indexer for berachain, you can pass null for topic1 & topic2 like here: https://github.com/DefiLlama/dimension-adapters/blob/master/fees/ethena.ts#L91

Thank you. Should be done now!

@llamabutler
Copy link

The beradrome adapter exports:

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

🦙 Running BERADROME adapter 🦙
---------------------------------------------------
Start Date:	Tue, 27 May 2025 06:10:33 GMT
End Date:	Wed, 28 May 2025 06:10:33 GMT
---------------------------------------------------

BERACHAIN 👇
Backfill start time: 6/2/2025
Daily fees: 0
Daily bribes revenue: 0
Daily holders revenue: 14.22 k
End timestamp: 1748412632 (2025-05-28T06:10:32.000Z)

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