diff --git a/data/vmTokens.json b/data/vmTokens.json index a0dc300..9bb98d0 100644 --- a/data/vmTokens.json +++ b/data/vmTokens.json @@ -1 +1,188 @@ -[{"address":"0x6b175474e89094c44da98b954eedeac495271d0f"},{"address":"0x2ebd53d035150f328bd754d6dc66b99b0edb89aa"},{"address":"0x6810e776880c02933d47db1b9fc05908e5386b96"},{"address":"0x5a98fcbea516cf06857215779fd812ca3bef1b32"},{"address":"0xd533a949740bb3306d119cc777fa900ba034cd52"},{"address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"},{"address":"0x559b7bfc48a5274754b08819f75c5f27af53d53b"},{"address":"0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0"},{"address":"0x534d1f5e617e0f72a6b06a04aa599839af776a5e"},{"address":"0xdac17f958d2ee523a2206206994597c13d831ec7"},{"address":"0x73968b9a57c6e53d41345fd57a6e6ae27d6cdb2f"},{"address":"0x8290333cef9e6d528dd5618fb97a76f268f3edd4"},{"address":"0xba100000625a3754423978a60c9317c58a424e3d"},{"address":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"},{"address":"0x6123b0049f904d730db3c36a31167d9d4121fa6b"},{"address":"0x6f80310ca7f2c654691d1383149fa1a57d8ab1f8"},{"address":"0xf951e335afb289353dc249e82926178eac7ded78"},{"address":"0x1b40183efb4dd766f11bda7a7c3ad8982e998421"},{"address":"0x090185f2135308bad17527004364ebcc2d37e5f6"},{"address":"0x579cea1889991f68acc35ff5c3dd0621ff29b0c9"},{"address":"0xdbdb4d16eda451d0503b854cf79d55697f90c8df"},{"address":"0x402f878bdd1f5c66fdaf0fababcf74741b68ac36"},{"address":"0xdf4ef6ee483953fe3b84abd08c6a060445c01170"},{"address":"0xef3a930e1ffffacd2fc13434ac81bd278b0ecc8d"},{"address":"0xa1f82e14bc09a1b42710df1a8a999b62f294e592"},{"address":"0x6ba75d640bebfe5da1197bb5a2aff3327789b5d3"},{"address":"0x9c354503c38481a7a7a51629142963f98ecc12d0"},{"address":"0x85b6acaba696b9e4247175274f8263f99b4b9180"},{"address":"0x467719ad09025fcc6cf6f8311755809d45a5e5f3"},{"address":"0xc56c2b7e71b54d38aab6d52e94a04cbfa8f604fa"},{"address":"0x808507121b80c02388fad14726482e061b8da827"}] \ No newline at end of file +[ + { + "symbol": "ALCX", + "name": "Alchemix", + "decimals": 18, + "address": "0xdbdb4d16eda451d0503b854cf79d55697f90c8df" + }, + { + "symbol": "DAI", + "name": "Dai Stablecoin", + "decimals": 18, + "address": "0x6b175474e89094c44da98b954eedeac495271d0f" + }, + { + "symbol": "sdFXS", + "name": "Stake DAO FXS", + "decimals": 18, + "address": "0x402f878bdd1f5c66fdaf0fababcf74741b68ac36" + }, + { + "symbol": "VSP", + "name": "VesperToken", + "decimals": 18, + "address": "0x1b40183efb4dd766f11bda7a7c3ad8982e998421" + }, + { + "symbol": "IQ", + "name": "Everipedia IQ", + "decimals": 18, + "address": "0x579cea1889991f68acc35ff5c3dd0621ff29b0c9" + }, + { + "symbol": "FXS", + "name": "Frax Share", + "decimals": 18, + "address": "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0" + }, + { + "symbol": "USDC", + "name": "USD Coin", + "decimals": 6, + "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" + }, + { + "symbol": "GNO", + "name": "Gnosis Token", + "decimals": 18, + "address": "0x6810e776880c02933d47db1b9fc05908e5386b96" + }, + { + "symbol": "SDT", + "name": "Stake DAO Token", + "decimals": 18, + "address": "0x73968b9a57c6e53d41345fd57a6e6ae27d6cdb2f" + }, + { + "symbol": "MET", + "name": "Metronome2", + "decimals": 18, + "address": "0x2ebd53d035150f328bd754d6dc66b99b0edb89aa" + }, + { + "symbol": "CRV", + "name": "Curve DAO Token", + "decimals": 18, + "address": "0xd533a949740bb3306d119cc777fa900ba034cd52" + }, + { + "symbol": "LDO", + "name": "Lido DAO Token", + "decimals": 18, + "address": "0x5a98fcbea516cf06857215779fd812ca3bef1b32" + }, + { + "symbol": "WACME", + "name": "Wrapped ACME", + "decimals": 8, + "address": "0xdf4ef6ee483953fe3b84abd08c6a060445c01170" + }, + { + "symbol": "FIS", + "name": "StaFi", + "decimals": 18, + "address": "0xef3a930e1ffffacd2fc13434ac81bd278b0ecc8d" + }, + { + "symbol": "eCFX", + "name": "ethereum Conflux", + "decimals": 18, + "address": "0xa1f82e14bc09a1b42710df1a8a999b62f294e592" + }, + { + "symbol": "VEUR", + "name": "VNX Euro", + "decimals": 18, + "address": "0x6ba75d640bebfe5da1197bb5a2aff3327789b5d3" + }, + { + "symbol": "OGV", + "name": "Origin Dollar Governance", + "decimals": 18, + "address": "0x9c354503c38481a7a7a51629142963f98ecc12d0" + }, + { + "symbol": "SPR", + "name": "Spiral", + "decimals": 18, + "address": "0x85b6acaba696b9e4247175274f8263f99b4b9180" + }, + { + "symbol": "AXL", + "name": "Axelar", + "decimals": 6, + "address": "0x467719ad09025fcc6cf6f8311755809d45a5e5f3" + }, + { + "symbol": "QI", + "name": "QiDao", + "decimals": 18, + "address": "0x559b7bfc48a5274754b08819f75c5f27af53d53b" + }, + { + "symbol": "WETH", + "name": "Wrapped Ether", + "decimals": 18, + "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" + }, + { + "symbol": "ZUSD", + "name": "Z.com USD", + "decimals": 6, + "address": "0xc56c2b7e71b54d38aab6d52e94a04cbfa8f604fa" + }, + { + "symbol": "PENDLE", + "name": "Pendle", + "decimals": 18, + "address": "0x808507121b80c02388fad14726482e061b8da827" + }, + { + "symbol": "Silo", + "name": "Silo Governance Token", + "decimals": 18, + "address": "0x6f80310ca7f2c654691d1383149fa1a57d8ab1f8" + }, + { + "symbol": "BAL", + "name": "Balancer", + "decimals": 18, + "address": "0xba100000625a3754423978a60c9317c58a424e3d" + }, + { + "symbol": "RBN", + "name": "Ribbon", + "decimals": 18, + "address": "0x6123b0049f904d730db3c36a31167d9d4121fa6b" + }, + { + "symbol": "swETH", + "name": "swETH", + "decimals": 18, + "address": "0xf951e335afb289353dc249e82926178eac7ded78" + }, + { + "symbol": "ANKR", + "name": "Ankr Network", + "decimals": 18, + "address": "0x8290333cef9e6d528dd5618fb97a76f268f3edd4" + }, + { + "symbol": "BSN", + "name": "Blockswap Network", + "decimals": 18, + "address": "0x534d1f5e617e0f72a6b06a04aa599839af776a5e" + }, + { + "symbol": "USDT", + "name": "Tether USD", + "decimals": 6, + "address": "0xdac17f958d2ee523a2206206994597c13d831ec7" + }, + { + "symbol": "SPELL", + "name": "Spell Token", + "decimals": 18, + "address": "0x090185f2135308bad17527004364ebcc2d37e5f6" + } +] \ No newline at end of file diff --git a/src/vmTokens.ts b/src/vmTokens.ts index a152ad9..6980c5f 100644 --- a/src/vmTokens.ts +++ b/src/vmTokens.ts @@ -19,7 +19,7 @@ const abi = parseAbi([ 'function symbol() view returns (string)', 'function name() view returns (string)', 'function decimals() view returns (uint8)', - ]); +]); const CONTRACTS = [ "0x0000000895cB182E6f983eb4D8b4E0Aa0B31Ae4c", @@ -43,7 +43,7 @@ const main = async () => { address IN bribe_contracts and signature = 'BountyCreated(uint256,address,address,address,uint8,uint256,uint256,uint256,bool)' `)) - .flat(); + .flat(); const contracts = rewardTokensResp.map((rewardToken: string) => { return [ @@ -64,22 +64,44 @@ const main = async () => { } ] }) - .flat(); + .flat(); - const results = await client.multicall({contracts}); - + const results = await client.multicall({ contracts }); const data = rewardTokensResp.map((address: string) => { - const symbol = results.shift()?.result as string; - const name = results.shift()?.result as string; - const decimals = results.shift()?.result as number; + let symbol = ""; + let name = ""; + let decimals = 0; + + let data = results.shift(); + if (data && data.status === 'failure') { + return null; + } + symbol = data?.result as string; + + data = results.shift(); + if (data && data.status === 'failure') { + return null; + } + name = data?.result as string; + + data = results.shift(); + if (data && data.status === 'failure') { + return null; + } + decimals = data?.result as number; return { - symbol, + symbol, name, decimals, address } - }); + }) + .filter((res: any) => res !== null); + + if (data.length !== rewardTokensResp.length) { + return; + } fs.writeFileSync("./data/vmTokens.json", JSON.stringify(data)); };