-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Problem
The functions scoreOpportunity, clamp, hashOpportunity/opportunityID, sortYield, and riskOrder are copy-pasted identically across three packages:
internal/providers/aave/client.gointernal/providers/morpho/client.gointernal/providers/defillama/client.go
This violates DRY and makes it easy for the implementations to drift. If the scoring formula or sort tiebreakers are updated in one provider but not the others, yield rankings will be inconsistent.
Suggested Fix
Extract shared yield scoring, sorting, and risk utilities into a common package (e.g., internal/providers/scoring/ or internal/yield/) and have all three adapters import from there.
Files Affected
internal/providers/aave/client.go—scoreOpportunity,clamp,hashOpportunity,sortYield,riskOrderinternal/providers/morpho/client.go— same functionsinternal/providers/defillama/client.go— same functions (namedopportunityIDinstead ofhashOpportunity)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels