yearn / yearn-protocol

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

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

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 need 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, which some services (such as DeFi Pulse) strongly prefer.

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.

fubuloubu commented 3 years ago

We are no longer adding features to the contracts in themis repository