const ContractCall = async (abi, address) => {
try {
const web3 = Moralis.web3ByChain('0x38')
const contract = new web3.eth.Contract(abi, address)
const name = await contract.methods
.name()
.call()
.catch((e) => logger.error(`callName: ${JSON.stringify(e, null, 2)}`))
const symbol = await contract.methods
.symbol()
.call()
.catch((e) => logger.error(`callSymbol: ${JSON.stringify(e, null, 2)}`))
const totalSupply = await contract.methods
.totalSupply()
.call()
.catch((e) =>
logger.error(`call_TotalSupply: ${JSON.stringify(e, null, 2)}`)
)
const decimals = await contract.methods
.decimals()
.call()
.catch((e) =>
logger.error(`call_decimals: ${JSON.stringify(e, null, 2)}`)
)
return { name, symbol, totalSupply, decimals }
} catch (e) {
logger.error(`web3ERORr: ${e} ${JSON.stringify(e, null, 2)}`)
return null
}
}
here the full code of function