Skip to content
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

Gyroscope: fee adapter #2465

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

Conversation

Lor3mipsvm
Copy link

No description provided.

@llamabutler
Copy link

The gyroscope adapter exports:

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

🦙 Running GYROSCOPE adapter 🦙
---------------------------------------------------
Error: Cannot find module '../helpers/chains'
Require stack:
- /home/runner/work/dimension-adapters/dimension-adapters/fees/gyroscope/index.ts
- /home/runner/work/dimension-adapters/dimension-adapters/cli/testAdapter.ts
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/home/runner/work/dimension-adapters/dimension-adapters/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:1051:27)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/home/runner/work/dimension-adapters/dimension-adapters/fees/gyroscope/index.ts:2:1)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module.m._compile (/home/runner/work/dimension-adapters/dimension-adapters/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Object.require.extensions.<computed> [as .ts] (/home/runner/work/dimension-adapters/dimension-adapters/node_modules/ts-node/src/index.ts:1621:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/runner/work/dimension-adapters/dimension-adapters/fees/gyroscope/index.ts',
    '/home/runner/work/dimension-adapters/dimension-adapters/cli/testAdapter.ts'
  ]
}

return async (options: FetchOptions) => {
const dailyFees = options.createBalances();
try {
const value = await queryDune("4776022", {});
Copy link
Contributor

Choose a reason for hiding this comment

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

seem your query is wrong

  1. should split by chain

Copy link
Member

Choose a reason for hiding this comment

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

also, can you compute this on chain using event logs, the dune query is bit confusing

@llamabutler
Copy link

The gyroscope adapter exports:

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

🦙 Running GYROSCOPE adapter 🦙
---------------------------------------------------
Error: Cannot find module '../helpers/chains'
Require stack:
- /home/runner/work/dimension-adapters/dimension-adapters/fees/gyroscope/index.ts
- /home/runner/work/dimension-adapters/dimension-adapters/cli/testAdapter.ts
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/home/runner/work/dimension-adapters/dimension-adapters/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:1051:27)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/home/runner/work/dimension-adapters/dimension-adapters/fees/gyroscope/index.ts:2:1)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module.m._compile (/home/runner/work/dimension-adapters/dimension-adapters/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Object.require.extensions.<computed> [as .ts] (/home/runner/work/dimension-adapters/dimension-adapters/node_modules/ts-node/src/index.ts:1621:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/runner/work/dimension-adapters/dimension-adapters/fees/gyroscope/index.ts',
    '/home/runner/work/dimension-adapters/dimension-adapters/cli/testAdapter.ts'
  ]
}

Copy link
Author

@Lor3mipsvm Lor3mipsvm Feb 28, 2025

Choose a reason for hiding this comment

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

  • tried to add a fee split by chain
  • doing this with onchain events would be rather convoluted, dune seems significantly easier
  • would strongly welcome any edits to make this adapter work

Copy link
Member

Choose a reason for hiding this comment

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

"doing this with onchain events would be rather convoluted" why? can you briefly explain how you are computing the fees? I can look into writing the adapter myself.

We prefer onchain adapter over dune as it is less maintenance and we have better control

Copy link
Author

@Lor3mipsvm Lor3mipsvm Mar 3, 2025

Choose a reason for hiding this comment

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

would be amazing if you could help with the adapter @g1nt0ki .

here would be the logic for doing this onchain:

  • protocol fees accrue from pools to fee collector addresses. fee collector addresses are defined on a per-chain basis.
  • listing these addresses below, but FYI, you can query the fee collector addresses by looking at the addresses returned by the getFeesMetadata function of any pool: eg https://basescan.org/address/0x276a02120c71193b138941dc5838da270e98e088#readContract#F11
  • fees that accrue to the fee collector addresses are LP shares and must be priced first. the LP share pricing logic is as follows: (amount of LP shares minted to the fee collector) / (post-event pool.getActualSupply()) * (post-event pool TVL)

for your convenience, also listing all fee collector addresses here:

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.

4 participants