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

Enhancement/ Safety level ranking flag to tokens #900

Draft
wants to merge 4 commits into
base: v2
Choose a base branch
from

Conversation

PetromirDev
Copy link
Member

@PetromirDev PetromirDev commented Jul 24, 2024

A new token flag is introduced. It is safetyLevel and the values it accepts are:

  • undefined- we don't assign a safetyLevel on custom networks
  • trusted- tokens found in the humanizer or non-spoof tokens with a price
  • spoof- you can see the condition in the code but IMO it'd be much better if tokens in the humanizer have networkId or even better chainId
  • unknown- not spoof, not trusted and on predefined networks

@PetromirDev PetromirDev added the enhancement New feature or request label Jul 24, 2024
@PetromirDev PetromirDev self-assigned this Jul 24, 2024
Copy link
Member

@Ivshti Ivshti left a comment

Choose a reason for hiding this comment

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

I don't understand the logic and I think the code can be rewritten to be better

src/libs/portfolio/helpers.ts Outdated Show resolved Hide resolved
src/libs/portfolio/helpers.ts Outdated Show resolved Hide resolved
src/libs/portfolio/helpers.ts Outdated Show resolved Hide resolved
@PetromirDev PetromirDev marked this pull request as ready for review August 8, 2024 14:08
@PetromirDev PetromirDev changed the title WIP: Enhancement/ Safety level ranking flag to tokens Enhancement/ Safety level ranking flag to tokens Aug 8, 2024
@PetromirDev PetromirDev requested a review from JIOjosBG August 8, 2024 14:20
Copy link
Member

@JIOjosBG JIOjosBG left a comment

Choose a reason for hiding this comment

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

lgtm, really liked how you optimized for long arrays of tokens

// thus we can't trust it
if (!canTokenBeChecked) return undefined

Object.values(humanizerInfo.knownAddresses as unknown as HumanizerMeta).some((value) => {
Copy link
Member

Choose a reason for hiding this comment

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

add comment about .some() doing a break on return true and continue on return false

@PetromirDev PetromirDev marked this pull request as draft August 14, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants