Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Transaction hash mismatch from Provider.sendTransaction when deploying contract #22

Open
mansijoshi17 opened this issue Dec 22, 2022 · 0 comments

Comments

@mansijoshi17
Copy link

mansijoshi17 commented Dec 22, 2022

Using FEVM hardhat kit to deploy the smart contract. But facing Transaction hash mismatch from Provider.sendTransaction error.

Here is the hardhat deployment script:

require("hardhat-deploy-ethers");

const ethers = require("ethers");
const fa = require("@glif/filecoin-address");
const util = require("util");
const request = util.promisify(require("request"));

console.log(network.config);

const DEPLOYER_PRIVATE_KEY = network.config.accounts[0];

async function callRpc(method, params) {
  var options = {
    method: "POST",
    url: "https://wallaby.node.glif.io/rpc/v0",
    // url: "http://localhost:1234/rpc/v0",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      jsonrpc: "2.0",
      method: method,
      params: params,
      id: 1,
    }),
  };
  const res = await request(options);
  return JSON.parse(res.body).result;
}

const deployer = new ethers.Wallet(DEPLOYER_PRIVATE_KEY);

module.exports = async ({ deployments }) => {
  const { deploy } = deployments;

  const priorityFee = await callRpc("eth_maxPriorityFeePerGas");
  const f4Address = fa.newDelegatedEthAddress(deployer.address).toString();

  console.log("Wallet Ethereum Address:", deployer.address);

  try {
    await deploy("CrypticVault", {
      from: deployer.address,
  
      // since it's difficult to estimate the gas before f4 address is launched, it's safer to manually set
      // a large gasLimit. This should be addressed in the following releases.
      // since Ethereum's legacy transaction format is not supported on FVM, we need to specify
      // maxPriorityFeePerGas to instruct hardhat to use EIP-1559 tx format
  
      maxPriorityFeePerGas: priorityFee,
      log: true,
    });
  } catch (error) {
    console.log(error)
  }
};

module.exports.tags = ["CrypticVault", "MinerAPI", "MarketAPI"];

Here is hardhat config file:

require("@nomicfoundation/hardhat-toolbox");
require("hardhat-deploy");
require("hardhat-deploy-ethers");
require("./tasks");
require("dotenv").config();


const PRIVATE_KEY = process.env.REACT_APP_PRIVATE_KEY;

module.exports = {
  solidity: "0.8.4",
  defaultNetwork: "wallaby",
  networks: {
    hardhat: {},
    wallaby: {
      chainId: 31415,
      url: "https://wallaby.node.glif.io/rpc/v0",
      accounts: [PRIVATE_KEY],
    },
  },
  paths: {
    sources: "./contracts",
    tests: "./test",
    cache: "./cache",
    artifacts: "./artifacts",
  },
};
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant