Skip to content

Commit

Permalink
fix: risk
Browse files Browse the repository at this point in the history
  • Loading branch information
Majorfi committed Jan 27, 2025
1 parent 4705596 commit 4405d17
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions external/vaults/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/yearn/ydaemon/internal/models"
"github.com/yearn/ydaemon/internal/storage"
"github.com/yearn/ydaemon/processes/apr"
"github.com/yearn/ydaemon/processes/risks"
)

// TExternalVaultHarvest is the struct containing the information about the harvest of a vault that can be used to compute the Gain/Loss and access the Transactions on the explorer.
Expand Down Expand Up @@ -346,6 +347,25 @@ func (v TExternalVault) AssignTVault(vault models.TVault) (TExternalVault, error
v.Info.RiskScore[10] = vault.Metadata.RiskScore.ExternalProtocolType
v.Info.RiskScoreComment = vault.Metadata.RiskScore.Comment
}
cachedRiskScore, err := risks.GetCachedRiskScore(vault.ChainID, vault.Address)
if err == nil {
v.Info.RiskLevel = cachedRiskScore.RiskLevel
v.Info.RiskScore = [11]int8{
cachedRiskScore.RiskScore.Review,
cachedRiskScore.RiskScore.Testing,
cachedRiskScore.RiskScore.Complexity,
cachedRiskScore.RiskScore.RiskExposure,
cachedRiskScore.RiskScore.ProtocolIntegration,
cachedRiskScore.RiskScore.CentralizationRisk,
cachedRiskScore.RiskScore.ExternalProtocolAudit,
cachedRiskScore.RiskScore.ExternalProtocolCentralisation,
cachedRiskScore.RiskScore.ExternalProtocolTvl,
cachedRiskScore.RiskScore.ExternalProtocolLongevity,
cachedRiskScore.RiskScore.ExternalProtocolType,
}
v.Info.RiskScoreComment = cachedRiskScore.RiskScore.Comment
}

v.Info.UINotice = vault.Metadata.UINotice

return v, nil
Expand Down

0 comments on commit 4405d17

Please sign in to comment.