Last active
August 19, 2021 22:43
-
-
Save gnkz/cae0728d116ed68df1c5e311c945a4a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const snapshot = require('../'); | |
const { abi } = require('./ERC20.json'); | |
const { Multicaller, getProvider } = snapshot.utils; | |
const network = '11297108109'; | |
const provider = getProvider(network); | |
const tokens = ['0x97d537169A3df0AA0838B565c8eAefC2b0Bf6EBd']; | |
const options = { blockTag: 1210736 }; | |
const multi = new Multicaller(network, provider, abi, options); | |
tokens.forEach((token) => { | |
multi.call(`${token}.name`, token, 'name'); | |
multi.call(`${token}.symbol`, token, 'symbol'); | |
multi.call(`${token}.decimals`, token, 'decimals'); | |
}); | |
multi.execute().then((result) => { | |
console.log('Multicaller result', result); | |
/* Multicaller result | |
{ | |
'0x6B175474E89094C44Da98b954EedeAC495271d0F': { | |
name: 'Dai Stablecoin', | |
symbol: 'DAI', | |
decimals: 18 | |
}, | |
'0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2': { | |
name: 'Wrapped Ether', | |
symbol: 'WETH', | |
decimals: 18 | |
}, | |
'0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599': { | |
name: 'Wrapped BTC', | |
symbol: 'WBTC', | |
decimals: 8 | |
} | |
} | |
*/ | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment