Skip to content

setting block number is not effecting the request #99

@HadiEsna

Description

@HadiEsna

The Problem
When I try to change the block number of the request, it doesn't effect the result at all
I were able to fix it by changing the way we feed the blocknumber in the contract call. (please take look at here
Can you check if I'm doing sth wrong or it's a bug with library. I can create a PR too if it's needed.

Code to replicate

    let calls: any = [];
calls.push({
      reference: "CHAINLINK-PRICE" ,
      contractAddress: 0x13e3Ee699D1909E989722E753853AE30b17e08c5,
      abi: oracleABI, // chainlink oracle abi (copy it from [here](https://optimistic.etherscan.io/address/0x13e3Ee699D1909E989722E753853AE30b17e08c5#code)
      calls: [{ reference: feed, methodName: "latestRoundData", methodParameters: [] }],
    });
    let data = await multicall
      .call(calls, {
        blockNumber: 121357248, // around 30 days ago (Jun-13-2024)
      })
      .catch((e: any) => {
        console.log("error", e);
        return {};
      });
          console.log("data2", BigInt(data.results["CHAINLINK-PRICE"].callsReturnContext[0].returnValues[3].hex).toString());  // update timestamp (which shows now, not 30 days ago)
          console.log("block number", data.blockNumber);
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions