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

Add just some simple way to filter out tokens #398

Merged
merged 7 commits into from
Jun 4, 2024
Merged

Conversation

anxolin
Copy link
Contributor

@anxolin anxolin commented Jun 3, 2024

For Arbitrum launch we have one issue, most of the bridged tokens don't have liquidity.

This creates a bad user experience.

This PR allows the script generators to provide a filtering function that will have the last call on which token should be included and which don't.

In this simplistic implementation, I just allow to cherry-pick a bunch of tokens by token symbol. I know..., token symbols are not unique, but this comes from know lists so its not expected to have duplicates, and the configuration feels simpler to read if I can select the tokens to include by token symbol

Important

This PR should not be merged, and the token selection is not final. Chen is deciding on the final list of tokens to include, tomorrow he will provide them, so we can launch with a filtered list.

Edit 04/06/2024

I did a bunch of enhancements for the launch. Some of them need to be iterated later.

The goal was to reduce the list to a bunch of meaningful tokens (chen provided the list)

The problem, some of these were not in our list
Another problem was that these tokens provided by chen in a CSV didn't have a lot of the information (token name, decimals, etc)

This PR added:

  • Possibility to add a list of tokens not in the reference list (so you can add tokens even if they are not in coingecko, this way we add the ones picked by chen)
  • Utility to read the token list from a CSV
  • Get ERC20 info from onchain, so we can enhance the tokens
  • Utilities to merge token information, this way we can merge CSV, the token list, and the on-chain data properly
  • Additional filters: for it was preferred a smaller list of meaningful tokens (instead of a big list of illiquid tokens), therefore an additional filter was provided (the implementation is, that any token not in the CSV is discarded)

methodName: string,
outputFilePath: string,
tokensToReplace: Record<string, string | null> = {},
): Promise<void> {
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 had too many arguments, so I decided to change from positional parameters to named parameters

.tryAggregate(false, getTotalSupplyCalls(bridgedAddresses, provider))
.then((results) => parseTotalSupplyResponses(results, bridgedAddresses, chainId))

const tokens = tokenFilter ? allTokens.filter(tokenFilter) : allTokens
Copy link
Contributor Author

Choose a reason for hiding this comment

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

gist of the PR, the function receives now an optional parameter with the actual filter

* Future versions of the script should decide using objective on-chain data if a token is liquid or not.
*/
export const TOKENS_WITH_LIQUIDITY = [
'ARB', 'cbETH', 'GRT', 'LINK', 'USDC', 'USDT', 'WBTC', 'WETH',
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it mean that we are going to have only 8 tradable tokens on Arbitrum?
Looks a bit poor

Copy link
Contributor

Choose a reason for hiding this comment

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

We have liquidity for COW but it's not in the list

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no no, this is a placeholder for tomorrow.

Chen is working on the actual list. There will be many more

Copy link

socket-security bot commented Jun 4, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] None 0 27.7 kB trysound

View full report↗︎

@anxolin anxolin merged commit aa4bc7c into main Jun 4, 2024
5 checks passed
@anxolin anxolin deleted the add-filtering branch June 4, 2024 13:29
@github-actions github-actions bot locked and limited conversation to collaborators Jun 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants