[SOLVED] Error: Returned values aren't valid, did it run Out of Gas?

Error: Returned values aren’t valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.

public getRewards = (userAddress: string, token: string) =>


  contractAddress: AppConfig.REWARDLOCKERADDRESS,

  functionName: "getVestingSchedules",

  abi: rewardLockerAbi,

  params: {

    account: userAddress,

    token: token,




1 Like

It looks like this is the function that you tried to call

  function getVestingSchedules(address account, IERC20 token)
    returns (VestingSchedule[] memory schedules)
    uint256 schedulesLength = accountVestingSchedules[account][token].length;
    schedules = new VestingSchedule[](schedulesLength);
    for (uint256 i = 0; i < schedulesLength; i++) {
      schedules[i] = accountVestingSchedules[account][token].data[i];

an example of how to call it (same as you did)

x = "0x10ed43c718714eb63d5aa57b78b54704e256024e"
abi2 = [{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"getVestingSchedules","outputs":[{"components":[{"internalType":"uint64","name":"startBlock","type":"uint64"},{"internalType":"uint64","name":"endBlock","type":"uint64"},{"internalType":"uint128","name":"quantity","type":"uint128"},{"internalType":"uint128","name":"vestedQuantity","type":"uint128"}],"internalType":"struct IRewardLocker.VestingSchedule[]","name":"schedules","type":"tuple[]"}],"stateMutability":"view","type":"function"}]

y = await Moralis.executeFunction({
  contractAddress: "0xf6d838fDfEcC7153313e080Fb764570302015010",
  functionName: "getVestingSchedules",
  abi: abi2,
  params: {
    account: x,
    token: x,

but you will get that error if you are not connected in MetaMask to polygon/matic network when you execute that code, you will need to add polygon/matic network in your MetaMask settings and then select that network and then execute this code.


:pray:t5: thanks again, i also appreciate the responsiveness

My metamask wasn’t connected to the network. Thanks so much