-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Add Shift Protocol TVL adapter #16717
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
Conversation
Introduces ShiftTvlFeed ABI, config for contract addresses, and an index.js adapter to calculate TVL for Shift Protocol vaults. TVL is aggregated from USDC deposits using the latest on-chain data.
The adapter at projects/shift-protocol exports TVL:
|
For the Twitter account is actually: https://x.com/shiftprotocol_ the hyperlink is not considering the "_", please do when providing the link |
projects/shift-protocol/index.js
Outdated
let totalTvl = 0; | ||
|
||
for (const address of contractsByChain[chain]) { | ||
const contract = new Contract(address, abi, provider); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use our SDK here rather than ethers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the defillama sdk can create contract interfaces, there is no issue. Beware of the abi that is custom for our contracts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check the docs https://docs.llama.fi/list-your-project/submit-a-project and look at other adapters in the repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
projects/shift-protocol/index.js
Outdated
]); | ||
|
||
const tvlValue = parseFloat(formatUnits(tvlData.value, decimals)); | ||
totalTvl += tvlValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please return token balances using api.add() or similar rather than exporting a USD amount
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a token amout is the vault tvl trough our tvl oraclefeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a way to count the tokens deposited to each vault
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pivit to a different calculation for TVL with our share supply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still exporting a USD amount though - we need to export token balances of the deposit tokens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So our situation right now is the following:
- we track internally the USD TVL in the system
- the way we do this is through Starknet's Library + Paradex API, to know how much Paradex Vault shares our wallet has and multiply that value per the current reported price of the share. The share has no open market, it's a fundamental price/value calculated based on the increasing amount of USD backing the shares.
- afaik, there is no single way for us to surface the final result (how much TVL in $) without doing these two steps, as Paradex API by themselves don't offer this possibility, there is no "coingecko" or similar pricing for the underlying asset and no open markets to trade them.
We can share in detail how we calculate it / explain the methodology, would that be okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes please let us know the calculation
@@ -0,0 +1,266 @@ | |||
[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use string form ABI instead - try searching the repo for "function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our TVL (currently) is defined as circulating liquid receipt tokens (ltPARA) * share price.
We emit ltPARA which is an ERC20 token on Base, against USDC deposits. The deposits then get transferred to Paradex and deposited in the Gigavault (which is their LP/MM vault).
Therefore, for the circulating of supply this is fairly easy, as it corresponds to https://basescan.org/token/0xaf69bf9ea9e0166498c0502af5b5945980ed1e0e
The price is calculated as a fundamental value via: underlying backing / number of circulating shares.
Therefore, as you see, our TVL is essentially calculated as the underlying backing.
The underlying backing is calculated via several steps:
The dust/inactive deposits on base at our wallet: https://basescan.org/address/0x2f8b5f84032c7ffea5a5dc990ce5eb7167d596ed
And the active deposits on Paradex.
Through Paradex APIs we get:
- the amount of USDC on the Paradex account
- the value of our deposit into the Gigavault (calculated as: number of Gigavault shares * price of one share, both extracted via Paradex APIs), with the numbers of gigavault shares we are holding being extracted through Starknet library
Removed ShiftTvlFeed.json ABI and updated TVL logic in index.js to use standard ERC20 totalSupply and decimals, along with a custom getSharePrice() call. The config.js contract address was updated. TVL is now calculated as totalSupply * getSharePrice (formatted with 6 decimals) for each contract.
The adapter at projects/shift-protocol exports TVL:
|
Revised the methodology field in the adapter to provide a clearer explanation of how TVL is calculated, emphasizing the aggregation of total supply and share price across contracts.
The adapter at projects/shift-protocol exports TVL:
|
Please remove any try/catch |
Simplifies error handling for ABI calls in the TVL calculation by removing try/catch blocks and checking for missing outputs instead. Logs warnings and applies sensible defaults when data is unavailable.
The adapter at projects/shift-protocol exports TVL:
|
Removed try/catch as requested. |
Introduces ShiftTvlFeed ABI, config for contract addresses, and an index.js adapter to calculate TVL for Shift Protocol vaults. TVL is aggregated from USDC deposits using the latest on-chain data.
NOTE
Please enable "Allow edits by maintainers" while putting up the PR.
package-lock.json
file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CIName (to be shown on DefiLlama):
Shift Protocol
Twitter Link:
https://twitter.com/shiftprotocol_
List of audit links if any:
https://github.com/SHIFT-NebulaLabs/shift-contracts/blob/main/audits/shift-sbsecurity-audit-2025.pdf
Website Link:
https://shiftprotocol.xyz/
Logo (High resolution, will be shown with rounded borders):
https://raw.githubusercontent.com/SHIFT-NebulaLabs/resources/main/SHIFT-logo-dark.png
Current TVL:
$500,000
Treasury Addresses (if the protocol has treasury)
Chain:
Base
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):
Shift is a DeFi protocol offering a suite of yield products built on top of leading on-chain perpetual futures exchanges (Perp DEXs). Our mission is to make high-yield strategies available to anyone through transparent, on-chain vaults.
Token address and ticker if any:
Category (full list at https://defillama.com/categories) *Please choose only one:
Onchain Capital Allocator
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):
TVL is calculated as the aggregated amount of USDC deposited across all of Shift's vault, inclusive of losses or gains
Github org/user (Optional, if your code is open source, we can track activity):