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 CDP Loop functionality #12830

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
40 changes: 35 additions & 5 deletions projects/loopfi/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@

const ADDRESSES = require('../helper/coreAssets.json')
const { sumTokensExport } = require("../helper/unwrapLPs")

// Prelaunch
const LOOP_PRELAUNCH = "0xaBEEcB1d3414550B30694bB37ac24CAaD0b82aE9"
const LOOP_PRELAUNCH_SCROLL = "0x640befeAd1A7ce841ef878058A7003EC260ebAE8"
const LOOP_PRELAUNCH_BTC = "0x497Fb40D610C29E66d06F3B18Cd9966053abB49A"
const LOOP_PRELAUNCH_YNETH = "0xa67C60AE18BE09F074a6c733a1cc06B63Ae53589"

// Loop tokens
const lpETH = "0xa684EAf215ad323452e2B2bF6F817d4aa5C116ab"
const lpBNB = "0xED166436559Fd3d7f44cb00CACDA96EB999D789e"


const tokens = {
WETH: ADDRESSES.ethereum.WETH,
weETH: "0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee",
Expand Down Expand Up @@ -33,14 +40,37 @@ const tokensYieldnest = {
ynETH: '0x09db87A538BD693E9d08544577d5cCfAA6373A48'
}

const spectraVault = "0x9BfCD3788f923186705259ae70A1192F601BeB47"
const spectraLPToken = "0x2408569177553A427dd6956E1717f2fBE1a96F1D"


async function tvlEthereum(api) {
const calls = [lpETH]
const assets = await api.multiCall({ abi: 'address:asset', calls, })
const ownerTokens = [
[Object.values(tokens), LOOP_PRELAUNCH],
[Object.values(tokensBtc), LOOP_PRELAUNCH_BTC],
[Object.values(tokensYieldnest), LOOP_PRELAUNCH_YNETH],
[[spectraLPToken], spectraVault],
]
assets.forEach((asset, i) => ownerTokens.push([[asset], calls[i]]))
return api.sumTokens({ ownerTokens })
}

async function tvlBnb(api) {
const assets = await api.multiCall({ abi: 'address:asset', calls: [lpBNB] })
return api.sumTokens({ tokensAndOwners2: [assets, [lpBNB]] })
}

module.exports = {
methodology:
"Counts the number of WETH, WBTC and LRT tokens in the LoopFi Prelaunch Contracts in Ethereum and Scroll networks.",
start: '2024-06-14',
"Counts the number of deposited tokens in the Prelaunch Contracts and the tokens provided as collateral in the Loop Protocol",
start: 1718390875,
ethereum: {
tvl: sumTokensExport({
ownerTokens: [[Object.values(tokens), LOOP_PRELAUNCH], [Object.values(tokensBtc), LOOP_PRELAUNCH_BTC], [Object.values(tokensYieldnest), LOOP_PRELAUNCH_YNETH]],
})
tvl: tvlEthereum
},
bsc: {
tvl: tvlBnb
},
scroll: {
tvl: sumTokensExport({
Expand Down
Loading