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: add whitelist tokens #13

Merged
merged 2 commits into from
Oct 22, 2024
Merged

feat: add whitelist tokens #13

merged 2 commits into from
Oct 22, 2024

Conversation

0xnigir1
Copy link
Collaborator

@0xnigir1 0xnigir1 commented Oct 21, 2024

🤖 Linear

Closes GIT-111 GIT-66

Description

  • copies Tokens whitelist per chain to Shared package
  • modifies PricingProvider interface to use TokenCode in place of (addreess, chainId)
  • updates internal CoingeckoProvider to map TokenCode to CoingeckoID
  • completes TODO in PoolCreatedHandler to fetch Token given the Chain and TokenAddress from Event

Checklist before requesting a review

  • I have conducted a self-review of my code.
  • I have conducted a QA.
  • If it is a core feature, I have included comprehensive tests.

@0xnigir1 0xnigir1 requested a review from 0xkenj1 October 21, 2024 13:55
Copy link

linear bot commented Oct 21, 2024

@0xnigir1 0xnigir1 requested review from jahabeebs and 0xyaco October 21, 2024 13:59
Copy link
Collaborator

@jahabeebs jahabeebs left a comment

Choose a reason for hiding this comment

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

Looks good!

CELO: "celo" as CoingeckoTokenId,
CUSD: "celo-dollar" as CoingeckoTokenId,
AVAX: "avalanche-2" as CoingeckoTokenId,
MTK: undefined,
Copy link
Collaborator

Choose a reason for hiding this comment

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

why we have undefined here instead of not having it ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not strictly needed, it was for clarity (mainly for me when checking at Coingecko)

42: "lukso-token" as CoingeckoTokenId,
42220: "celo" as CoingeckoTokenId,
1088: "metis-token" as CoingeckoTokenId,
const TokenMapping: { [key: string]: CoingeckoTokenId | undefined } = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we add a type for keys ?

Could happen that is not supported in coingecko but in cmc , is that we want that flexibility on the key type?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the flexibility is because with TokenCode as type, i would have to write:

["USDC" as TokenCode]: "usd-coin" as CoingeckoTokenId,

which seems too much, i think this is an issue of using Brand Types as type of object's keys

i thought of a Union type too 🤔 don't know if it'll add any benefit here

@0xnigir1 0xnigir1 merged commit 22900ac into dev Oct 22, 2024
6 checks passed
@0xnigir1 0xnigir1 deleted the feat/add-whitelist-tokens branch October 22, 2024 15:06
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