Skip to content

Commit

Permalink
feat(tokens): add more fields to metadata (#265)
Browse files Browse the repository at this point in the history
Fixes ACT-923, adds fields needed for the new token details screen. 

- `showZeroBalance` - true for tokens to be displayed when balance is 0
- `isStableCoin` - true for core stable tokens
- `isCashInEligible` - true for tokens that can be cashed-in
- `isCashOutEligible` - true for tokens that can be cashed-out
- `infoUrl` - link to coingecko
- `networkIconUrl` - computed, set for all non native tokens with the
native token's image url
  • Loading branch information
satish-ravi authored Oct 2, 2023
1 parent 7197077 commit 73fb10e
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 38 deletions.
66 changes: 48 additions & 18 deletions src/data/mainnet/celo-tokens-info.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"decimals": 18,
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/POOF.png",
"name": "PoofCash",
"symbol": "POOF"
"symbol": "POOF",
"infoUrl": "https://www.coingecko.com/en/coins/poofcash"
},
{
"address": "0xc668583dcbdc9ae6fa3ce46462758188adfdfc24",
Expand All @@ -20,7 +21,8 @@
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/UBE.png",
"name": "Ubeswap",
"symbol": "UBE",
"isSwappable": true
"isSwappable": true,
"infoUrl": "https://www.coingecko.com/en/coins/ubeswap"
},
{
"address": "0x035ee610693a29cb77fd6efbeb9d9d278703e145",
Expand Down Expand Up @@ -68,7 +70,8 @@
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/MOO.png",
"name": "Moola",
"symbol": "MOO",
"isSwappable": true
"isSwappable": true,
"infoUrl": "https://www.coingecko.com/en/coins/moola-market"
},
{
"address": "0x1a8dbe5958c597a744ba51763abebd3355996c3e",
Expand All @@ -91,7 +94,8 @@
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/ARI.png",
"name": "Ari Swap",
"symbol": "ARI",
"minimumAppVersionToSwap": "1.60.0"
"minimumAppVersionToSwap": "1.60.0",
"infoUrl": "https://www.coingecko.com/en/coins/ari-swap"
},
{
"address": "0x218c3c3d49d0e7b37aff0d8bb079de36ae61a4c0",
Expand Down Expand Up @@ -180,7 +184,8 @@
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/PACT.png",
"name": "impactMarket",
"symbol": "PACT",
"minimumAppVersionToSwap": "1.60.0"
"minimumAppVersionToSwap": "1.60.0",
"infoUrl": "https://www.coingecko.com/en/coins/impactmarket"
},
{
"address": "0x471ece3750da237f93b8e339c536989b8978a438",
Expand All @@ -190,7 +195,11 @@
"name": "Celo",
"symbol": "CELO",
"isSwappable": true,
"isNative": true
"isNative": true,
"showZeroBalance": true,
"isCashInEligible": true,
"isCashOutEligible": true,
"infoUrl": "https://www.coingecko.com/en/coins/celo"
},
{
"address": "0x47264ae1fc0c8e6418ebe78630718e11a07346a8",
Expand Down Expand Up @@ -233,7 +242,8 @@
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/mCELOxOLD.png",
"name": "Moola CELO AToken",
"symbol": "mCELO",
"pegTo": "0x471ece3750da237f93b8e339c536989b8978a438"
"pegTo": "0x471ece3750da237f93b8e339c536989b8978a438",
"infoUrl": "https://www.coingecko.com/en/coins/moola-celo-atoken"
},
{
"address": "0x73a210637f6f6b7005512677ba6b3c96bb4aa44b",
Expand All @@ -249,7 +259,8 @@
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/SOURCE.png",
"name": "Source",
"symbol": "SOURCE",
"minimumAppVersionToSwap": "1.60.0"
"minimumAppVersionToSwap": "1.60.0",
"infoUrl": "https://www.coingecko.com/en/coins/resource-protocol"
},
{
"address": "0x765de816845861e75a25fca122bb6898b8b1282a",
Expand All @@ -259,7 +270,12 @@
"name": "Celo Dollar",
"symbol": "cUSD",
"isSupercharged": true,
"isSwappable": true
"isSwappable": true,
"isStableCoin": true,
"showZeroBalance": true,
"isCashInEligible": true,
"isCashOutEligible": true,
"infoUrl": "https://www.coingecko.com/en/coins/celo-dollar"
},
{
"address": "0x7c2bf103daac9c082a0e53ad40bb9f3f7f799af7",
Expand All @@ -274,7 +290,8 @@
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/mCELO.png",
"name": "Moola interest bearing CELO",
"symbol": "mCELO",
"isSwappable": true
"isSwappable": true,
"infoUrl": "https://www.coingecko.com/en/coins/mcelo"
},
{
"address": "0x8427bd503dd3169ccc9aff7326c15258bc305478",
Expand All @@ -300,15 +317,17 @@
"symbol": "mCUSD",
"pegTo": "0x765de816845861e75a25fca122bb6898b8b1282a",
"isSupercharged": true,
"isSwappable": true
"isSwappable": true,
"infoUrl": "https://www.coingecko.com/en/coins/moola-celo-dollars"
},
{
"address": "0x94140c2ea9d208d8476ca4e3045254169791c59e",
"decimals": 18,
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/PREMIO.png",
"name": "PREMIO",
"symbol": "PREMIO",
"minimumAppVersionToSwap": "1.60.0"
"minimumAppVersionToSwap": "1.60.0",
"infoUrl": "https://www.coingecko.com/en/coins/premio"
},
{
"address": "0xa649325aa7c5093d12d6f98eb4378deae68ce23f",
Expand Down Expand Up @@ -384,7 +403,11 @@
"name": "Celo Euro",
"symbol": "cEUR",
"isSupercharged": true,
"isSwappable": true
"isSwappable": true,
"isStableCoin": true,
"isCashInEligible": true,
"isCashOutEligible": true,
"infoUrl": "https://www.coingecko.com/en/coins/celo-euro"
},
{
"address": "0xd90bbdf5904cb7d275c41f897495109b9a5ada58",
Expand All @@ -400,15 +423,17 @@
"symbol": "mCEUR",
"pegTo": "0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73",
"isSupercharged": true,
"isSwappable": true
"isSwappable": true,
"infoUrl": "https://www.coingecko.com/en/coins/mceur"
},
{
"address": "0xe685d21b7b0fc7a248a6a8e03b8db22d013aa2ee",
"decimals": 9,
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/IMMO.png",
"name": "Immortal",
"symbol": "IMMO",
"minimumAppVersionToSwap": "1.60.0"
"minimumAppVersionToSwap": "1.60.0",
"infoUrl": "https://www.coingecko.com/en/coins/immortaldao"
},
{
"address": "0xe74abf23e1fdf7acbec2f3a30a772ef77f1601e1",
Expand All @@ -425,7 +450,10 @@
"name": "Celo Brazilian Real",
"symbol": "cREAL",
"isSupercharged": true,
"isSwappable": true
"isSwappable": true,
"isStableCoin": true,
"isCashInEligible": true,
"infoUrl": "https://www.coingecko.com/en/coins/celo-real-creal"
},
{
"address": "0xe919f65739c26a42616b7b8eedc6b5524d1e3ac4",
Expand All @@ -448,7 +476,8 @@
"symbol": "mCREAL",
"isSupercharged": true,
"pegTo": "0xe8537a3d056da446677b9e9d6c5db704eaab4787",
"isSwappable": true
"isSwappable": true,
"infoUrl": "https://www.coingecko.com/en/coins/moola-interest-bearing-creal"
},
{
"address": "0x9995cc8f20db5896943afc8ee0ba463259c931ed",
Expand All @@ -465,7 +494,8 @@
"name": "Plastik",
"symbol": "PLASTIK",
"isSwappable": false,
"minimumAppVersionToSwap": "1.60.0"
"minimumAppVersionToSwap": "1.60.0",
"infoUrl": "https://www.coingecko.com/en/coins/plastiks"
},
{
"address": "0x8a1639098644a229d08f441ea45a63ae050ee018",
Expand Down
8 changes: 6 additions & 2 deletions src/data/mainnet/ethereum-tokens-info.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"symbol": "ETH",
"decimals": 18,
"isNative": true,
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/ETH.png"
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/ETH.png",
"showZeroBalance": true,
"infoUrl": "https://www.coingecko.com/en/coins/ethereum"
},
{
"name": "USD Coin",
"symbol": "USDC",
"decimals": 6,
"address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/USDC.png"
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/USDC.png",
"isStableCoin": true,
"infoUrl": "https://www.coingecko.com/en/coins/usdc"
}
]
36 changes: 28 additions & 8 deletions src/data/testnet/celo-alfajores-tokens-info.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"decimals": 18,
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/UBE.png",
"name": "Ubeswap",
"symbol": "UBE"
"symbol": "UBE",
"infoUrl": "https://www.coingecko.com/en/coins/ubeswap"
},
{
"address": "0x048f47d358ec521a6cf384461d674750a3cb58c8",
Expand All @@ -20,7 +21,11 @@
"isCoreToken": true,
"name": "Celo Euro",
"symbol": "cEUR",
"isSupercharged": true
"isSupercharged": true,
"isStableCoin": true,
"isCashInEligible": true,
"isCashOutEligible": true,
"infoUrl": "https://www.coingecko.com/en/coins/celo-euro"
},
{
"address": "0x123ed050805e0998ebef43671327139224218e50",
Expand Down Expand Up @@ -111,7 +116,12 @@
"isCoreToken": true,
"name": "Celo Dollar",
"symbol": "cUSD",
"isSupercharged": true
"isSupercharged": true,
"showZeroBalance": true,
"isStableCoin": true,
"isCashInEligible": true,
"isCashOutEligible": true,
"infoUrl": "https://www.coingecko.com/en/coins/celo-dollar"
},
{
"address": "0x8d0b8633c6c3d5c1eafb767b3eaf0723e49c9c98",
Expand Down Expand Up @@ -174,7 +184,10 @@
"isCoreToken": true,
"name": "Celo Real",
"symbol": "cREAL",
"isSupercharged": true
"isSupercharged": true,
"isStableCoin": true,
"isCashInEligible": true,
"infoUrl": "https://www.coingecko.com/en/coins/celo-real-creal"
},
{
"address": "0xf194afdf50b03e69bd7d057c1aa9e10c9954e4c9",
Expand All @@ -183,31 +196,38 @@
"isCoreToken": true,
"name": "Celo",
"symbol": "CELO",
"isNative": true
"isNative": true,
"showZeroBalance": true,
"isCashInEligible": true,
"isCashOutEligible": true,
"infoUrl": "https://www.coingecko.com/en/coins/celo"
},
{
"address": "0x3a0ea4e0806805527c750ab9b34382642448468d",
"decimals": 18,
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/mcUSD.png",
"name": "Moola interest bearing CUSD",
"symbol": "mCUSD",
"isSupercharged": true
"isSupercharged": true,
"infoUrl": "https://www.coingecko.com/en/coins/moola-celo-dollars"
},
{
"address": "0x0d9b4311657003251d1efa085e74f761185f271c",
"decimals": 18,
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/mcEUR.png",
"name": "Moola interest bearing CEUR",
"symbol": "mCEUR",
"isSupercharged": true
"isSupercharged": true,
"infoUrl": "https://www.coingecko.com/en/coins/mceur"
},
{
"address": "0x3d0eda535ca4b15c739d46761d24e42e37664ad7",
"decimals": 18,
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/mcREAL.png",
"name": "Moola interest bearing CREAL",
"symbol": "mCREAL",
"isSupercharged": true
"isSupercharged": true,
"infoUrl": "https://www.coingecko.com/en/coins/moola-interest-bearing-creal"
},
{
"address": "0x4620d7a5f58f77eee69a38afdaa8f2ffb10b42b6",
Expand Down
8 changes: 6 additions & 2 deletions src/data/testnet/ethereum-sepolia-tokens-info.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"symbol": "ETH",
"decimals": 18,
"isNative": true,
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/ETH.png"
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/ETH.png",
"showZeroBalance": true,
"infoUrl": "https://www.coingecko.com/en/coins/ethereum"
},
{
"name": "USD Coin",
"symbol": "USDC",
"decimals": 6,
"address": "0x8267cf9254734c6eb452a7bb9aaf97b392258b21",
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/USDC.png"
"imageUrl": "https://raw.githubusercontent.com/valora-inc/address-metadata/main/assets/tokens/USDC.png",
"isStableCoin": true,
"infoUrl": "https://www.coingecko.com/en/coins/usdc"
}
]
33 changes: 32 additions & 1 deletion src/schemas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function validateWithSchema(value: any, schema: Joi.Schema) {

describe('Schema validation', () => {
describe('Joi sanity checks', () => {
describe('TokenInfoSchema', () => {
describe('TokenInfoSchemaJSON', () => {
it('forbids CELO to not have an address', () => {
const validationResult = validateWithSchema(
{
Expand Down Expand Up @@ -54,6 +54,37 @@ describe('Schema validation', () => {
expect(validationResult.error).toBeDefined()
})
})
describe('TokenInfoSchemaProcessed', () => {
it('forbids native tokens to have networkIconUrl', () => {
const validationResult = validateWithSchema(
{
name: 'New native token',
symbol: 'XYZ',
decimals: 18,
isNative: true,
networkId: NetworkId['celo-alfajores'],
tokenId: 'some-token',
networkIconUrl: 'https://some-icon',
},
TokenInfoSchemaProcessed,
)
expect(validationResult.error).toBeDefined()
})
it('requires non-native tokens to have networkIconUrl', () => {
const validationResult = validateWithSchema(
{
name: 'New native token',
symbol: 'XYZ',
decimals: 18,
networkId: NetworkId['celo-alfajores'],
tokenId: 'some-token',
address: '0x471ece3750da237f93b8e339c536989b8978a438',
},
TokenInfoSchemaProcessed,
)
expect(validationResult.error).toBeDefined()
})
})
describe('RTDBAddressToTokenInfoSchema', () => {
it('forbids pegging to phantom address', () => {
const validationResult = validateWithSchema(
Expand Down
Loading

0 comments on commit 73fb10e

Please sign in to comment.