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 Tea-Fi Adapter #13628

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions projects/tea-fi/constants.js
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
}
46 changes: 46 additions & 0 deletions projects/tea-fi/index.js
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: () => ({}),
Copy link
Member

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

Copy link
Author

@MaxCojocari MaxCojocari Feb 28, 2025

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.

Copy link
Member

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

staking: stakings,
},
polygon: {
tvl: () => ({}),
staking: stakings,
}
};
Loading