From 032f652cdc8e35f5fc29dd4442dc5e99d18ca51b Mon Sep 17 00:00:00 2001 From: Majorfi Date: Fri, 17 Nov 2023 10:56:32 +0100 Subject: [PATCH] fix: missing strategies in response --- cmd/server.go | 10 +- data/meta/strategies/1.json | 158 +++++++++--------- data/meta/tokens/1.json | 2 +- data/meta/vaults/1.json | 96 +++++------ external/vaults/prepare.vaults.go | 1 + .../route.vaults.allchains.simplified.go | 12 +- .../vaults/route.vaults.one.simplified.go | 99 +++++++++++ 7 files changed, 234 insertions(+), 144 deletions(-) create mode 100755 external/vaults/route.vaults.one.simplified.go diff --git a/cmd/server.go b/cmd/server.go index d7c7555a..41d35a9d 100755 --- a/cmd/server.go +++ b/cmd/server.go @@ -47,18 +47,18 @@ func NewRouter() *gin.Engine { { c := vaults.Controller{} // Retrieve the vaults for all chains - router.GET(`vaults`, c.GetAllVaultsForAllChainsSimplified) - router.GET(`vaults/retired`, c.GetAllRetiredVaultsForAllChainsSimplified) + router.GET(`vaults`, c.GetAllVaultsForAllChainsSimplified) // Migrated to simplified ✅ + router.GET(`vaults/retired`, c.GetAllRetiredVaultsForAllChainsSimplified) // Migrated to simplified ✅ + router.GET(`vaults/all`, c.GetAllVaultsForAllChainsSimplified) // Migrated to simplified ✅ - router.GET(`vaults/all`, c.GetAllVaultsForAllChains) router.GET(`vaults/tvl`, c.GetAllVaultsTVL) // Retrieve the vaults for a specific chainID router.GET(`:chainID/vaults/tvl`, c.GetVaultsTVL) router.GET(`:chainID/vaults/all`, c.GetAllVaults) router.GET(`:chainID/vaults/retired`, c.GetRetiredVaults) - router.GET(`:chainID/vaults/:address`, c.GetVault) - router.GET(`:chainID/vault/:address`, c.GetVault) + router.GET(`:chainID/vaults/:address`, c.GetSimplifiedVault) // Migrated to simplified ✅ + router.GET(`:chainID/vault/:address`, c.GetSimplifiedVault) // Migrated to simplified ✅ router.GET(`info/vaults/blacklisted`, c.GetBlacklistedVaults) diff --git a/data/meta/strategies/1.json b/data/meta/strategies/1.json index 3c86fb59..72ff47dc 100644 --- a/data/meta/strategies/1.json +++ b/data/meta/strategies/1.json @@ -1,9 +1,9 @@ { - "lastUpdate": "2023-11-16T10:41:36.619844+01:00", + "lastUpdate": "2023-11-17T10:53:29.303611+01:00", "version": { "major": 0, "minor": 0, - "patch": 279 + "patch": 282 }, "shouldRefresh": false, "strategies": { @@ -154,13 +154,13 @@ "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "23480919193646524367805398", + "lastTotalDebt": "23289404633652350741429114", "lastTotalLoss": "0", "lastTotalGain": "937149247187227215664196", "lastPerformanceFee": "0", "lastReport": "1700099663", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "23497452799217047872907518", + "lastEstimatedTotalAssets": "23310090808422012442213322", "isRetired": false, "displayName": "Compound Finance Flashmint Folding", "description": "Supplies and borrows {{token}} on [Compound Finance](https://app.compound.finance) simultaneously to earn COMP. Flashmints are used to mint DAI from [MakerDAO](https://oasis.app) to flashlend and fold the position, boosting the APY. Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -1005,13 +1005,13 @@ "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "246087848699423430531", + "lastTotalDebt": "282545455662648836483", "lastTotalLoss": "0", - "lastTotalGain": "1997371877237140732", + "lastTotalGain": "2546710602199423060", "lastPerformanceFee": "0", - "lastReport": "1700017391", + "lastReport": "1700151371", "lastDebtRatio": "1600", - "lastEstimatedTotalAssets": "246637187424385712859", + "lastEstimatedTotalAssets": "282545455662648836483", "isRetired": false, "displayName": "Curve Boost", "description": "Supplies {{token}} to [Curve Finance](https://curve.fi) and stakes it in gauge to collect any available tokens and earn enhanced CRV rewards thanks to [Yearn's locked CRV boost](https://docs.yearn.fi/getting-started/guides/how-boost-works). Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -1440,7 +1440,7 @@ "lastPerformanceFee": "0", "lastReport": "1688049395", "lastDebtRatio": "152", - "lastEstimatedTotalAssets": "173211654843", + "lastEstimatedTotalAssets": "173231977645", "isRetired": false, "displayName": "Flux Finance Lender Optimizer", "description": "Supplies {{token}} to [Flux Finance](https://fluxfinance.com/lend) to generate interest. Earned interest is deposited back into the strategy.", @@ -1620,7 +1620,7 @@ "lastPerformanceFee": "0", "lastReport": "1698070931", "lastDebtRatio": "5786", - "lastEstimatedTotalAssets": "33842996056070893994096", + "lastEstimatedTotalAssets": "33846566530130417933027", "isRetired": false, "displayName": "Lido Eth 2.0 Staking", "description": "Stakes {{token}} on [Lido.fi](https://stake.lido.fi) to mint stETH which accumulates ETH 2.0 staking rewards. This strategy will buy stETH off the market if it is cheaper than staking.", @@ -1779,7 +1779,7 @@ "lastPerformanceFee": "0", "lastReport": "1671640127", "lastDebtRatio": "0", - "lastEstimatedTotalAssets": "1291394842406189067875", + "lastEstimatedTotalAssets": "1291107617556819653504", "isRetired": false, "displayName": "Curve Boost", "description": "Supplies {{token}} to [Curve Finance](https://curve.fi) and stakes it in gauge to collect any available tokens and earn enhanced CRV rewards thanks to [Yearn's locked CRV boost](https://docs.yearn.fi/getting-started/guides/how-boost-works). Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -1856,7 +1856,7 @@ "lastPerformanceFee": "0", "lastReport": "1700098967", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "1002355949397798137780035", + "lastEstimatedTotalAssets": "1008696710048343632243407", "isRetired": false, "displayName": "Curve Boost", "description": "Supplies {{token}} to [Curve Finance](https://curve.fi) and stakes it in gauge to collect any available tokens and earn enhanced CRV rewards thanks to [Yearn's locked CRV boost](https://docs.yearn.fi/getting-started/guides/how-boost-works). Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -2043,7 +2043,7 @@ "lastPerformanceFee": "0", "lastReport": "1680545087", "lastDebtRatio": "0", - "lastEstimatedTotalAssets": "225294175", + "lastEstimatedTotalAssets": "225324066", "isRetired": false, "displayName": "Compound Finance Flashmint Folding", "description": "Supplies and borrows {{token}} on [Compound Finance](https://app.compound.finance) simultaneously to earn COMP. Flashmints are used to mint DAI from [MakerDAO](https://oasis.app) to flashlend and fold the position, boosting the APY. Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -2153,7 +2153,7 @@ "lastPerformanceFee": "0", "lastReport": "1699273043", "lastDebtRatio": "4000", - "lastEstimatedTotalAssets": "98093520014773630065076", + "lastEstimatedTotalAssets": "98090995471548188607106", "isRetired": false, "displayName": "Compound Lender Borrower", "description": "Supplies {{token}} on [Compound Finance](https://app.compound.finance/?market=usdc-mainnet) version 3 and borrows USDC which it also deposits to earn COMP. Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -2683,7 +2683,7 @@ "lastPerformanceFee": "0", "lastReport": "1698874223", "lastDebtRatio": "1000", - "lastEstimatedTotalAssets": "807653684", + "lastEstimatedTotalAssets": "807657929", "isRetired": false, "displayName": "Aave Optimizer", "description": "Supplies {{token}} to [AAVE](https://app.aave.com) v3 to generate interest and earn rewards. Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -2913,13 +2913,13 @@ "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "1742476891736", + "lastTotalDebt": "1524748590285", "lastTotalLoss": "0", "lastTotalGain": "14441230470", - "lastPerformanceFee": "1000", + "lastPerformanceFee": "0", "lastReport": "1699811147", "lastDebtRatio": "1000", - "lastEstimatedTotalAssets": "1743747045431", + "lastEstimatedTotalAssets": "1526261893078", "isRetired": true, "displayName": "", "description": "", @@ -2968,9 +2968,9 @@ "keepCVX": null, "lastTotalDebt": "0", "lastTotalLoss": "0", - "lastTotalGain": "8458465810161929150373584", + "lastTotalGain": "8618198412897570046777038", "lastPerformanceFee": "0", - "lastReport": "1699648571", + "lastReport": "1700188499", "lastDebtRatio": "0", "lastEstimatedTotalAssets": "0", "isRetired": true, @@ -6000,7 +6000,7 @@ "lastPerformanceFee": "0", "lastReport": "1699252115", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "206227266703465823051119", + "lastEstimatedTotalAssets": "206471793100259599914531", "isRetired": true, "displayName": "", "description": "", @@ -6287,7 +6287,7 @@ "lastPerformanceFee": "0", "lastReport": "1700074619", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "102877984036535313331812", + "lastEstimatedTotalAssets": "103448047628143849005845", "isRetired": false, "displayName": "Curve Boost", "description": "Supplies {{token}} to [Curve Finance](https://curve.fi) and stakes it in gauge to collect any available tokens and earn enhanced CRV rewards thanks to [Yearn's locked CRV boost](https://docs.yearn.fi/getting-started/guides/how-boost-works). Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -6513,13 +6513,13 @@ "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "1291961205671973010289", + "lastTotalDebt": "1483825086757874708694", "lastTotalLoss": "0", - "lastTotalGain": "3282778856864770686", + "lastTotalGain": "3791954410859345126", "lastPerformanceFee": "0", - "lastReport": "1700017367", + "lastReport": "1700163875", "lastDebtRatio": "8400", - "lastEstimatedTotalAssets": "1292470381225967584729", + "lastEstimatedTotalAssets": "1484352966698709562981", "isRetired": false, "displayName": "Convex Reinvest", "description": "Supplies {{token}} to [Convex Finance](https://www.convexfinance.com/stake) boosted by Convex's veCRV to earn CRV and CVX (and any other available tokens). Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -6567,11 +6567,11 @@ "keepCVX": null, "lastTotalDebt": "196863335761347150250054", "lastTotalLoss": "0", - "lastTotalGain": "4952080253076828786790", + "lastTotalGain": "5366379808712886572932", "lastPerformanceFee": "0", - "lastReport": "1699976231", + "lastReport": "1700171615", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "197299440556753526867045", + "lastEstimatedTotalAssets": "196863335761347150250054", "isRetired": true, "displayName": "", "description": "", @@ -6678,7 +6678,7 @@ "lastPerformanceFee": "0", "lastReport": "1630876412", "lastDebtRatio": "0", - "lastEstimatedTotalAssets": "6211496346399304121", + "lastEstimatedTotalAssets": "6284404798768386582", "isRetired": false, "displayName": "Vesper Finance Reinvest", "description": "Supplies {{token}} to [Vesper Finance](https://vesper.finance) to earn VSP. Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -7761,7 +7761,7 @@ "lastPerformanceFee": "0", "lastReport": "1699318607", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "704400689728942030787", + "lastEstimatedTotalAssets": "704496079648670168930", "isRetired": false, "displayName": "Yearn Delegate", "description": "Deposits {{token}} in a newer version [Yearn](https://yearn.fi/#/vaults) Vault. If this strategy is active it is recommended users migrate to the newer vault. Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -8262,7 +8262,7 @@ "lastPerformanceFee": "0", "lastReport": "1629866495", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "2455492320751361845255", + "lastEstimatedTotalAssets": "2455501276232747445172", "isRetired": true, "displayName": "", "description": "", @@ -8864,7 +8864,7 @@ "lastPerformanceFee": "0", "lastReport": "1635281567", "lastDebtRatio": "0", - "lastEstimatedTotalAssets": "225294175", + "lastEstimatedTotalAssets": "225324066", "isRetired": true, "displayName": "", "description": "", @@ -9072,7 +9072,7 @@ "lastPerformanceFee": "0", "lastReport": "1699524035", "lastDebtRatio": "50", - "lastEstimatedTotalAssets": "290249479363657477149", + "lastEstimatedTotalAssets": "290260185674823867982", "isRetired": false, "displayName": "Compound Finance Lender Optimizer", "description": "Supplies {{token}} to [Compound Finance](https://app.compound.finance/markets?market=1_ETH_0xA17581A9E3356d9A858b789D68B4d866e593aE94) to generate interest and earn COMP. Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -10006,13 +10006,13 @@ "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "7450005866203534899", + "lastTotalDebt": "8005951091662147895", "lastTotalLoss": "0", "lastTotalGain": "0", "lastPerformanceFee": "0", - "lastReport": "1699966319", + "lastReport": "1700180903", "lastDebtRatio": "8169", - "lastEstimatedTotalAssets": "7450005866203534899", + "lastEstimatedTotalAssets": "8005951091662147895", "isRetired": true, "displayName": "", "description": "", @@ -11609,7 +11609,7 @@ "lastPerformanceFee": "0", "lastReport": "1631550184", "lastDebtRatio": "0", - "lastEstimatedTotalAssets": "200900803", + "lastEstimatedTotalAssets": "200900988", "isRetired": false, "displayName": "Compound Finance Flashloan Folding", "description": "Supplies and borrows {{token}} on [Compound Finance](https://app.compound.finance) simultaneously to earn COMP. Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy. Flashloans are used to obtain additional {{token}} from [dYdX](https://margin.dydx.exchange/markets/overview) to boost the APY.", @@ -12263,19 +12263,19 @@ "vaultVersion": "0.4.6", "activation": 17750581, "chainID": 1, - "doHealthCheck": false, + "doHealthCheck": true, "isActive": true, "isInQueue": true, "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "0", + "lastTotalDebt": "92475168258390937636121", "lastTotalLoss": "0", "lastTotalGain": "0", "lastPerformanceFee": "0", - "lastReport": "1690052015", + "lastReport": "1700135951", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "0", + "lastEstimatedTotalAssets": "92475168258390937636121", "isRetired": false, "displayName": "Curve Boost", "description": "Supplies {{token}} to [Curve Finance](https://curve.fi) and stakes it in gauge to collect any available tokens and earn enhanced CRV rewards thanks to [Yearn's locked CRV boost](https://docs.yearn.fi/getting-started/guides/how-boost-works). Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -12791,7 +12791,7 @@ "lastPerformanceFee": "0", "lastReport": "1699575059", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "6717652650982455791472", + "lastEstimatedTotalAssets": "6717803567481662452480", "isRetired": false, "displayName": "Yearn Delegate", "description": "Deposits {{token}} in a newer version [Yearn](https://yearn.fi/#/vaults) Vault. If this strategy is active it is recommended users migrate to the newer vault. Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -13059,7 +13059,7 @@ "lastPerformanceFee": "0", "lastReport": "1700119967", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "1262633521552654837433732", + "lastEstimatedTotalAssets": "1270367245020055020230356", "isRetired": false, "displayName": "Curve Boost", "description": "Supplies {{token}} to [Curve Finance](https://curve.fi) and stakes it in gauge to collect any available tokens and earn enhanced CRV rewards thanks to [Yearn's locked CRV boost](https://docs.yearn.fi/getting-started/guides/how-boost-works). Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -13561,7 +13561,7 @@ "lastPerformanceFee": "0", "lastReport": "1699993367", "lastDebtRatio": "8848", - "lastEstimatedTotalAssets": "19570916997653", + "lastEstimatedTotalAssets": "19574984372462", "isRetired": false, "displayName": "Compound Finance Flashmint Folding", "description": "Supplies and borrows {{token}} on [Compound Finance](https://app.compound.finance) simultaneously to earn COMP. Flashmints are used to mint DAI from [MakerDAO](https://oasis.app) to flashlend and fold the position, boosting the APY. Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -13907,7 +13907,7 @@ "lastPerformanceFee": "1000", "lastReport": "1627520493", "lastDebtRatio": "9800", - "lastEstimatedTotalAssets": "398464469357332818259", + "lastEstimatedTotalAssets": "398536304565367848101", "isRetired": false, "displayName": "", "description": "", @@ -14191,13 +14191,13 @@ "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "1291394842406189067875", + "lastTotalDebt": "1290320874896538355535", "lastTotalLoss": "0", "lastTotalGain": "390243651956907461659", "lastPerformanceFee": "0", "lastReport": "1700064683", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "1291394842406189067875", + "lastEstimatedTotalAssets": "1291107617556819653504", "isRetired": false, "displayName": "Curve Boost", "description": "Supplies {{token}} to [Curve Finance](https://curve.fi) and stakes it in gauge to collect any available tokens and earn enhanced CRV rewards thanks to [Yearn's locked CRV boost](https://docs.yearn.fi/getting-started/guides/how-boost-works). Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -14332,7 +14332,7 @@ "lastPerformanceFee": "0", "lastReport": "1699451939", "lastDebtRatio": "4000", - "lastEstimatedTotalAssets": "3101815046", + "lastEstimatedTotalAssets": "3101764405", "isRetired": false, "displayName": "Compound Lender Borrower", "description": "Supplies {{token}} on [Compound Finance](https://app.compound.finance/?market=usdc-mainnet) version 3 and borrows USDC which it also deposits to earn COMP. Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -15268,7 +15268,7 @@ "lastTotalLoss": "0", "lastTotalGain": "37916195839928842774727", "lastPerformanceFee": "0", - "lastReport": "1698968315", + "lastReport": "1700179727", "lastDebtRatio": "10000", "lastEstimatedTotalAssets": "273360305158518598913765", "isRetired": false, @@ -15619,7 +15619,7 @@ "lastPerformanceFee": "0", "lastReport": "1624288571", "lastDebtRatio": "0", - "lastEstimatedTotalAssets": "134", + "lastEstimatedTotalAssets": "138", "isRetired": true, "displayName": "Aave Borrow", "description": "Supplies {{token}} to [AAVE](https://app.aave.com/home) to generate interest and earn staked AAVE tokens. Once unlocked, earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy. This strategy also borrows tokens against {{token}}. Borrowed tokens are then deposited into corresponding yVault to generate yield.", @@ -16296,13 +16296,13 @@ "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "290494614935699200628581", + "lastTotalDebt": "224223911924497910895074", "lastTotalLoss": "0", "lastTotalGain": "59936478258477021788491", "lastPerformanceFee": "0", "lastReport": "1700098967", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "290494614935699200628581", + "lastEstimatedTotalAssets": "224223911924497910895074", "isRetired": false, "displayName": "Curve Boost", "description": "Supplies {{token}} to [Curve Finance](https://curve.fi) and stakes it in gauge to collect any available tokens and earn enhanced CRV rewards thanks to [Yearn's locked CRV boost](https://docs.yearn.fi/getting-started/guides/how-boost-works). Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -16488,7 +16488,7 @@ "lastPerformanceFee": "0", "lastReport": "1643067993", "lastDebtRatio": "0", - "lastEstimatedTotalAssets": "6387", + "lastEstimatedTotalAssets": "6660", "isRetired": false, "displayName": "Maker Delegate", "description": "Stakes {{token}} in [MakerDAO](https://oasis.app/borrow) vault and mints DAI. This newly minted DAI is then deposited into the DAI yVault to generate yield.", @@ -16912,7 +16912,7 @@ "lastPerformanceFee": "0", "lastReport": "1629082281", "lastDebtRatio": "0", - "lastEstimatedTotalAssets": "1291394842406189067875", + "lastEstimatedTotalAssets": "1291107617556819653504", "isRetired": true, "displayName": "", "description": "", @@ -17871,7 +17871,7 @@ "lastPerformanceFee": "0", "lastReport": "1633059227", "lastDebtRatio": "0", - "lastEstimatedTotalAssets": "9849220158", + "lastEstimatedTotalAssets": "9849264102", "isRetired": true, "displayName": "", "description": "", @@ -18297,7 +18297,7 @@ "lastPerformanceFee": "0", "lastReport": "1654966997", "lastDebtRatio": "0", - "lastEstimatedTotalAssets": "1168791983926665726335", + "lastEstimatedTotalAssets": "1156888722313701545632", "isRetired": false, "displayName": "Aave Borrow", "description": "Supplies {{token}} to [AAVE](https://app.aave.com/home) to generate interest and earn staked AAVE tokens. Once unlocked, earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy. This strategy also borrows tokens against {{token}}. Borrowed tokens are then deposited into corresponding yVault to generate yield.", @@ -18913,7 +18913,7 @@ "lastPerformanceFee": "0", "lastReport": "1641434721", "lastDebtRatio": "0", - "lastEstimatedTotalAssets": "1460801340", + "lastEstimatedTotalAssets": "1511829083", "isRetired": true, "displayName": "", "description": "", @@ -19544,7 +19544,7 @@ "lastPerformanceFee": "0", "lastReport": "1699456979", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "9136969854315", + "lastEstimatedTotalAssets": "9138367180494", "isRetired": false, "displayName": "Aave Optimizer", "description": "Supplies {{token}} to [AAVE](https://app.aave.com) v3 to generate interest and earn rewards. Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -19593,13 +19593,13 @@ "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "1189064428951511121", + "lastTotalDebt": "1794454210898934116", "lastTotalLoss": "0", "lastTotalGain": "0", "lastPerformanceFee": "0", - "lastReport": "1699752755", + "lastReport": "1700180975", "lastDebtRatio": "1831", - "lastEstimatedTotalAssets": "1189064428951511121", + "lastEstimatedTotalAssets": "1794454210898934116", "isRetired": false, "displayName": "", "description": "", @@ -19697,13 +19697,13 @@ "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "3368558709807107854440676", + "lastTotalDebt": "3343059720425548749798140", "lastTotalLoss": "0", "lastTotalGain": "0", "lastPerformanceFee": "0", "lastReport": "1699931699", "lastDebtRatio": "6438", - "lastEstimatedTotalAssets": "3371360659668410214445889", + "lastEstimatedTotalAssets": "3345861670286851109803353", "isRetired": true, "displayName": "Convex Reinvest", "description": "Supplies {{token}} to [Convex Finance](https://www.convexfinance.com/stake) boosted by Convex's veCRV to earn CRV and CVX (and any other available tokens). Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -20779,13 +20779,13 @@ "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "33728860648237431469070", + "lastTotalDebt": "156210287897289107921", "lastTotalLoss": "0", "lastTotalGain": "1533351414628521731313", "lastPerformanceFee": "0", - "lastReport": "1698972551", + "lastReport": "1700134715", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "33728860648237431469070", + "lastEstimatedTotalAssets": "156210287897289107921", "isRetired": false, "displayName": "Curve Boost", "description": "Supplies {{token}} to [Curve Finance](https://curve.fi) and stakes it in gauge to collect any available tokens and earn enhanced CRV rewards thanks to [Yearn's locked CRV boost](https://docs.yearn.fi/getting-started/guides/how-boost-works). Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -21288,7 +21288,7 @@ "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "42368275326922175070137330", + "lastTotalDebt": "42408381656847305343697126", "lastTotalLoss": "0", "lastTotalGain": "1123305542539830424482856", "lastPerformanceFee": "0", @@ -21919,13 +21919,13 @@ "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "23821517002693504459551", + "lastTotalDebt": "23810184837817086444088", "lastTotalLoss": "0", "lastTotalGain": "515112032819202633063", "lastPerformanceFee": "0", "lastReport": "1697851379", "lastDebtRatio": "4164", - "lastEstimatedTotalAssets": "23853440962026650586082", + "lastEstimatedTotalAssets": "23843162330905419229515", "isRetired": true, "displayName": "", "description": "", @@ -22747,7 +22747,7 @@ "lastPerformanceFee": "0", "lastReport": "1700112671", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "4178639498297910304266", + "lastEstimatedTotalAssets": "4179585212097426827215", "isRetired": false, "displayName": "Curve Boost", "description": "Supplies {{token}} to [Curve Finance](https://curve.fi) and stakes it in gauge to collect any available tokens and earn enhanced CRV rewards thanks to [Yearn's locked CRV boost](https://docs.yearn.fi/getting-started/guides/how-boost-works). Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -22988,13 +22988,13 @@ "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "125531076520963589027", + "lastTotalDebt": "114209747896880676096", "lastTotalLoss": "0", "lastTotalGain": "0", "lastPerformanceFee": "0", "lastReport": "1698584987", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "125531076520963589027", + "lastEstimatedTotalAssets": "114209747896880676096", "isRetired": false, "displayName": "Curve Boost", "description": "Supplies {{token}} to [Curve Finance](https://curve.fi) and stakes it in gauge to collect any available tokens and earn enhanced CRV rewards thanks to [Yearn's locked CRV boost](https://docs.yearn.fi/getting-started/guides/how-boost-works). Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -23122,13 +23122,13 @@ "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "13235561283365915041722", + "lastTotalDebt": "13397710769180035850647", "lastTotalLoss": "0", - "lastTotalGain": "4047955614306909740114", + "lastTotalGain": "4115159163472558840543", "lastPerformanceFee": "0", - "lastReport": "1698360611", + "lastReport": "1700175023", "lastDebtRatio": "2000", - "lastEstimatedTotalAssets": "13302764832531564142151", + "lastEstimatedTotalAssets": "13397710769180035850647", "isRetired": false, "displayName": "Curve Boost", "description": "Supplies {{token}} to [Curve Finance](https://curve.fi) and stakes it in gauge to collect any available tokens and earn enhanced CRV rewards thanks to [Yearn's locked CRV boost](https://docs.yearn.fi/getting-started/guides/how-boost-works). Earned tokens are harvested, sold for more {{token}} which is deposited back into the strategy.", @@ -23924,13 +23924,13 @@ "keepCRV": null, "keepCRVPercent": null, "keepCVX": null, - "lastTotalDebt": "375422914494292917953371", + "lastTotalDebt": "341490935113062844514008", "lastTotalLoss": "0", "lastTotalGain": "28604806658809689831422", "lastPerformanceFee": "0", "lastReport": "1700047175", "lastDebtRatio": "10000", - "lastEstimatedTotalAssets": "375422914494292917953371", + "lastEstimatedTotalAssets": "341490935113062844514008", "isRetired": true, "displayName": "", "description": "", diff --git a/data/meta/tokens/1.json b/data/meta/tokens/1.json index f3af3fd7..9812ca2f 100644 --- a/data/meta/tokens/1.json +++ b/data/meta/tokens/1.json @@ -1,5 +1,5 @@ { - "lastUpdate": "2023-11-16T10:41:36.055213+01:00", + "lastUpdate": "2023-11-17T10:53:28.926903+01:00", "version": { "major": 0, "minor": 1, diff --git a/data/meta/vaults/1.json b/data/meta/vaults/1.json index 58c0a8e8..5e510281 100644 --- a/data/meta/vaults/1.json +++ b/data/meta/vaults/1.json @@ -1,9 +1,9 @@ { - "lastUpdate": "2023-11-16T10:41:21.516162+01:00", + "lastUpdate": "2023-11-17T10:53:18.351265+01:00", "version": { "major": 0, "minor": 0, - "patch": 1290 + "patch": 1293 }, "shouldRefresh": false, "vaults": { @@ -185,7 +185,7 @@ "0x11829e810afcca3e28b0c7d9e560a3f3e1294ba3", "0xccb0da3e219de478a0975599d9c362e724a6dff9" ], - "lastPricePerShare": "1189024199751777546", + "lastPricePerShare": "1189078559708431693", "lastTotalAssets": "47840643232341007562393", "isRetired": false, "isHidden": false, @@ -346,8 +346,8 @@ "lastActiveStrategies": [ "0x478085739ea884f38add4d36872acd8333b5d4d6" ], - "lastPricePerShare": "1014671760111476344", - "lastTotalAssets": "196863335761347150250054", + "lastPricePerShare": "1014816565169750011", + "lastTotalAssets": "197277635316983208036196", "isRetired": false, "isHidden": false, "migration": { @@ -659,7 +659,7 @@ "lastActiveStrategies": [ "0x2fa2e992bb5c68a8b61cbfa995431afbd0a4db11" ], - "lastPricePerShare": "1258906156075322495", + "lastPricePerShare": "1260408194807542294", "lastTotalAssets": "1711144059957161454445", "isRetired": false, "isHidden": true, @@ -1164,8 +1164,8 @@ "0xa991652b995c4fb3c87d165311bd77e139297cce", "0xb458c556ded7b59b12f3fea188b01ad06f30c7f3" ], - "lastPricePerShare": "1034242090343275930", - "lastTotalAssets": "296330263257732409973900", + "lastPricePerShare": "1043421679873663352", + "lastTotalAssets": "224223911924497910895074", "isRetired": false, "isHidden": false, "migration": { @@ -1228,8 +1228,8 @@ "lastActiveStrategies": [ "0x23724d764d8b3d26852ba20d3bc2578093d2b022" ], - "lastPricePerShare": "1387545384883843235", - "lastTotalAssets": "42368275326922175070137330", + "lastPricePerShare": "1388624431701167985", + "lastTotalAssets": "42408381656847305343697126", "isRetired": false, "isHidden": false, "migration": { @@ -2022,8 +2022,8 @@ "0x24788d1468eebb6a57ab8ab94a307f8b31bb2e81", "0x961082de19e9cf87bb4850f6f347407be89d9ebb" ], - "lastPricePerShare": "1094939761465437883", - "lastTotalAssets": "376496752616555197012730", + "lastPricePerShare": "1095598358939002948", + "lastTotalAssets": "341490935113062844514008", "isRetired": false, "isHidden": false, "migration": { @@ -2371,7 +2371,7 @@ "0xc3715e4a6eb545d8a1d82e7e5b727831c0058be6" ], "lastPricePerShare": "1051510797247707056", - "lastTotalAssets": "11262649327463808517953", + "lastTotalAssets": "11293236028130620191739", "isRetired": false, "isHidden": false, "migration": { @@ -3265,8 +3265,8 @@ "0x472f4e5533fb8f7fee97dacd3dbae9d83867ab07", "0x0a94d79e811793141a04106fa797fb6d61163102" ], - "lastPricePerShare": "1004974536786643141", - "lastTotalAssets": "1538246366440382285770", + "lastPricePerShare": "1005091268729446975", + "lastTotalAssets": "1766458436616517510350", "isRetired": false, "isHidden": false, "migration": { @@ -3517,7 +3517,7 @@ "0x3e55bf8882d7f908b4ada67055be14a0ab14622b", "0xabec96ac9cdc6863446657431dd32f73445e80b1" ], - "lastPricePerShare": "1004650700141326698", + "lastPricePerShare": "1004673270282257972", "lastTotalAssets": "10677494745876283643841", "isRetired": false, "isHidden": false, @@ -4200,8 +4200,8 @@ "0x734d102a18a3c0ae16f5ae1df62fc4373e306ad8", "0x8dcf2ff7f2ab5fc16ef51cc04d6f65f2535745a2" ], - "lastPricePerShare": "1212529321097670610", - "lastTotalAssets": "301777571113280411068534", + "lastPricePerShare": "1214037891805409254", + "lastTotalAssets": "300761400223025399984403", "isRetired": false, "isHidden": false, "migration": { @@ -4358,7 +4358,7 @@ "0xb6abbd5594b344f17af8d9a83869c3660ea9a6bd" ], "lastPricePerShare": "1108843479845848667", - "lastTotalAssets": "111720554909664094216410", + "lastTotalAssets": "111586254442947618965290", "isRetired": false, "isHidden": false, "migration": { @@ -4388,8 +4388,8 @@ "0xda64d669b3fd915f58d4cac799a57aeae0593ae7", "0x9004d433d710194a033c15041bacd134fc9ba50f" ], - "lastPricePerShare": "1044033058616413014", - "lastTotalAssets": "5230661727878992538302076", + "lastPricePerShare": "1044358050433229647", + "lastTotalAssets": "5165504767736949034989760", "isRetired": false, "isHidden": false, "migration": { @@ -4873,8 +4873,8 @@ "0xf7461f158bbc6337f63747c3a861cfbfc039022a", "0x83cb8461e0f7f27a5921f7b5f9235211eaa30d59" ], - "lastPricePerShare": "1069438711281393686", - "lastTotalAssets": "66988553845900179253237", + "lastPricePerShare": "1069549809339271212", + "lastTotalAssets": "67055757395065828353666", "isRetired": false, "isHidden": false, "migration": { @@ -5289,8 +5289,8 @@ "0x398c51c68989c5c0c193f17c387acd6a5e8e3a80", "0x9d7cd0041abd91f281e282db3fba7a9db9e4cc8b" ], - "lastPricePerShare": "1073897510484152613", - "lastTotalAssets": "1291394842406189067875", + "lastPricePerShare": "1074042937638017581", + "lastTotalAssets": "1290320874896538355535", "isRetired": false, "isHidden": false, "migration": { @@ -5354,7 +5354,7 @@ "0xd7c355c78ba2716b5d52065c3e0735badf046b8c", "0x1492011cf0523f61d02ac541c3d1958756c8a383" ], - "lastPricePerShare": "1010288282142529077", + "lastPricePerShare": "1011326955669299715", "lastTotalAssets": "1006901778724857010499735", "isRetired": false, "isHidden": false, @@ -5484,7 +5484,7 @@ "0xdbcaa49bbeeedfd63a12908956c6e3a8b07c3fba" ], "lastPricePerShare": "1065833558882898310", - "lastTotalAssets": "143271431086549524267", + "lastTotalAssets": "143703284093403498620", "isRetired": false, "isHidden": false, "migration": { @@ -6216,7 +6216,7 @@ "0x967f222172627044e7bba2329655168a17e4642c", "0xc18207dc4dbc366a8fed62e438c173c47e57f096" ], - "lastPricePerShare": "1125643209482330659", + "lastPricePerShare": "1126584276513518324", "lastTotalAssets": "275220229239982713540463", "isRetired": false, "isHidden": false, @@ -6250,7 +6250,7 @@ "0x64e4779bff8588ccdca9f290b9bc346a798f5277" ], "lastPricePerShare": "1047134654648682156", - "lastTotalAssets": "57872552290095792478465", + "lastTotalAssets": "57861220125219374463002", "isRetired": false, "isHidden": false, "migration": { @@ -6311,8 +6311,8 @@ "0x97d868b5c2937355bf89c5e5463d52016240fe86", "0x0fd45d4fb70d1ec95264da30934095443dc6af6a" ], - "lastPricePerShare": "1048095", - "lastTotalAssets": "21473987395886", + "lastPricePerShare": "1048243", + "lastTotalAssets": "21256259105349", "isRetired": false, "isHidden": false, "migration": { @@ -6372,7 +6372,7 @@ "0xf4b4464d03c1f3226c23fe58407b558489510dab", "0x9430a2501e5f2cd66741375baabb9576e8fb5f48" ], - "lastPricePerShare": "1051329559250426438", + "lastPricePerShare": "1052576134812727137", "lastTotalAssets": "1269236547492099679323471", "isRetired": false, "isHidden": false, @@ -6471,8 +6471,8 @@ "0x9e9a2a86eeff52ffd13fc724801a4259b2b1a949", "0x1e93cd1e6766e7fcb459092e160f876dda650415" ], - "lastPricePerShare": "102333861", - "lastTotalAssets": "7721683201", + "lastPricePerShare": "102333862", + "lastTotalAssets": "7678093115", "isRetired": false, "isHidden": false, "migration": { @@ -6667,7 +6667,7 @@ "0x0472d09b1eecea082245b88c22b2a52e8892b018", "0xf36c83f6bf4cf656172f6dbc1220af6785362f0f" ], - "lastPricePerShare": "1036517449385506981", + "lastPricePerShare": "1036856171077825461", "lastTotalAssets": "4182209966795845181384", "isRetired": false, "isHidden": false, @@ -6760,7 +6760,7 @@ "0xb60362fa811c576d4c220c0834ebda9bfe68888c", "0xe5b3b12b6c93b725484736628a22dbcd130574d7" ], - "lastPricePerShare": "1005127014238377364", + "lastPricePerShare": "1005191467464960688", "lastTotalAssets": "1256700132628904553185559", "isRetired": false, "isHidden": false, @@ -7211,7 +7211,7 @@ "0x8a6bd845e58edaaa7c2285701013d1b0004d98fd" ], "lastPricePerShare": "1000000000000000000", - "lastTotalAssets": "0", + "lastTotalAssets": "92475168258390937636121", "isRetired": false, "isHidden": false, "migration": { @@ -8041,7 +8041,7 @@ "0xf65b3981127c3dd59798bc54dfed0205c5e9c686" ], "lastPricePerShare": "1000000000000000000", - "lastTotalAssets": "125531076520963589027", + "lastTotalAssets": "114209747896880676096", "isRetired": false, "isHidden": false, "migration": { @@ -8769,8 +8769,8 @@ "0x3280499298ace3fd3cd9c2558e9e8746ace3e52d", "0x01d127d90513ccb6071f83efe15611c4d9890668" ], - "lastPricePerShare": "1075421238552388386", - "lastTotalAssets": "23493739998312745877772513", + "lastPricePerShare": "1075593630647922051", + "lastTotalAssets": "23337964681134053356102159", "isRetired": false, "isHidden": false, "migration": { @@ -8839,7 +8839,7 @@ "0xf06b5c192d1413e7a4db1b2a9640500fdd83f1b2" ], "lastPricePerShare": "1013228104132560108", - "lastTotalAssets": "238986926862763750979", + "lastTotalAssets": "238959613801815674331", "isRetired": false, "isHidden": false, "migration": { @@ -8903,7 +8903,7 @@ "0x9084b5a98e3b4b257affd82ae4a1753f87906dce" ], "lastPricePerShare": "1098425989399406290", - "lastTotalAssets": "6730825409083211806544", + "lastTotalAssets": "6736492537261842909401", "isRetired": false, "isHidden": true, "migration": { @@ -9155,7 +9155,7 @@ "0xc771d3fe9699a5aac0e6be661c5eee3ed1f9a285", "0xde2b8a0cba4f6996b526a4bc784532d7aeba4e33" ], - "lastPricePerShare": "1070630583729280983", + "lastPricePerShare": "1073356687015509111", "lastTotalAssets": "156221364960113662336", "isRetired": false, "isHidden": false, @@ -9311,7 +9311,7 @@ "0x337957ebbeaba34f4fc0520f1b1b54fd5fc352cf", "0xe359def55cf9e310aef759dc0ef7dbfc584f27bf" ], - "lastPricePerShare": "1123681937727385849", + "lastPricePerShare": "1124619863135749188", "lastTotalAssets": "152362608028831679132577", "isRetired": false, "isHidden": false, @@ -9731,7 +9731,7 @@ "0xe47e864e4eedc4d63703a2ab3a8a8f5e17516726" ], "lastPricePerShare": "1017969992733175935", - "lastTotalAssets": "33728860648237431469070", + "lastTotalAssets": "156210287897289107921", "isRetired": false, "isHidden": false, "migration": { @@ -9763,7 +9763,7 @@ "0xc9c5b887e984bb4914574755d12c997e4ae2d88f", "0x9bd0d6c7a1f770d513dd9b7dde45e56c8ed81002" ], - "lastPricePerShare": "1044930307805355137", + "lastPricePerShare": "1047227740603469463", "lastTotalAssets": "2159392925282837754", "isRetired": false, "isHidden": false, @@ -9828,7 +9828,7 @@ "0xd9008eae1cd4b25d87ca844bd936609c1433dfa2" ], "lastPricePerShare": "1000000000000000000", - "lastTotalAssets": "9119850491129311910", + "lastTotalAssets": "9800405302561082012", "isRetired": false, "isHidden": false, "migration": { @@ -9922,7 +9922,7 @@ "0x97d4ee49ee15e8223f0bac1c925f9db75918e7b3", "0x44fbf9b2dce6890b75dc988bd1e204e87dcebd93" ], - "lastPricePerShare": "1013648678392500978", + "lastPricePerShare": "1014956487818987654", "lastTotalAssets": "305188826692600471301701", "isRetired": false, "isHidden": false, diff --git a/external/vaults/prepare.vaults.go b/external/vaults/prepare.vaults.go index b67d699a..d7039b84 100755 --- a/external/vaults/prepare.vaults.go +++ b/external/vaults/prepare.vaults.go @@ -96,6 +96,7 @@ func toSimplifiedVersion(vault TExternalVault) TSimplifiedExternalVault { TVL: vault.TVL.TVL, Price: vault.TVL.Price, }, + Strategies: vault.Strategies, Staking: TStakingData{ Address: stakingData.StackingPoolAddress.Hex(), Available: hasStakingPool, diff --git a/external/vaults/route.vaults.allchains.simplified.go b/external/vaults/route.vaults.allchains.simplified.go index 6cdc2837..4d4afb0f 100755 --- a/external/vaults/route.vaults.allchains.simplified.go +++ b/external/vaults/route.vaults.allchains.simplified.go @@ -154,17 +154,7 @@ func (y Controller) GetAllVaultsForAllChainsSimplified(c *gin.Context) { ** c. It checks if the strategy should be included based on the 'strategiesCondition'. If not, ** it skips the current iteration of the loop. ** - ** d. If 'withStrategiesDetails' is true, it assigns the strategy with details to - ** 'externalStrategy' and assigns a risk score to it. Otherwise, it assigns a new 'TStrategy' - ** object with the address, name, display name, and description of the current strategy to - ** 'externalStrategy'. - ** - ** e. It appends 'externalStrategy' to the 'Strategies' field of 'currentVault'. - ** - ** 4. If 'withStrategiesDetails' is true, it computes the risk score for the current vault and - ** assigns it to the 'RiskScore' field of 'currentVault'. - ** - ** 5. It appends the current vault to the 'data' slice. + ** 4. It appends the current vault to the 'data' slice. ** ** This loop effectively populates the 'Strategies' field of each vault in 'allVaults' with the ** appropriate strategies and computes the risk score for each vault if 'withStrategiesDetails' is diff --git a/external/vaults/route.vaults.one.simplified.go b/external/vaults/route.vaults.one.simplified.go new file mode 100755 index 00000000..493f27da --- /dev/null +++ b/external/vaults/route.vaults.one.simplified.go @@ -0,0 +1,99 @@ +package vaults + +import ( + "net/http" + + "github.com/ethereum/go-ethereum/common" + "github.com/gin-gonic/gin" + "github.com/yearn/ydaemon/common/helpers" + "github.com/yearn/ydaemon/internal/storage" +) + +// GetSimplifiedVault will, for a given chainID, return a list of all vaults +func (y Controller) GetSimplifiedVault(c *gin.Context) { + /** 🔵 - Yearn ************************************************************************************* + ** chainID: The chain IDs for which the vaults are to be returned. It is obtained from the + ** 'chainIDs' query parameter in the request. + **************************************************************************************************/ + chainID, ok := helpers.AssertChainID(c.Param("chainID")) + if !ok { + c.String(http.StatusBadRequest, "invalid chainID") + return + } + + /** 🔵 - Yearn ************************************************************************************* + ** address: The address of the vault to be returned. It is obtained from the 'address' query + ** parameter in the request. + **************************************************************************************************/ + address, ok := helpers.AssertAddress(c.Param("address"), chainID) + if !ok { + c.String(http.StatusBadRequest, "invalid address") + return + } + + /** 🔵 - Yearn ************************************************************************************* + ** strategiesCondition: A string that determines the condition for selecting strategies. It is + ** obtained from the 'strategiesCondition' query parameter in the request. + **************************************************************************************************/ + strategiesCondition := selectStrategiesCondition(getQuery(c, `strategiesCondition`)) + + /** 🔵 - Yearn ************************************************************************************* + ** The following block of code will store the final vault to be returned in the response, which will + ** receive a bunch of mutation to be transformed to a simplified version of the vault. + **************************************************************************************************/ + currentVault, ok := storage.GetVault(chainID, address) + if !ok { + c.String(http.StatusBadRequest, "invalid vault") + return + } + newVault, err := NewVault().AssignTVault(currentVault) + if err != nil { + c.String(http.StatusBadRequest, "vault not found") + return + } + APRAsFloat := 0.0 + if newVault.APR.NetAPR != nil { + APRAsFloat, _ = newVault.APR.NetAPR.Float64() + } + newVault.FeaturingScore = newVault.TVL.TVL * APRAsFloat + + /** 🔵 - Yearn ************************************************************************************* + ** For the vault, it performs the following operations: + ** + ** 1. It calls the 'ListStrategiesForVault' function to get a list of all strategies for the + ** current vault. The function takes two parameters: the chain ID of the vault and the address + ** of the vault. + ** + ** 2. It initializes an empty slice of pointers to 'TStrategy' objects for the current vault. + ** + ** 3. It then enters a nested loop that iterates over each strategy in 'vaultStrategies'. For each + ** strategy, it performs the following operations: + ** + ** a. It initializes a pointer to a 'TStrategy' object. + ** + ** b. It calls the 'NewStrategy' function to create a new 'TStrategy' object and assigns the + ** current strategy to it using the 'AssignTStrategy' method. + ** + ** c. It checks if the strategy should be included based on the 'strategiesCondition'. If not, + ** it skips the current iteration of the loop. + ** + ** 4. It appends the current strategies to the vault + ** + ** This effectively populates the 'Strategies' field for the vault with the appropriate strategies + ** and computes the risk score. + **************************************************************************************************/ + vaultStrategies, _ := storage.ListStrategiesForVault(currentVault.ChainID, common.HexToAddress(newVault.Address)) + newVault.Strategies = []TStrategy{} + for _, strategy := range vaultStrategies { + var externalStrategy TStrategy + strategyWithDetails := NewStrategy().AssignTStrategy(strategy) + if !strategyWithDetails.ShouldBeIncluded(strategiesCondition) { + continue + } + + externalStrategy = strategyWithDetails + newVault.Strategies = append(newVault.Strategies, externalStrategy) + } + + c.JSON(http.StatusOK, toSimplifiedVersion(newVault)) +}