yearn / yearn-vaults-v2-subgraph

26 stars 41 forks source link

Add additional fields for Vault/Strategy entity #160

Closed bsamuels453 closed 2 years ago

bsamuels453 commented 2 years ago

Add the following fields to the Vault entity:

  1. guardian address (update on event UpdateGuardian)
  2. management address (update on event UpdateManagement)
  3. governance address (update on event UpdateGovernance)
  4. availableDepositLimit (update on event UpdateDepositLimit & any update to totalAssets)
  5. depositLimit (update on event UpdateDepositLimit)

Add the following fields to the Strategy entity

  1. creditAvailable
  2. debtOutstanding
  3. expectedReturn
  4. apiVersion

These should be added to Strategy entity as well, but are sourced from Strategy events:

  1. emergencyExit (from event EmergencyExitEnabled)
  2. estimatedTotalAssets (might be a strategy-specific view that we can't implement with accuracy)
  3. isActive (implements the following view)
    function isActive() public view returns (bool) {
        return vault.strategies(address(this)).debtRatio > 0 || estimatedTotalAssets() > 0;
    }
  4. keeper (from event UpdatedKeeper)
  5. strategist (from event UpdatedStrategist)
  6. rewards (from event UpdatedRewards)

These fields will be used in yearn-watch: https://github.com/Major-Eth/yearn-watch/blob/main/pages/api/getVaults.tsx#L192

0xkofee commented 2 years ago

i'll give this a go

0xkofee commented 2 years ago

https://github.com/bsamuels453/yearn-vaults-v2-subgraph/pull/8