From 9ecc77f90fcd8f218d24d4a228bdebacc1311116 Mon Sep 17 00:00:00 2001 From: Phil Date: Wed, 30 Aug 2023 11:15:29 -0600 Subject: [PATCH 01/20] Sommelier: Add RYBTC launch and remove Steady, Trend, & MOM vault launches --- projects/sommelier/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/sommelier/index.js b/projects/sommelier/index.js index 5a851a3c1f44..98299db27af2 100644 --- a/projects/sommelier/index.js +++ b/projects/sommelier/index.js @@ -101,9 +101,8 @@ module.exports = { [chain]: { tvl }, hallmarks: [ [1658419200, "aave2 Cellar Launch"], - [1666886400, "ETH-BTC Trend & Momentum Cellars Launch"], - [1669741200, "Steady ETH & BTC Cellars Launch"], [1674671068, "Real Yield USD Cellar Launch"], [1681233049, "Real Yield ETH Cellar Launch"], + [1689271200, "Real Yield BTC Cellar Launch"], ], }; From 5e0a189f3c3c24cfaab69f30e2a9d5856bee45e5 Mon Sep 17 00:00:00 2001 From: Phil Date: Mon, 11 Sep 2023 12:51:41 -0600 Subject: [PATCH 02/20] Sommelier: Add Turbo GHO vault --- projects/sommelier/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/sommelier/index.js b/projects/sommelier/index.js index 98299db27af2..e1e668f8b24f 100644 --- a/projects/sommelier/index.js +++ b/projects/sommelier/index.js @@ -35,7 +35,6 @@ const REAL_YIELD_ENS = "0x18ea937aba6053bc232d9ae2c42abe7a8a2be440"; const REAL_YIELD_BTC = "0x0274a704a6d9129f90a62ddc6f6024b33ecdad36"; const FRAXIMAL = "0xdbe19d1c3f21b1bb250ca7bdae0687a97b5f77e6"; - const cellarsV2 = [ { id: DEFI_STARS, startBlock: 17181497 }, { id: REAL_YIELD_USD, startBlock: 16431804 }, @@ -51,7 +50,12 @@ const cellarsV2 = [ // v2.5 Cellars const TURBO_SWETH = "0xd33dad974b938744dac81fe00ac67cb5aa13958e"; -const cellarsV2p5 = [{ id: TURBO_SWETH, startBlock: 17910374 }]; +const TURBO_GHO = "0x0c190ded9be5f512bd72827bdad4003e9cc7975c"; + +const cellarsV2p5 = [ + { id: TURBO_SWETH, startBlock: 17910374 }, + { id: TURBO_GHO, startBlock: 999999999 }, // TODO: UPDATE +]; async function tvl(timestamp, block, chainBlocks, { api }) { const balances = {}; From 2829cfbfbb88002011f2621c9ea590bd3e42e979 Mon Sep 17 00:00:00 2001 From: Phil Date: Tue, 12 Sep 2023 16:23:50 -0600 Subject: [PATCH 03/20] Update start block --- projects/sommelier/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/sommelier/index.js b/projects/sommelier/index.js index e1e668f8b24f..7149e0e361c9 100644 --- a/projects/sommelier/index.js +++ b/projects/sommelier/index.js @@ -54,7 +54,7 @@ const TURBO_GHO = "0x0c190ded9be5f512bd72827bdad4003e9cc7975c"; const cellarsV2p5 = [ { id: TURBO_SWETH, startBlock: 17910374 }, - { id: TURBO_GHO, startBlock: 999999999 }, // TODO: UPDATE + { id: TURBO_GHO, startBlock: 18118614 }, ]; async function tvl(timestamp, block, chainBlocks, { api }) { From 5788deaa1ef30c357557ed276e145d404a673c76 Mon Sep 17 00:00:00 2001 From: Phil Date: Thu, 14 Sep 2023 11:52:07 -0600 Subject: [PATCH 04/20] Sommelier: Dedupe vaults taking position in ssister vaults from TVL --- projects/sommelier/cellar-constants.js | 60 ++++++++++++++++++++++++++ projects/sommelier/index.js | 55 +---------------------- projects/sommelier/v2.js | 50 ++++++++++++++++++++- 3 files changed, 110 insertions(+), 55 deletions(-) create mode 100644 projects/sommelier/cellar-constants.js diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js new file mode 100644 index 000000000000..59c79358e11e --- /dev/null +++ b/projects/sommelier/cellar-constants.js @@ -0,0 +1,60 @@ +// v0.8.15 Cellars (Cellar 1.0) +const CELLAR_AAVE = "0x7bad5df5e11151dc5ee1a648800057c5c934c0d5"; +const cellarsV0815 = [{ id: CELLAR_AAVE, startBlock: 15057867 }]; + +// v0.8.16 Cellars (Cellar 1.5) +const ETH_BTC_TREND = "0x6b7f87279982d919bbf85182ddeab179b366d8f2"; +const ETH_BTC_MOM = "0x6e2dac3b9e9adc0cbbae2d0b9fd81952a8d33872"; +const STEADY_ETH = "0x3f07a84ecdf494310d397d24c1c78b041d2fa622"; +const STEADY_BTC = "0x4986fd36b6b16f49b43282ee2e24c5cf90ed166d"; +const STEADY_UNI = "0x6f069f711281618467dae7873541ecc082761b33"; +const STEADY_MATIC = "0x05641a27c82799aaf22b436f20a3110410f29652"; +const cellarsV0816 = [ + { id: ETH_BTC_TREND, startBlock: 15733768 }, + { id: ETH_BTC_MOM, startBlock: 15733768 }, + { id: STEADY_ETH, startBlock: 15991609 }, + { id: STEADY_BTC, startBlock: 15991609 }, + { id: STEADY_UNI, startBlock: 16192732 }, + { id: STEADY_MATIC, startBlock: 16192732 }, +]; + +// v2 Cellars +const DEFI_STARS = "0x03df2a53cbed19b824347d6a45d09016c2d1676a"; +const REAL_YIELD_USD = "0x97e6e0a40a3d02f12d1cec30ebfbae04e37c119e"; +const REAL_YIELD_ETH = "0xb5b29320d2dde5ba5bafa1ebcd270052070483ec"; +const REAL_YIELD_LINK = "0x4068bdd217a45f8f668ef19f1e3a1f043e4c4934"; +const REAL_YIELD_1INCH = "0xc7b69e15d86c5c1581dacce3cacaf5b68cd6596f"; +const REAL_YIELD_UNI = "0x6a6af5393dc23d7e3db28d28ef422db7c40932b6"; +const REAL_YIELD_SNX = "0xcbf2250f33c4161e18d4a2fa47464520af5216b5"; +const REAL_YIELD_ENS = "0x18ea937aba6053bc232d9ae2c42abe7a8a2be440"; +const REAL_YIELD_BTC = "0x0274a704a6d9129f90a62ddc6f6024b33ecdad36"; +const FRAXIMAL = "0xdbe19d1c3f21b1bb250ca7bdae0687a97b5f77e6"; + +const cellarsV2 = [ + { id: DEFI_STARS, startBlock: 17181497 }, + { id: REAL_YIELD_USD, startBlock: 16431804 }, + { id: REAL_YIELD_ETH, startBlock: 16986127 }, + { id: REAL_YIELD_LINK, startBlock: 17377190 }, + { id: REAL_YIELD_1INCH, startBlock: 17377190 }, + { id: REAL_YIELD_UNI, startBlock: 17377190 }, + { id: REAL_YIELD_SNX, startBlock: 17377190 }, + { id: REAL_YIELD_ENS, startBlock: 17377190 }, + { id: REAL_YIELD_BTC, startBlock: 17667535 }, + { id: FRAXIMAL, startBlock: 17589948 }, +]; + +// v2.5 Cellars +const TURBO_SWETH = "0xd33dad974b938744dac81fe00ac67cb5aa13958e"; +const TURBO_GHO = "0x0c190ded9be5f512bd72827bdad4003e9cc7975c"; + +const cellarsV2p5 = [ + { id: TURBO_SWETH, startBlock: 17910374 }, + { id: TURBO_GHO, startBlock: 18118614 }, +]; + +module.exports = { + cellarsV0815, + cellarsV0816, + cellarsV2, + cellarsV2p5 +} \ No newline at end of file diff --git a/projects/sommelier/index.js b/projects/sommelier/index.js index 7149e0e361c9..671470898dde 100644 --- a/projects/sommelier/index.js +++ b/projects/sommelier/index.js @@ -2,60 +2,7 @@ const v0815 = require("./v0-8-15"); const v0816 = require("./v0-8-16"); const v2 = require("./v2"); const chain = "ethereum"; - -// v0.8.15 Cellars (Cellar 1.0) -const CELLAR_AAVE = "0x7bad5df5e11151dc5ee1a648800057c5c934c0d5"; -const cellarsV0815 = [{ id: CELLAR_AAVE, startBlock: 15057867 }]; - -// v0.8.16 Cellars (Cellar 1.5) -const ETH_BTC_TREND = "0x6b7f87279982d919bbf85182ddeab179b366d8f2"; -const ETH_BTC_MOM = "0x6e2dac3b9e9adc0cbbae2d0b9fd81952a8d33872"; -const STEADY_ETH = "0x3f07a84ecdf494310d397d24c1c78b041d2fa622"; -const STEADY_BTC = "0x4986fd36b6b16f49b43282ee2e24c5cf90ed166d"; -const STEADY_UNI = "0x6f069f711281618467dae7873541ecc082761b33"; -const STEADY_MATIC = "0x05641a27c82799aaf22b436f20a3110410f29652"; -const cellarsV0816 = [ - { id: ETH_BTC_TREND, startBlock: 15733768 }, - { id: ETH_BTC_MOM, startBlock: 15733768 }, - { id: STEADY_ETH, startBlock: 15991609 }, - { id: STEADY_BTC, startBlock: 15991609 }, - { id: STEADY_UNI, startBlock: 16192732 }, - { id: STEADY_MATIC, startBlock: 16192732 }, -]; - -// v2 Cellars -const DEFI_STARS = "0x03df2a53cbed19b824347d6a45d09016c2d1676a"; -const REAL_YIELD_USD = "0x97e6e0a40a3d02f12d1cec30ebfbae04e37c119e"; -const REAL_YIELD_ETH = "0xb5b29320d2dde5ba5bafa1ebcd270052070483ec"; -const REAL_YIELD_LINK = "0x4068bdd217a45f8f668ef19f1e3a1f043e4c4934"; -const REAL_YIELD_1INCH = "0xc7b69e15d86c5c1581dacce3cacaf5b68cd6596f"; -const REAL_YIELD_UNI = "0x6a6af5393dc23d7e3db28d28ef422db7c40932b6"; -const REAL_YIELD_SNX = "0xcbf2250f33c4161e18d4a2fa47464520af5216b5"; -const REAL_YIELD_ENS = "0x18ea937aba6053bc232d9ae2c42abe7a8a2be440"; -const REAL_YIELD_BTC = "0x0274a704a6d9129f90a62ddc6f6024b33ecdad36"; -const FRAXIMAL = "0xdbe19d1c3f21b1bb250ca7bdae0687a97b5f77e6"; - -const cellarsV2 = [ - { id: DEFI_STARS, startBlock: 17181497 }, - { id: REAL_YIELD_USD, startBlock: 16431804 }, - { id: REAL_YIELD_ETH, startBlock: 16986127 }, - { id: REAL_YIELD_LINK, startBlock: 17377190 }, - { id: REAL_YIELD_1INCH, startBlock: 17377190 }, - { id: REAL_YIELD_UNI, startBlock: 17377190 }, - { id: REAL_YIELD_SNX, startBlock: 17377190 }, - { id: REAL_YIELD_ENS, startBlock: 17377190 }, - { id: REAL_YIELD_BTC, startBlock: 17667535 }, - { id: FRAXIMAL, startBlock: 17589948 }, -]; - -// v2.5 Cellars -const TURBO_SWETH = "0xd33dad974b938744dac81fe00ac67cb5aa13958e"; -const TURBO_GHO = "0x0c190ded9be5f512bd72827bdad4003e9cc7975c"; - -const cellarsV2p5 = [ - { id: TURBO_SWETH, startBlock: 17910374 }, - { id: TURBO_GHO, startBlock: 18118614 }, -]; +const { cellarsV0815, cellarsV0816, cellarsV2, cellarsV2p5 } = require("./cellar-constants"); async function tvl(timestamp, block, chainBlocks, { api }) { const balances = {}; diff --git a/projects/sommelier/v2.js b/projects/sommelier/v2.js index 378edee614de..a712e2d44051 100644 --- a/projects/sommelier/v2.js +++ b/projects/sommelier/v2.js @@ -1,9 +1,57 @@ const sdk = require("@defillama/sdk"); +const { cellarsV2, cellarsV2p5 } = require("./cellar-constants"); async function sumTvl({ balances, cellars, api }) { const assets = await api.multiCall({ abi: "address:asset", calls: cellars}) const bals = await api.multiCall({ abi: "uint256:totalAssets", calls: cellars}) - assets.forEach((a, i) => sdk.util.sumSingleBalance(balances,a,bals[i], api.chain)) + + // Dedupe any potential TVL of cellars taking positions in other cellars by looking at balanceOf for each cellar + + // Concatenate cellar owners to dedupe (only need v2+, older veriosns dont take positions in other cellars) + const owners = cellarsV2.concat(cellarsV2p5) + + const sharesToIgnore = await Promise.all( + cellars.map(async (target) => { + // Iterate over all owners and sum up their shares for each cellar (target) + const shares = await sdk.api.abi.multiCall({ + calls: owners.map((owner) => ({ + target: target, // Base Cellar + params: owner.id, // Potential cellar holding shares in base cellar + })), + abi: "erc20:balanceOf", + }); + + // Sum up all shares for each cellar (target) + const totalShares = shares.output.reduce((sum, share) => sum + Number(share.output), 0); + + return totalShares; + }) + ); + + // Create a new map of total shares by using totalSupply + let totalShares = await sdk.api.abi.multiCall({ + calls: cellars.map((cellar) => ({ + target: cellar, // Base Cellar + })), + abi: "uint256:totalSupply", + }); + // Clean up to be list of outputs + totalShares = totalShares.output.map((share) => share.output); + + // Create a ratio of 1-(sharesToIgnore/totalShares) to multiply by the totalAssets + const ratios = totalShares.map((share, i) => { + const ratio = 1 - sharesToIgnore[i] / share; + return ratio; + }); + + assets.forEach((a, i) => + sdk.util.sumSingleBalance( + balances, + a, + bals[i] * ratios[i], + api.chain + ) + ); return balances } From 7eb973978167b0bb5b3ccde0229133a5ac1acacb Mon Sep 17 00:00:00 2001 From: Phil Date: Mon, 18 Sep 2023 14:42:48 -0600 Subject: [PATCH 05/20] Add ETH Growth vault --- projects/sommelier/cellar-constants.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index 59c79358e11e..031845174fbd 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -46,10 +46,12 @@ const cellarsV2 = [ // v2.5 Cellars const TURBO_SWETH = "0xd33dad974b938744dac81fe00ac67cb5aa13958e"; const TURBO_GHO = "0x0c190ded9be5f512bd72827bdad4003e9cc7975c"; +const ETH_GROWTH = "0x6c51041a91c91c86f3f08a72cb4d3f67f1208897"; const cellarsV2p5 = [ { id: TURBO_SWETH, startBlock: 17910374 }, { id: TURBO_GHO, startBlock: 18118614 }, + { id: ETH_GROWTH, startBlock: 18144591 }, ]; module.exports = { From fe1b37b0c27d4122250ccab7096c7be7d04d5a02 Mon Sep 17 00:00:00 2001 From: Phil Date: Thu, 12 Oct 2023 14:10:27 -0600 Subject: [PATCH 06/20] Add turbo steth cellar --- projects/sommelier/cellar-constants.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index 031845174fbd..8843998e3a44 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -47,11 +47,13 @@ const cellarsV2 = [ const TURBO_SWETH = "0xd33dad974b938744dac81fe00ac67cb5aa13958e"; const TURBO_GHO = "0x0c190ded9be5f512bd72827bdad4003e9cc7975c"; const ETH_GROWTH = "0x6c51041a91c91c86f3f08a72cb4d3f67f1208897"; +const TURBO_STETH = "0xfd6db5011b171b05e1ea3b92f9eacaeeb055e971"; const cellarsV2p5 = [ { id: TURBO_SWETH, startBlock: 17910374 }, { id: TURBO_GHO, startBlock: 18118614 }, { id: ETH_GROWTH, startBlock: 18144591 }, + { id: TURBO_STETH, startBlock: 18330620 }, ]; module.exports = { From a23f6c646aacef9bf3bd8e151fd80e9dcc03526d Mon Sep 17 00:00:00 2001 From: Phil Date: Wed, 8 Nov 2023 13:45:38 -0700 Subject: [PATCH 07/20] Add Turbo SOMM --- projects/sommelier/cellar-constants.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index 8843998e3a44..9348e9d6b463 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -48,12 +48,14 @@ const TURBO_SWETH = "0xd33dad974b938744dac81fe00ac67cb5aa13958e"; const TURBO_GHO = "0x0c190ded9be5f512bd72827bdad4003e9cc7975c"; const ETH_GROWTH = "0x6c51041a91c91c86f3f08a72cb4d3f67f1208897"; const TURBO_STETH = "0xfd6db5011b171b05e1ea3b92f9eacaeeb055e971"; +const TURBO_SOMM = "0x5195222f69c5821f8095ec565e71e18ab6a2298f"; const cellarsV2p5 = [ { id: TURBO_SWETH, startBlock: 17910374 }, { id: TURBO_GHO, startBlock: 18118614 }, { id: ETH_GROWTH, startBlock: 18144591 }, { id: TURBO_STETH, startBlock: 18330620 }, + { id: TURBO_SOMM, startBlock: 18516369 }, ]; module.exports = { From 66dc48a4ec64c071744cfabaef8ec62048b9aa5f Mon Sep 17 00:00:00 2001 From: Phil Date: Wed, 22 Nov 2023 14:09:24 -0700 Subject: [PATCH 08/20] Add Turbo eETH vault --- projects/sommelier/cellar-constants.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index 9348e9d6b463..1b8b364d5bc1 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -49,6 +49,7 @@ const TURBO_GHO = "0x0c190ded9be5f512bd72827bdad4003e9cc7975c"; const ETH_GROWTH = "0x6c51041a91c91c86f3f08a72cb4d3f67f1208897"; const TURBO_STETH = "0xfd6db5011b171b05e1ea3b92f9eacaeeb055e971"; const TURBO_SOMM = "0x5195222f69c5821f8095ec565e71e18ab6a2298f"; +const TURBO_EETH = "0x9a7b4980C6F0FCaa50CD5f288Ad7038f434c692e"; const cellarsV2p5 = [ { id: TURBO_SWETH, startBlock: 17910374 }, @@ -56,6 +57,7 @@ const cellarsV2p5 = [ { id: ETH_GROWTH, startBlock: 18144591 }, { id: TURBO_STETH, startBlock: 18330620 }, { id: TURBO_SOMM, startBlock: 18516369 }, + { id: TURBO_EETH, startBlock: 18622910 }, ]; module.exports = { From aced7bb3ef3a7041bae6715aea78229604f07d60 Mon Sep 17 00:00:00 2001 From: Phil Date: Wed, 6 Dec 2023 13:30:06 -0700 Subject: [PATCH 09/20] Add new somm cellar --- projects/sommelier/cellar-constants.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index 1b8b364d5bc1..da306466e0ce 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -50,6 +50,7 @@ const ETH_GROWTH = "0x6c51041a91c91c86f3f08a72cb4d3f67f1208897"; const TURBO_STETH = "0xfd6db5011b171b05e1ea3b92f9eacaeeb055e971"; const TURBO_SOMM = "0x5195222f69c5821f8095ec565e71e18ab6a2298f"; const TURBO_EETH = "0x9a7b4980C6F0FCaa50CD5f288Ad7038f434c692e"; +const TURBO_STETH_STETH_DEPOSIT = "0xc7372Ab5dd315606dB799246E8aA112405abAeFf"; const cellarsV2p5 = [ { id: TURBO_SWETH, startBlock: 17910374 }, @@ -58,6 +59,7 @@ const cellarsV2p5 = [ { id: TURBO_STETH, startBlock: 18330620 }, { id: TURBO_SOMM, startBlock: 18516369 }, { id: TURBO_EETH, startBlock: 18622910 }, + { id: TURBO_STETH_STETH_DEPOSIT, startBlock: 18717675 }, ]; module.exports = { From b4f110d12f8fd39d401dc4d9e4120e2cea64d14b Mon Sep 17 00:00:00 2001 From: Phil Date: Mon, 29 Jan 2024 15:21:01 -0700 Subject: [PATCH 10/20] Sommelier: Add Morpho Maximizer --- projects/sommelier/cellar-constants.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index da306466e0ce..6aaf840df028 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -51,6 +51,7 @@ const TURBO_STETH = "0xfd6db5011b171b05e1ea3b92f9eacaeeb055e971"; const TURBO_SOMM = "0x5195222f69c5821f8095ec565e71e18ab6a2298f"; const TURBO_EETH = "0x9a7b4980C6F0FCaa50CD5f288Ad7038f434c692e"; const TURBO_STETH_STETH_DEPOSIT = "0xc7372Ab5dd315606dB799246E8aA112405abAeFf"; +const MORPHO_MAXIMIZER = "0xcf4b531b4cde95bd35d71926e09b2b54c564f5b6"; const cellarsV2p5 = [ { id: TURBO_SWETH, startBlock: 17910374 }, @@ -60,6 +61,7 @@ const cellarsV2p5 = [ { id: TURBO_SOMM, startBlock: 18516369 }, { id: TURBO_EETH, startBlock: 18622910 }, { id: TURBO_STETH_STETH_DEPOSIT, startBlock: 18717675 }, + { id: MORPHO_MAXIMIZER, startBlock: 19103256 }, ]; module.exports = { From fb56a7af71e05a493a32b6714e61c7bdcd88d146 Mon Sep 17 00:00:00 2001 From: Phil Date: Thu, 1 Feb 2024 11:42:21 -0700 Subject: [PATCH 11/20] Add turbo diveth and turbo ethx vaults --- projects/sommelier/cellar-constants.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index 6aaf840df028..8575cfc63cd9 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -52,6 +52,8 @@ const TURBO_SOMM = "0x5195222f69c5821f8095ec565e71e18ab6a2298f"; const TURBO_EETH = "0x9a7b4980C6F0FCaa50CD5f288Ad7038f434c692e"; const TURBO_STETH_STETH_DEPOSIT = "0xc7372Ab5dd315606dB799246E8aA112405abAeFf"; const MORPHO_MAXIMIZER = "0xcf4b531b4cde95bd35d71926e09b2b54c564f5b6"; +const TURBO_DIVETH = "0x6c1edce139291Af5b84fB1e496c9747F83E876c9"; +const TURBO_ETHX = "0x19B8D8FC682fC56FbB42653F68c7d48Dd3fe597E"; const cellarsV2p5 = [ { id: TURBO_SWETH, startBlock: 17910374 }, @@ -62,6 +64,8 @@ const cellarsV2p5 = [ { id: TURBO_EETH, startBlock: 18622910 }, { id: TURBO_STETH_STETH_DEPOSIT, startBlock: 18717675 }, { id: MORPHO_MAXIMIZER, startBlock: 19103256 }, + { id: TURBO_DIVETH, startBlock: 19117472 }, + { id: TURBO_ETHX, startBlock: 19117547 }, ]; module.exports = { From 5642bf3cf44c08775bf7088254076058bbf25c70 Mon Sep 17 00:00:00 2001 From: Phil Date: Thu, 8 Feb 2024 14:34:22 -0700 Subject: [PATCH 12/20] Sommelier: Add Turbo eETH V2 --- projects/sommelier/cellar-constants.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index 8575cfc63cd9..e51492f68fec 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -54,6 +54,7 @@ const TURBO_STETH_STETH_DEPOSIT = "0xc7372Ab5dd315606dB799246E8aA112405abAeFf"; const MORPHO_MAXIMIZER = "0xcf4b531b4cde95bd35d71926e09b2b54c564f5b6"; const TURBO_DIVETH = "0x6c1edce139291Af5b84fB1e496c9747F83E876c9"; const TURBO_ETHX = "0x19B8D8FC682fC56FbB42653F68c7d48Dd3fe597E"; +const TURBO_EETH_V2 = "0xdAdC82e26b3739750E036dFd9dEfd3eD459b877A"; const cellarsV2p5 = [ { id: TURBO_SWETH, startBlock: 17910374 }, @@ -66,6 +67,7 @@ const cellarsV2p5 = [ { id: MORPHO_MAXIMIZER, startBlock: 19103256 }, { id: TURBO_DIVETH, startBlock: 19117472 }, { id: TURBO_ETHX, startBlock: 19117547 }, + { id: TURBO_EETH_V2, startBlock: 19163705 }, ]; module.exports = { From 303db4dbeee834f9feb483256067a0446042e537 Mon Sep 17 00:00:00 2001 From: Phil Date: Thu, 8 Feb 2024 14:36:17 -0700 Subject: [PATCH 13/20] Sommelier: Add Turbo eETH V2 vault --- projects/sommelier/cellar-constants.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index 8575cfc63cd9..e51492f68fec 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -54,6 +54,7 @@ const TURBO_STETH_STETH_DEPOSIT = "0xc7372Ab5dd315606dB799246E8aA112405abAeFf"; const MORPHO_MAXIMIZER = "0xcf4b531b4cde95bd35d71926e09b2b54c564f5b6"; const TURBO_DIVETH = "0x6c1edce139291Af5b84fB1e496c9747F83E876c9"; const TURBO_ETHX = "0x19B8D8FC682fC56FbB42653F68c7d48Dd3fe597E"; +const TURBO_EETH_V2 = "0xdAdC82e26b3739750E036dFd9dEfd3eD459b877A"; const cellarsV2p5 = [ { id: TURBO_SWETH, startBlock: 17910374 }, @@ -66,6 +67,7 @@ const cellarsV2p5 = [ { id: MORPHO_MAXIMIZER, startBlock: 19103256 }, { id: TURBO_DIVETH, startBlock: 19117472 }, { id: TURBO_ETHX, startBlock: 19117547 }, + { id: TURBO_EETH_V2, startBlock: 19163705 }, ]; module.exports = { From 4fd79570c83dfc3f3db6289caa910cfa3f9b020d Mon Sep 17 00:00:00 2001 From: Phil Date: Fri, 16 Feb 2024 10:52:36 -0700 Subject: [PATCH 14/20] Sommelier: Arbitrum vaults --- projects/sommelier/cellar-constants.js | 16 +++++++++----- projects/sommelier/index.js | 30 ++++++++++++++++++++++---- projects/sommelier/v2.js | 8 ++----- 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index e51492f68fec..43a343fbfeee 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -70,9 +70,15 @@ const cellarsV2p5 = [ { id: TURBO_EETH_V2, startBlock: 19163705 }, ]; +// v2.5 Cellars on Arbitrum +const REAL_YIELD_ETH_ARB = "0xC47bB288178Ea40bF520a91826a3DEE9e0DbFA4C"; + +const arbitrumCellarsV2p5 = [{ id: REAL_YIELD_ETH_ARB, startBlock: 178830458 }]; + module.exports = { - cellarsV0815, - cellarsV0816, - cellarsV2, - cellarsV2p5 -} \ No newline at end of file + cellarsV0815, + cellarsV0816, + cellarsV2, + cellarsV2p5, + arbitrumCellarsV2p5, +}; diff --git a/projects/sommelier/index.js b/projects/sommelier/index.js index 6e70c7599d51..ccd6eeabd7e8 100644 --- a/projects/sommelier/index.js +++ b/projects/sommelier/index.js @@ -1,11 +1,16 @@ const v0815 = require("./v0-8-15"); const v0816 = require("./v0-8-16"); const v2 = require("./v2"); -const chain = "ethereum"; -const { cellarsV0815, cellarsV0816, cellarsV2, cellarsV2p5 } = require("./cellar-constants"); +const { + cellarsV0815, + cellarsV0816, + cellarsV2, + cellarsV2p5, + arbitrumCellarsV2p5, +} = require("./cellar-constants"); -async function tvl(timestamp, block, chainBlocks, { api }) { +async function ethereum_tvl(timestamp, block, chainBlocks, { api }) { const balances = {}; const baseOptions = { balances, chainBlocks }; @@ -25,6 +30,7 @@ async function tvl(timestamp, block, chainBlocks, { api }) { ...baseOptions, api, cellars: filterActiveCellars(cellarsV2, block), + ownersToDedupe: cellarsV2.concat(cellarsV2p5), }); // no change in sumTvl implementation from v2 to v2.5 @@ -32,6 +38,21 @@ async function tvl(timestamp, block, chainBlocks, { api }) { ...baseOptions, api, cellars: filterActiveCellars(cellarsV2p5, block), + ownersToDedupe: cellarsV2.concat(cellarsV2p5), + }); + + return balances; +} + +async function arbitrum_tvl(timestamp, block, chainBlocks, { api }) { + const balances = {}; + const baseOptions = { balances, chainBlocks }; + + await v2.sumTvl({ + ...baseOptions, + api, + cellars: arbitrumCellarsV2p5.map((cellar) => cellar.id), + ownersToDedupe: arbitrumCellarsV2p5, }); return balances; @@ -50,7 +71,8 @@ module.exports = { methodology: "TVL is calculated as the sum of deposits invested into the strategy, deposits waiting to be invested, and yield waiting to be reinvested or redistributed across all Cellars.", start: 1656652494, - [chain]: { tvl }, + ["ethereum"]: { tvl: ethereum_tvl }, + ["arbitrum"]: { tvl: arbitrum_tvl }, hallmarks: [ [1658419200, "aave2 Cellar Launch"], [1674671068, "Real Yield USD Cellar Launch"], diff --git a/projects/sommelier/v2.js b/projects/sommelier/v2.js index a712e2d44051..5af34ebc4a47 100644 --- a/projects/sommelier/v2.js +++ b/projects/sommelier/v2.js @@ -1,20 +1,16 @@ const sdk = require("@defillama/sdk"); -const { cellarsV2, cellarsV2p5 } = require("./cellar-constants"); -async function sumTvl({ balances, cellars, api }) { +async function sumTvl({ balances, cellars, api, ownersToDedupe }) { const assets = await api.multiCall({ abi: "address:asset", calls: cellars}) const bals = await api.multiCall({ abi: "uint256:totalAssets", calls: cellars}) // Dedupe any potential TVL of cellars taking positions in other cellars by looking at balanceOf for each cellar - // Concatenate cellar owners to dedupe (only need v2+, older veriosns dont take positions in other cellars) - const owners = cellarsV2.concat(cellarsV2p5) - const sharesToIgnore = await Promise.all( cellars.map(async (target) => { // Iterate over all owners and sum up their shares for each cellar (target) const shares = await sdk.api.abi.multiCall({ - calls: owners.map((owner) => ({ + calls: ownersToDedupe.map((owner) => ({ target: target, // Base Cellar params: owner.id, // Potential cellar holding shares in base cellar })), From 346b881268cd40a6ab0bcaf7234d2858595d3b6d Mon Sep 17 00:00:00 2001 From: Phil Date: Fri, 16 Feb 2024 11:41:24 -0700 Subject: [PATCH 15/20] Fix Arbitrum TVL cals --- projects/sommelier/v2.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/projects/sommelier/v2.js b/projects/sommelier/v2.js index 5af34ebc4a47..f0368fb1c0e8 100644 --- a/projects/sommelier/v2.js +++ b/projects/sommelier/v2.js @@ -1,38 +1,47 @@ const sdk = require("@defillama/sdk"); async function sumTvl({ balances, cellars, api, ownersToDedupe }) { - const assets = await api.multiCall({ abi: "address:asset", calls: cellars}) - const bals = await api.multiCall({ abi: "uint256:totalAssets", calls: cellars}) + const assets = await api.multiCall({ + abi: "address:asset", + calls: cellars, + }); + const bals = await api.multiCall({ + abi: "uint256:totalAssets", + calls: cellars, + }); // Dedupe any potential TVL of cellars taking positions in other cellars by looking at balanceOf for each cellar const sharesToIgnore = await Promise.all( cellars.map(async (target) => { // Iterate over all owners and sum up their shares for each cellar (target) - const shares = await sdk.api.abi.multiCall({ + const shares = await api.multiCall({ calls: ownersToDedupe.map((owner) => ({ target: target, // Base Cellar - params: owner.id, // Potential cellar holding shares in base cellar + params: [owner.id], // Potential cellar holding shares in base cellar })), abi: "erc20:balanceOf", }); // Sum up all shares for each cellar (target) - const totalShares = shares.output.reduce((sum, share) => sum + Number(share.output), 0); + const totalShares = shares.reduce( + (sum, share) => sum + Number(share), + 0 + ); return totalShares; }) ); // Create a new map of total shares by using totalSupply - let totalShares = await sdk.api.abi.multiCall({ + let totalShares = await api.multiCall({ calls: cellars.map((cellar) => ({ target: cellar, // Base Cellar })), abi: "uint256:totalSupply", }); // Clean up to be list of outputs - totalShares = totalShares.output.map((share) => share.output); + totalShares = totalShares.map((share) => share); // Create a ratio of 1-(sharesToIgnore/totalShares) to multiply by the totalAssets const ratios = totalShares.map((share, i) => { From ebdc5370a1bd7f91177ff402d3838288cbc7e282 Mon Sep 17 00:00:00 2001 From: henrio123 Date: Tue, 20 Feb 2024 22:25:17 +0200 Subject: [PATCH 16/20] RYUSD-ARB --- projects/sommelier/cellar-constants.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index 43a343fbfeee..cf684756e2a5 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -72,8 +72,13 @@ const cellarsV2p5 = [ // v2.5 Cellars on Arbitrum const REAL_YIELD_ETH_ARB = "0xC47bB288178Ea40bF520a91826a3DEE9e0DbFA4C"; +const REAL_YIELD_USD_ARB = "0x392B1E6905bb8449d26af701Cdea6Ff47bF6e5A8"; + +const arbitrumCellarsV2p5 = [ + { id: REAL_YIELD_ETH_ARB, startBlock: 178830458 }, + { id: REAL_YIELD_USD_ARB, startBlock: 178141655 }]; + -const arbitrumCellarsV2p5 = [{ id: REAL_YIELD_ETH_ARB, startBlock: 178830458 }]; module.exports = { cellarsV0815, From 889eb31892756539258c5594494d0d2ac45f9283 Mon Sep 17 00:00:00 2001 From: henrio123 Date: Mon, 11 Mar 2024 09:40:13 +0200 Subject: [PATCH 17/20] Turbo-RSETH --- projects/sommelier/cellar-constants.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index cf684756e2a5..5c662d52455e 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -55,6 +55,7 @@ const MORPHO_MAXIMIZER = "0xcf4b531b4cde95bd35d71926e09b2b54c564f5b6"; const TURBO_DIVETH = "0x6c1edce139291Af5b84fB1e496c9747F83E876c9"; const TURBO_ETHX = "0x19B8D8FC682fC56FbB42653F68c7d48Dd3fe597E"; const TURBO_EETH_V2 = "0xdAdC82e26b3739750E036dFd9dEfd3eD459b877A"; +const TURBO_RSETH = "0x1dffb366b5c5A37A12af2C127F31e8e0ED86BDbe"; const cellarsV2p5 = [ { id: TURBO_SWETH, startBlock: 17910374 }, @@ -68,6 +69,7 @@ const cellarsV2p5 = [ { id: TURBO_DIVETH, startBlock: 19117472 }, { id: TURBO_ETHX, startBlock: 19117547 }, { id: TURBO_EETH_V2, startBlock: 19163705 }, + { id: TURBO_RSETH, startBlock: 19338456 }, ]; // v2.5 Cellars on Arbitrum From bf60ec37e6819d5066b3087bd90ec32ca2c63062 Mon Sep 17 00:00:00 2001 From: henrio123 Date: Tue, 12 Mar 2024 14:42:52 +0200 Subject: [PATCH 18/20] Turbo-ezETH --- projects/sommelier/cellar-constants.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index 5c662d52455e..59505a4f0504 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -56,6 +56,7 @@ const TURBO_DIVETH = "0x6c1edce139291Af5b84fB1e496c9747F83E876c9"; const TURBO_ETHX = "0x19B8D8FC682fC56FbB42653F68c7d48Dd3fe597E"; const TURBO_EETH_V2 = "0xdAdC82e26b3739750E036dFd9dEfd3eD459b877A"; const TURBO_RSETH = "0x1dffb366b5c5A37A12af2C127F31e8e0ED86BDbe"; +const TURBO_EZETH = "0x27500De405a3212D57177A789E30bb88b0AdbeC5"; const cellarsV2p5 = [ { id: TURBO_SWETH, startBlock: 17910374 }, @@ -70,6 +71,7 @@ const cellarsV2p5 = [ { id: TURBO_ETHX, startBlock: 19117547 }, { id: TURBO_EETH_V2, startBlock: 19163705 }, { id: TURBO_RSETH, startBlock: 19338456 }, + { id: TURBO_EZETH, startBlock: 19260727 }, ]; // v2.5 Cellars on Arbitrum @@ -89,3 +91,4 @@ module.exports = { cellarsV2p5, arbitrumCellarsV2p5, }; + From 6f1a52653893e5f631baed57cc8055e0fb085d63 Mon Sep 17 00:00:00 2001 From: henrio123 Date: Mon, 8 Apr 2024 20:48:40 +0300 Subject: [PATCH 19/20] RYE-Opt --- projects/sommelier/cellar-constants.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index 59505a4f0504..d6c1f7ccbd05 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -82,6 +82,12 @@ const arbitrumCellarsV2p5 = [ { id: REAL_YIELD_ETH_ARB, startBlock: 178830458 }, { id: REAL_YIELD_USD_ARB, startBlock: 178141655 }]; + // v2.5 Cellars on Optimism + const REAL_YIELD_ETH_OPT = "0xC47bB288178Ea40bF520a91826a3DEE9e0DbFA4C"; + + const optimismCellarsV2p5 = [ + { id: REAL_YIELD_ETH_OPT, startBlock: + 116609168 }]; module.exports = { @@ -90,5 +96,6 @@ module.exports = { cellarsV2, cellarsV2p5, arbitrumCellarsV2p5, + optimismCellarsV2p5, }; From 5b62a3704b7b3f983969500aad3d715f3ba7591b Mon Sep 17 00:00:00 2001 From: henrio123 Date: Mon, 8 Apr 2024 21:32:05 +0300 Subject: [PATCH 20/20] RYE-Opt --- projects/sommelier/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/projects/sommelier/index.js b/projects/sommelier/index.js index b4ea71d93543..56b874e11c55 100644 --- a/projects/sommelier/index.js +++ b/projects/sommelier/index.js @@ -7,6 +7,7 @@ const { cellarsV2, cellarsV2p5, arbitrumCellarsV2p5, + optimismCellarsV2p5, } = require("./cellar-constants"); @@ -63,7 +64,22 @@ async function arbitrum_tvl(api) { cellars: arbitrumCellarsV2p5.map((cellar) => cellar.id), ownersToDedupe: arbitrumCellarsV2p5, }); +} + +async function optimism_tvl(api) { + const balances = {}; + const { block } = api + const chainBlocks = { + [api.chain]: block + } + const baseOptions = { balances, chainBlocks }; + await v2.sumTvl({ + ...baseOptions, + api, + cellars: optimismCellarsV2p5.map((cellar) => cellar.id), + ownersToDedupe: optimismCellarsV2p5, + }); return balances; } @@ -80,6 +96,7 @@ module.exports = { start: 1656652494, ["ethereum"]: { tvl: ethereum_tvl }, ["arbitrum"]: { tvl: arbitrum_tvl }, + ["optimism"]: { tvl: optimism_tvl }, hallmarks: [ [1658419200, "aave2 Cellar Launch"], [1674671068, "Real Yield USD Cellar Launch"],