Skip to content

buttonwood-protocol/buttonwood-token-list

Repository files navigation

Buttonwood Token List

See https://github.com/Uniswap/token-lists or https://tokenlists.org/.

Setup instructions

If you're running this on mac, node-gyp might throw some errors during yarn install.

Can typically be resolved by brew installing the following:

brew install pixman cairo pango

The tokenlists

Our intention is to keep these tokenlists as lean as possible, rather than including tokens on a whim. We encourage other projects that wish to use our platforms to copy this repository and edit it to produce tokenlists specific to their activities. These new tokenlists can then be communicated to us at Buttonwood where we will include them in the list that users can choose from when using our applications.

[TODO: update this when the repo that stores community tokenlists is created]

buttonwood.tokenlist.json

This list contains assets that are directly used by Buttonwood in our ongoing activities. This comprises:

  • raw collateral assets for the bonds we create
  • button and unbutton tokens that we have deployed
  • loan currencies that we set up bond markets with

buttonwood-bonds.tokenlist.json

This list contains tranche tokens belonging to bonds that Buttonwood has deployed.

Dev

The tokenlist is produced by processing the data stored in src/tokens.json, which maps wrapped tokens back to their underlying token. It is configured this way to facilitate automatic generation of logo assets for wrapped tokens, incorporating the underlying token logo.

npm run build to rebuild buttonwood.tokenlist.json and re-fetch and regenerate the logo assets

npm run test to run the unit tests on the tokenlist

Underlying token logo asset management

If an image is found at the expected path already, it will skip over it. If not, it will attempt to retrieve an asset from vetted sources (at present just 1inch's tokenlist assets).

Manual curation can be achieved by replacing automatically retrieved assets with a preferred one. Token assets should be 256x256px PNG files.

Wrapped token logo generation

The wrapped token logo is generated by combining several images:

  1. the mask layer doubles up as a background and is drawn first
  2. the underlying token logo asset is drawn over the top, but masked by first layer (replaces colour channel values but reuses existing alpha channel)
  3. the overlay layer is drawn over the top, no masking applied

The underlying token logo asset is found at assets/tokens/<address>.png. The other two layers are wrapper specific, and found at src/wrappers/<wrapper name>/mask.png and src/wrappers/<wrapper name>/overlay.png.

Customising

So you've copied this repository and intend to tailor it to your own tokenlists. The following is a list of files to examine and edit, with some brief pointers:

  • src/tokens.json
  • src/wrappers
    • as described above, edit the images in here to change how the wrapper logo output looks
  • src/networkConfig.ts
    • this dictates how the tool determines which tranche tokens to process
    • new networks can be added
    • set the subgraphTranche property to control which subgraph endpoint to query for each network
    • edit bondMinters to filter out bonds that weren't created by an address listed in that array
  • src/build.ts
    • this is the entrypoint that controls what the tool does. It moves through three stages:
      1. build a single list of all TokenDefinitions, and create the corresponding TokenDefinitionMap from it
      2. create any logos for TokenDefinitions that are missing them
      3. split the TokenDefinitions out into different tokenlists and save them off
    • edit the metadata passed to getTokenList calls to change the resulting tokenlist
    • edit the filenames that the created tokenlists are saved as
    • add or remove list generation as appropriate
  • src/createLogos.ts
    • the behaviour of the downloadLogo function can be changed to add or remove endpoints that missing logos can be retrieved from
  • test/*
    • add, rename, remove test files as appropriate based on modifications made to the tokenlists being output

Sourcing data

Token addresses:

Token logos:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •