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

Add SaberDao adapter to fetch last 24h fees from SaberDAO #2675

Merged
merged 8 commits into from
Mar 31, 2025

Conversation

treeoflife2
Copy link
Contributor

@llamabutler
Copy link

The saber adapter exports:

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

🦙 Running SABER adapter 🦙
---------------------------------------------------
Start Date:	Fri, 21 Mar 2025 00:00:00 GMT
End Date:	Sat, 22 Mar 2025 00:00:00 GMT
---------------------------------------------------

SOLANA 👇
Backfill start time not defined
Daily fees: 0
Daily revenue: 0

@llamabutler
Copy link

The saber adapter exports:

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

🦙 Running SABER adapter 🦙
---------------------------------------------------
Start Date:	Sun, 23 Mar 2025 00:00:00 GMT
End Date:	Mon, 24 Mar 2025 00:00:00 GMT
---------------------------------------------------

SOLANA 👇
Backfill start time not defined
Daily fees: 0
Daily revenue: 0

@llamabutler
Copy link

The saber adapter exports:

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

🦙 Running SABER adapter 🦙
---------------------------------------------------
Start Date:	Sun, 23 Mar 2025 00:00:00 GMT
End Date:	Mon, 24 Mar 2025 00:00:00 GMT
---------------------------------------------------

Balances {
  chain: 'solana',
  timestamp: undefined,
  _balances: {
    'solana:KNVfdSJyq1pRQk9AKKv1g5uyGuk6wpm4WG16Bjuwdma': 0.0000431395332,
    'solana:DdFPRnccQqLD4zCHrBqdY95D6hvw6PLWp9DEXj1fLCL9': 0.0059547560942000005,
    'solana:eqKJTf1Do4MDPyKisMYqVaUFpkEFAs3riGF3ceDH2Ca': 0.0010057520000000002,
    'solana:ASoLXbfe7cd6igh5yiEsU8M7FW64QRxPKkxk7sjAfond': 1.9532400000000004e-7,
    'solana:So11111111111111111111111111111111111111112': 0.005396146442200001,
    'solana:BonK1YhkXEGLZzwtcvRTip3gAL9nCeQD7ppZBLXhtTs': 0.000020584305200000002,
    'solana:broKrYYAnJ4jHSQVTCf2wmS6i6SR2sDXDDaWrPD2kJJ': 0.013433828811700002,
    'solana:bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1': 0.010909291406099999,
    'solana:CUSDvqAQLbt7fRofcmV2EXfPA2t36kzj7FjzdmqDiNQL': 0.000013686,
    'solana:2VhjJ9WxaGC3EZFwJG9BDUs9KxKCAjQY4vgd1qxgYWVg': 0.0705317334,
    'solana:7Q2afV64in6N6SeZsAAB81TJzwDoD6zpqmHkzi9Dcavn': 0.00014775459999999996,
    'solana:GEJpt3Wjmr628FqXxTgxMce1pLntcPV4uFi8ksxMyPQh': 0.0034413166199999995,
    'solana:mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So': 0.008676063434900003,
    'solana:jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v': 0.0008412439216999999,
    'solana:BdZPG9xWrG3uFrx2KrUW1jT4tZ9VKPDWknYihzoPRJS3': 0.000335307306,
    'solana:9EaLkQrbjmbbuZG9Wdpo8qfNUEjHATJFSycEmw6f1rGX': 0.000017444246400000004,
    'solana:sagasDqusfYSQMf7DD2dNfUvX3coLZdmKE3ajyPK9kL': 0.000001056045,
    'solana:5oVNBeEEQvYi1cX3ir8Dx5n1P7pdxydbGF2X4TxVusJm': 0.0000509240016,
    'solana:SouL4UuxKaFutpyZGb2weXUPEQCCsmEHSubMJEs7ttH': 0.0002164738748,
    'solana:7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj': 0.0008477089667000004,
    'solana:Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS': 0.007888718599999999,
    'solana:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v': 16.447942684900426,
    'solana:USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX': 0.0061404872,
    'solana:9iLH8T7zoWhY7sBmj1WK9ENbWdS1nL8n9wAxaeRitTa6': 0.0005790600708,
    'solana:7kbnvuGBxxj8AG9qp8Scn56muWGaRaFqxg1FsRp3PaFT': 0.5617832769999999,
    'solana:cbbtcf3aa214zXHbiAZQwf4122FBYbraNdFqgw4iMij': 0.00007314142400000006,
    'solana:5RpUwQ8wtdPCZHhu6MERp2RGrpobsbZ6MH5dDHkUjs2': 0.002177479092,
    'solana:A9mUU4qviSctJVPJdBJWkb28deg915LYJKrzQ19ji3FM': 0.0071173879,
    'solana:Dn4noZ5jgGfkntzcQSUZ8czkreiZ1ForXYoV2H8Dm7S1': 0.02748050759999981,
    'solana:SL819j8K9FuFPL84UepVcFkEZqDUUvVzwDmJjCHySYj': 3.0760000000000003e-7,
    'solana:E2VmbootbVCBkMNNxKQgCLMS1X3NoGMaYAsufaAsf7M': 0.007576891600000001,
    'solana:5goWRao6a3yNC4d6UjMdQxonkCMvKBwdpubU3qhfcdf1': 7.1846056096,
    'solana:9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i': 0.22167978519999998
  }
}
SOLANA 👇
Backfill start time not defined
Daily fees: 0
Daily revenue: 0

@g1nt0ki g1nt0ki self-assigned this Mar 24, 2025
if (!tokenAMint) return;

if (pool.feesUsd > 0) {
dailyFees.add(tokenAMint.toString(), pool.feesUsd)
Copy link
Member

Choose a reason for hiding this comment

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

if you are adding USD fee value, no need to pass token, can do dailyFees.addUSDValue(pool.feesUsd)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as per their frontend, they still convert it to usd, even if it says feesUsd
image

})
console.log(dailyFees);

return { dailyFees, dailyRevenue: dailyFees, }
Copy link
Member

Choose a reason for hiding this comment

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

dont think thats the case? all the fees goes to the LPs? https://docs.llama.fi/list-your-project/other-dashboards/dimensions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are right, it will be different for dailyRevenue, as they have dynamic fee per pools and it keeps changing as new votes are passed afaik. so will find out if there is any other way to calculate the protocol fees.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated fees, and added doc for fee calculation as per contract and docs.

@llamabutler
Copy link

The saber adapter exports:

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

🦙 Running SABER adapter 🦙
---------------------------------------------------
Start Date:	Mon, 24 Mar 2025 00:00:00 GMT
End Date:	Tue, 25 Mar 2025 00:00:00 GMT
---------------------------------------------------

SOLANA 👇
Backfill start time not defined
Daily fees: 0
Daily revenue: 0

@llamabutler
Copy link

The saber adapter exports:

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

🦙 Running SABER adapter 🦙
---------------------------------------------------
Start Date:	Thu, 27 Mar 2025 00:00:00 GMT
End Date:	Fri, 28 Mar 2025 00:00:00 GMT
---------------------------------------------------

SOLANA 👇
Backfill start time not defined
Daily fees: 77
Daily revenue: 77
Daily protocol revenue: 38
Daily supply side revenue: 38

@treeoflife2 treeoflife2 requested a review from g1nt0ki March 28, 2025 18:36

return {
dailyFees,
dailyRevenue: dailyFees,
Copy link
Member

Choose a reason for hiding this comment

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

daily revenue is what goes to the protocol (and maybe the protocol token holders), so it is dailyProtocolRevenue in this case?

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 also fix the dex adapter of saber?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed dailyRevenue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dex adapter is no longer working, as doesn't give correct data, should i remove that or move fees adapter to there?

@llamabutler
Copy link

The saber adapter exports:

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

🦙 Running SABER adapter 🦙
---------------------------------------------------
Start Date:	Fri, 28 Mar 2025 00:00:00 GMT
End Date:	Sat, 29 Mar 2025 00:00:00 GMT
---------------------------------------------------

SOLANA 👇
Backfill start time not defined
Daily fees: 61
Daily revenue: 30
Daily protocol revenue: 30
Daily supply side revenue: 30

@llamabutler
Copy link

The saber adapter exports:

> [email protected] test
> ts-node --transpile-only cli/testAdapter.ts dexs saber

🦙 Running SABER adapter 🦙
---------------------------------------------------
Start Date:	Sat, 29 Mar 2025 00:00:00 GMT
End Date:	Sun, 30 Mar 2025 00:00:00 GMT
---------------------------------------------------

SOLANA 👇
Backfill start time not defined
Daily volume: 0
End timestamp: 1743351845 (2025-03-30T16:24:05.000Z)

@llamabutler
Copy link

The saber adapter exports:

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

🦙 Running SABER adapter 🦙
---------------------------------------------------
Start Date:	Sat, 29 Mar 2025 00:00:00 GMT
End Date:	Sun, 30 Mar 2025 00:00:00 GMT
---------------------------------------------------

SOLANA 👇
Backfill start time not defined
Daily fees: 40
Daily revenue: 20
Daily protocol revenue: 20
Daily supply side revenue: 20

@treeoflife2 treeoflife2 requested a review from g1nt0ki March 30, 2025 16:24
@llamabutler
Copy link

The saber adapter exports:

> [email protected] test
> ts-node --transpile-only cli/testAdapter.ts dexs saber

🦙 Running SABER adapter 🦙
---------------------------------------------------
Start Date:	Sun, 30 Mar 2025 00:00:00 GMT
End Date:	Mon, 31 Mar 2025 00:00:00 GMT
---------------------------------------------------

SOLANA 👇
Backfill start time not defined
Daily volume: 259.60 k

@llamabutler
Copy link

The saber adapter exports:

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

🦙 Running SABER adapter 🦙
---------------------------------------------------
Start Date:	Sun, 30 Mar 2025 00:00:00 GMT
End Date:	Mon, 31 Mar 2025 00:00:00 GMT
---------------------------------------------------

SOLANA 👇
Backfill start time not defined
Daily fees: 29
Daily revenue: 14
Daily protocol revenue: 14
Daily supply side revenue: 14

@g1nt0ki g1nt0ki merged commit 9d4c978 into DefiLlama:master Mar 31, 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