Skip to content

Instantly share code, notes, and snippets.

@blurpesec
Last active April 5, 2020 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blurpesec/94fde3aa2dca04eb91bf0be9bbf1e54d to your computer and use it in GitHub Desktop.
Save blurpesec/94fde3aa2dca04eb91bf0be9bbf1e54d to your computer and use it in GitHub Desktop.
Asset object schema for use in MyCrypto :-D
module.exports = {
"e1f698bf-cb85-5405-b563-14774af14bf1": {
uuid: "e1f698bf-cb85-5405-b563-14774af14bf1", // required - generated deterministically based on network chainId && contract address.
ticker: "DAI", // required - comes from ethereum-lists
name: "Dai Stablecoin v2.0", // required - comes from ethereum-lists
networkId: "Ethereum", // required - comes from ethereum-lists
type: "erc20", // required - Must be either 'erc20' or 'base'
decimal: 18, // required - comes from ethereum-lists
contractAddress: "0x6B175474E89094C44Da98b954EedeAC495271d0F", // only display when type = 'erc20' - comes from ethereum-lists
mappings: { // Comes from the mycryptohq/assets repo.
coinCapId: "dai", // optional
cryptoCompareId: "DAI", // optional
coinGeckoId: "dai", // optional
dexAgId: "DAI", // optional
cryptoCurrencyIconName: "dai" // optional
},
website: "https://makerdao.com",
logo: {
src: "",
width: "",
height: "",
ipfs_hash: ""
},
support: {
email: "support@makerdao.com",
url: "https://chat.makerdao.com"
},
social: {
blog: "",
chat: "https://chat.makerdao.com",
facebook: "",
forum: "",
github: "https://github.com/makerdao",
gitter: "",
instagram: "",
linkedin: "",
reddit: "https://www.reddit.com/r/MakerDAO",
slack: "",
telegram: "",
twitter: "https://twitter.com/MakerDAO",
youtube: ""
}
}
}
module.exports = {
"e1f698bf-cb85-5405-b563-14774af14bf1": {
uuid: "e1f698bf-cb85-5405-b563-14774af14bf1", // required - generated deterministically based on network chainId && contract address.
ticker: "DAI", // required - comes from ethereum-lists
name: "Dai Stablecoin v2.0", // required - comes from ethereum-lists
networkId: "Ethereum", // required - comes from ethereum-lists
type: "erc20", // required - Must be either 'erc20' or 'base'
decimal: 18, // required - comes from ethereum-lists
contractAddress: "0x6B175474E89094C44Da98b954EedeAC495271d0F", // only display when type = 'erc20' - comes from ethereum-lists
mappings: { // Comes from the mycryptohq/assets repo.
dexAgId: "DAI", // optional
},
iconURL: "https://mycryptoapi.com/api/v1/icon/e1f698bf-cb85-5405-b563-14774af14bf1",
ratesURL: "https://mycryptoapi.com/api/v1/rates/e1f698bf-cb85-5405-b563-14774af14bf1",
website: "https://makerdao.com",
logo: {
src: "",
width: "",
height: "",
ipfs_hash: ""
},
support: {
email: "support@makerdao.com",
url: "https://chat.makerdao.com"
},
social: {
blog: "",
chat: "https://chat.makerdao.com",
facebook: "",
forum: "",
github: "https://github.com/makerdao",
gitter: "",
instagram: "",
linkedin: "",
reddit: "https://www.reddit.com/r/MakerDAO",
slack: "",
telegram: "",
twitter: "https://twitter.com/MakerDAO",
youtube: ""
}
}
}
module.exports = {
"e1f698bf-cb85-5405-b563-14774af14bf1": {
uuid: "e1f698bf-cb85-5405-b563-14774af14bf1", // required - generated deterministically based on network chainId && contract address.
usd: 1.02,
eur: 0.93765
}
}
@blurpesec
Copy link
Author

Method to generate deterministic UUID can be found in the README.md of https://github.com/MyCryptoHQ/assets .

To see the node.js method of generating deterministic UUIDs: https://github.com/MyCryptoHQ/MyCrypto/blob/master/common/v2/utils/generateUUID.tsx#L22-L25

@blurpesec
Copy link
Author

blurpesec commented Mar 31, 2020

Note in All_Assets_Object_v2.js the only difference is these two lines https://gist.github.com/blurpesec/94fde3aa2dca04eb91bf0be9bbf1e54d#file-all_assets_object_v2-js-L17-L18

And removed some of these lines: https://gist.github.com/blurpesec/94fde3aa2dca04eb91bf0be9bbf1e54d#file-all_assets_object_v1-js-L10-L16

These will be added as their own endpoints, accessible by uuid.

@data-go
Copy link

data-go commented Apr 5, 2020

Can you add some quick notes/requirements here whenever you get a chance? I want to make sure I'm not missing anything xD

@blurpesec
Copy link
Author

For All_Assets_Object_v1.js we want to do the following:
On update of either mycryptohq/assets or ethereum-lists/tokens we're going to want to rebuild the file. Basically

  1. Download ethereum-lists/tokens token files.
  2. Generate the uuid using the convention found in https://github.com/MyCryptoHQ/assets 's README
  3. Create an object containing all of the token file found from ethereum-lists/tokens. Name it wholeAssetObject or something
  4. Download mycryptohq/assets's assets.json file.
  5. Add a mappings key to your wholeAssetObject which corresponds to the uuid key in assets.json.

In All_Assets_Object_v2.js the goal is to remove the different mappings ids and replace them with links to their related api endpoint.
This requires us to have endpoints to fetch the third party stuff based on the uuid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment