-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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 Tea-Fi Adapter #13628
Open
MaxCojocari
wants to merge
2
commits into
DefiLlama:main
Choose a base branch
from
Tea-Fi:add-teafi-adapter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+74
−0
Open
Add Tea-Fi Adapter #13628
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const SYNTHETIC_TOKENS = { | ||
polygon: { | ||
tUSDT: "0x1E438D4414f38CD2bEB71B73721181CDe019f708", | ||
tWPOL: "0x1Cd0cd01c8C902AdAb3430ae04b9ea32CB309CF1", | ||
tUSDC: "0xCCC44CA311149A790d06f36649383C92607C93f7", | ||
tSOL: "0x4952B1A890BD49CB060d42Ab70cf6eB4FE0839Ee", | ||
tWBTC: "0x3f6a44fd4Def23a8007A7A23eb55cf8B66E97A6f", | ||
tWETH: "0x63dC32c7872D9aF96f7A56b98df17B5453d93EFC", | ||
}, | ||
ethereum: { | ||
tUSDT: "0xc3a85901ca900cc91467bec95ea22d50cdcefe98", | ||
tPOL: "0x7a24358fe50195c55e85840983a2486069d4efce", | ||
tUSDC: "0x7f985691b98c6874257eba1d8732d60eec1dccde", | ||
tSOL: "0x0f19a77bd5670022b041b703c5be657c59b4f349", | ||
tWBTC: "0x1d0c1ef072493bb0e8ccd164370394bd294bdb90", | ||
tWETH: "0x833723cfb394b643e8013aca00bcc2a6affdaeab", | ||
} | ||
} | ||
|
||
const SYNTHETIC_STAKING = { | ||
ethereum: '0xd491C1A7E3C6AF6c2A8f8e3EF54E50044F3BA9AA', | ||
polygon: '0xBeB9503dDBDA15aE0D19cf817028C19077f0e99E' | ||
} | ||
|
||
module.exports = { | ||
SYNTHETIC_TOKENS, | ||
SYNTHETIC_STAKING | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const { SYNTHETIC_TOKENS, SYNTHETIC_STAKING } = require("./constants") | ||
|
||
const stakings = async (api) => { | ||
const { chain } = api | ||
const synthTokens = Object.values(SYNTHETIC_TOKENS[chain]) | ||
const synthBalances = await api.multiCall({ | ||
calls: synthTokens.map(token => ({ | ||
target: token, | ||
params: [SYNTHETIC_STAKING[chain]] | ||
})), | ||
abi: 'erc20:balanceOf', | ||
}) | ||
const underlyingAssets = await api.multiCall({ | ||
calls: synthTokens.map(token => ({ | ||
target: token, | ||
params: [] | ||
})), | ||
abi: 'address:underlyingAsset', | ||
}) | ||
const underlyingAssetDecimals = await api.multiCall({ | ||
calls: underlyingAssets.map(token => ({ | ||
target: token, | ||
params: [] | ||
})), | ||
abi: 'erc20:decimals', | ||
}) | ||
const correctedBalances = synthBalances.map((balance, index) => | ||
BigInt(underlyingAssetDecimals[index]) < 18n ? | ||
BigInt(balance) / 10n ** (18n - BigInt(underlyingAssetDecimals[index])) : | ||
BigInt(balance) * 10n ** (BigInt(underlyingAssetDecimals[index]) - 18n) | ||
) | ||
|
||
api.add(underlyingAssets, correctedBalances) | ||
} | ||
|
||
module.exports = { | ||
methodology: "TVL is the total value of the assets that back synthetic tokens in staking pools on a specific chain.", | ||
ethereum: { | ||
tvl: () => ({}), | ||
staking: stakings, | ||
}, | ||
polygon: { | ||
tvl: () => ({}), | ||
staking: stakings, | ||
} | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 prefer counting the tokens backing the synth token as tvl rather than staked synth under staking
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.
@g1nt0ki Refined the methodology, see commit.
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.
no, you misunderstood my request. I meant, track the balances of tokens backing the synth token. Where does the yield come from?
I tried looking at synth USDT on ethereum, 159k comes from bybit, synth USDT is minted and the money goes back into bybit?
https://etherscan.io/token/0xdac17f958d2ee523a2206206994597c13d831ec7?a=0x7df4253cf5cf81f7ca7fa5f37e54bc3543a528fb
https://etherscan.io/token/0xdac17f958d2ee523a2206206994597c13d831ec7?a=0xef1735c00b943ac18b96606d91393ed5ad47c23c