-
Notifications
You must be signed in to change notification settings - Fork 78
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
Token refactor follow-up: config updates #3200
base: development
Are you sure you want to change the base?
Token refactor follow-up: config updates #3200
Conversation
✅ Deploy Preview for wormhole-connect ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for wormhole-connect-mainnet ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
if (customConfig.tokens) { | ||
// If the integrator has provided a whitelist of tokens, we can reasonably assume they also don't want | ||
// users pasting in arbitrary token addresses. | ||
ui.disableArbitraryTokens = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the integrator explicitly specifies disableArbitraryTokens = false
while having whitelist tokens in the config, should that still enable arbitrary tokens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question... I can add support for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
} | ||
|
||
for (const symbol of desiredSymbols) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above it says "If there is a single native token with that symbol, we simply use that", bu I can't find where that's implemented in this loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the foundNative
flag is how that's implemented. although you're right the comment is slightly inaccurate: we don't check that there's only one native (not wrapped) token with the symbol; we simply take the first one we find. if there were two native tokens with the same symbol, it would choose one of them arbitrarily. this isn't likely to happen, but it's possible.
I suppose I could remove the break
on line 223 to include all native tokens with a matching symbol?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that'll work.
This makes some breaking changes to the config, so that it works with the new arbitrary tokens system.
Breaking changes
Token whitelist
The token whitelist used to reference tokens by their "keys" like this:
Since tokens no longer have these custom keys, we now support two other means of whitelisting tokens:
This config whitelists USDC coin on all chains, and Pnut the Squirrel on Solana. There is some nuance to how this works because of wrapped tokens, which is explained here.
Default tokens
The
DefaultInputs
config now has to be either the symbol or the address for the token.New properties
This also adds a new config option which disables the ability to paste in token addresses:
This is set to true by default if an integrator provides the
tokens
whitelist.