Closed dekz closed 5 years ago
Some thoughts on this.
The way we configure the tokens right now requires a lot of information (unnecessarily). For example, instead of having an address, we have a map of network ids to addresses. This also connects with something we've been wanting to do for some time now: add an env var indicating which network id is supported by the frontend. This makes sense because the relayer only supports one network, and it would make it much easier to show a "wrong network" message. And it simplifes the information needed for each token
We also have things like symbol and decimals (not needed at all, it could be queried) and name and "primary color" (this can't be queried, but we could have this information for a bunch of known tokens, and use some defaults for unknown ones).
It is only the frontend that requires configuration, if all tokens ('*') are whitelisted at the backend. Tested and holds true!
This is also related: https://github.com/0xProject/0x-launch-kit-frontend/issues/517
Here is a comprehensive view and "workflow" to manage these edits.
https://github.com/0xbitcoin-exchange/0x-launch-kit-frontend-configs
Currently a launch-kit backend can support
WHITELIST_ALL_TOKENS='*'
this means all orders for any token will be stored.Querying the SRA endpoint for supported tokens won't list, all tokens in existence as the backend doesn't know of them, it only knows of the tokens it has orders for.
The front end contains a list of tokens it supports, which is currently limited. The ability to add new tokens requires changing 2 files and rebuilding.
Let's try and get these steps down to as little as possible and document the way to change this behaviour. ENV vars are hard to configure this with but when using containers it is also hard to modify a file (for the non advanced users).
Easy mode
Can we mount a config file in?
Can we supply via ENV vars:
Where the symbol is looked up via the contract addresses supplied.
Advanced mode
Document the files that need to be changes and the way to re-build with those changes given the wizard or some other option. Can we mount a config file in?
src/common/markets.ts
src/common/tokens_meta_data.ts
Adding a new token
For example, let's say we wish to add a new token called
DEKZ
.Firstly add the token symbol to the
types.ts
file:Add to the list of KNOWN TOKENS in the
tokens_meta_data.ts
file:Add it to the available markets file
markets.ts
: