Update getPairsInfo.js

This commit is contained in:
Daniel
2022-11-05 11:46:59 +01:00
parent 8928bd0576
commit a69c6190ee

View File

@@ -8,7 +8,14 @@ export async function getPairsInfo(pairAddresses, web3) {
for (let i = 0; i < pairAddresses.length; ++i) { for (let i = 0; i < pairAddresses.length; ++i) {
const pairAddress = pairAddresses[i]; const pairAddress = pairAddresses[i];
const pair = new web3.eth.Contract(pairABI, pairAddresses[i]); const pair = new web3.eth.Contract(pairABI, pairAddresses[i]);
const token0Address = await pair.methods.token0().call(); //get contract
const token1Address = await pair.methods.token1().call();
const token0Contract = new web3.eth.Contract(tokenABI, token0Address); //get contract address
const token1Contract = new web3.eth.Contract(tokenABI, token1Address);
const token0Name = await token0Contract.methods.name().call(); //get contract address name
const token1Name = await token1Contract.methods.name().call();
} }
} }