yearn / yearn-vaults

Yearn Vault smart contracts
https://yearn.finance/
GNU Affero General Public License v3.0
518 stars 317 forks source link

Add two new fields to strategy contracts to simplify checking TVL and unused strategies #113

Closed dudesahn closed 3 years ago

dudesahn commented 3 years ago

Create two new fields to be standard in strategy contracts.

  1. Add a boolean field that indicates whether a strategy is delegating its funds to another strategy, which would greatly simplify TVL calculations. Currently, calculations for TVL to avoid double-counting needs to be curated manually. Addition of a simple boolean field to indicate whether the strategy were delegating its funds could move all of these calculations on-chain.

Conceptually, the calculation could work as: all added strategies -> update migrations -> filter out non-TVL -> perform estimated asset count

As a name for this boolean field, I was thinking isDelegated, but if that would lead to confusion with the "Delegated Vaults" then we could just call it includeInTVL.

  1. Add a boolean field to signify whether a strategy is active or not, isActive. This would essentially allow "hiding" deprecated or inactive strategies without having to actually remove them from vaults.

If desired, this could also be automated with some kind of check on value locked in the strategy.

dudesahn commented 3 years ago

issue moved to https://github.com/iearn-finance/yearn-protocol/issues/72

fubuloubu commented 3 years ago

@dudesahn this was the correct location for such a request