What is error Error: Returned error: execution reverted when calling blockchain data and how to fix it?

What is error Error: Returned error: execution reverted when calling blockchain data and how to fix it?

我正在使用 React 并使用 useEffect 从 App.js 中的区块链获取一些数据并使用 useState 存储它但是当要解决承诺时它会捕获此错误:

error Error: Returned error: execution reverted
    at Object.ErrorResponse (errors.js:28)
    at index.js:303
    at XMLHttpRequest.request.onreadystatechange (index.js:98)

这是App.js

中的代码
const data = mainnet.FairLaunch.pools.map((pool) => {
  const loadingStakingData = async () => {
    const stakedValue = await getStakeValue(pool);
    console.log('Loop staking data', stakedValue); // logging correctly
    return stakedValue;
  };
  return loadingStakingData();
});

Promise.all(data)
  .then((values) => {
    console.log('values', values); // error breaks app before console.log is triggered
    setStakingData(values);
  })
  .catch((error) => console.error('error', error));

这是查询区块链数据的 getStakeValue() 代码:

export async function getStakeValue(param = {}) {
  const vault = getWeb3VaultContract(param.address); 

  const totalSupply = parseInt(await vault.methods.totalSupply().call());
  const totalToken = parseInt(await vault.methods.totalToken().call());
  //getFairLaunch gets the address according to the environment prod or dev
  const balance = await vault.methods.balanceOf(getFairLaunch()).call();

  let stakeValue = (balance * 100 * totalToken) / totalSupply;
  console.log('stakeValue: ' , typeof stakeValue); //number
  console.log('stakeValue: ' , parseInt(stakeValue)); // log correctly

  return stakeValue;
}

这是具有以下功能的 ABI:

export default [
  {
    "inputs": [],
    "name": "totalToken",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  }, {
    "inputs": [],
    "name": "totalSupply",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },  {
    "inputs": [
      {
        "internalType": "address",
        "name": "account",
        "type": "address"
      }
    ],
    "name": "balanceOf",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
];

知道这个错误是什么以及如何解决吗?

有同样的问题..

更改合约地址和 abi 之后。

审批失败..