Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(beefy): add safety info #621

Merged
merged 3 commits into from
Oct 16, 2024
Merged

feat(beefy): add safety info #621

merged 3 commits into from
Oct 16, 2024

Conversation

satish-ravi
Copy link
Contributor

Taken from beefy codebase, tested by running locally and ensured getEarnPositions returns the expected info for the WETH pool

const { category, title, score } = RISKS[risk]
return {
// from https://github.com/beefyfinance/beefy-v2/blob/3690e105c4bb98afcf06f9c3e385d13cc23af5cd/src/features/vault/components/SafetyCard/SafetyCard.tsx#L39
isPositive: score <= 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit confusing that isPositive is whether the score is <=0 but I think the naming makes sense for what it would be used for, not sure what a better alternative would be

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, I added a clarifying comment

categories[cat].push(risk)
})

// reduce & clamp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does clamp mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's the math.min if the score goes above 1, taken literally from beefy code

const knownRisks = risks.filter((risk) => !!RISKS[risk])

if (knownRisks.length !== risks.length) {
logger.warn({ vault }, 'Beefy vault has unknown risks')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice addition

Comment on lines +182 to +184
'Categry-Beefy': 0.2,
'Categry-Asset': 0.3,
'Categry-Platform': 0.5,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these typo's or is it literally Categry?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure, just taken directly from beefy codebase, didn't want to change it.

@satish-ravi satish-ravi merged commit 91f9e2b into main Oct 16, 2024
6 checks passed
@satish-ravi satish-ravi deleted the satish/act-1405 branch October 16, 2024 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants