Coder Social home page Coder Social logo

Comments (1)

terry1ee avatar terry1ee commented on June 21, 2024

I tried to deploy using the following Hardhat Ignition script but encountered an error.

import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";

const TokenStakeModule = buildModule("TokenStakeModule", (m) => {
  const nativeTokenWrapper = m.getParameter(
    "nativeTokenWrapper",
    "0xdf572718C075C93544F5624ebF7B26bBb85ca8CE"
  );
  const defaultAdmin = m.getParameter("defaultAdmin", m.getAccount(0));
  const contractURI = m.getParameter("contractURI", "ipfs://...");
  const trustedForwarders = m.getParameter("trustedForwarders", []);
  const rewardToken = m.getParameter(
    "rewardToken",
    "0xB3c3327A98a1F9b055b404F4b1629367d074C7eC"
  );
  const stakingToken = m.getParameter(
    "stakingToken",
    "0x6F0d766D99bf6007AF9364BEED348C177D877d82"
  );
  const timeUnit = m.getParameter("timeUnit", 60);
  const rewardRatioNumerator = m.getParameter("rewardRatioNumerator", 1);
  const rewardRatioDenominator = m.getParameter("rewardRatioDenominator", 10);

  const tokenStake = m.contract("TokenStake", [nativeTokenWrapper]);

  m.call(tokenStake, "initialize", [
    defaultAdmin,
    contractURI,
    trustedForwarders,
    rewardToken,
    stakingToken,
    timeUnit,
    rewardRatioNumerator,
    rewardRatioDenominator,
  ]);

  return { tokenStake };
});

export default TokenStakeModule;

error message

$ npx hardhat ignition deploy ./ignition/modules/TokenStake.ts --reset
Hardhat Ignition 🚀

Deploying [ TokenStakeModule ]

Batch #1
  Executed TokenStakeModule#TokenStake

Batch #2
  Failed TokenStakeModule#TokenStake.initialize

[ TokenStakeModule ] failed ⛔

Futures failed during execution:
 - TokenStakeModule#TokenStake.initialize: Simulating the transaction failed with error: Reverted with reason "Initializable: contract is already initialized"

To learn how to handle these errors: https://hardhat.org/ignition-errors

from contracts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.