Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run scripts/create.js or scripts/deploy.js #220

Open
sorenrood opened this issue Jan 24, 2022 · 2 comments
Open

Can't run scripts/create.js or scripts/deploy.js #220

sorenrood opened this issue Jan 24, 2022 · 2 comments

Comments

@sorenrood
Copy link

Hi! Would love some pointers here! Using node v14.0.0 and npm v8.3.1. I am trying to deploy the trust DAO template.

ubuntu@sorenserver:~/dao-templates/templates/trust$ npx hardhat run scripts/create.js
npm does not support Node.js v14.0.0
You should probably upgrade to a newer version of node as we
can't make any promises that npm will work with this version.
You can find the latest version at https://nodejs.org/

/home/ubuntu/dao-templates/templates/trust/scripts/create.js:4
const { fileName } = require('@aragon/templates-shared/lib/arapp-file')(web3)
                                                                        ^
ReferenceError: web3 is not defined
    at Object.<anonymous> (/home/ubuntu/dao-templates/templates/trust/scripts/create.js:4:73)
    at Module._compile (internal/modules/cjs/loader.js:1185:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
    at Module.load (internal/modules/cjs/loader.js:1034:32)
    at Function.Module._load (internal/modules/cjs/loader.js:923:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
@sorenrood
Copy link
Author

sorenrood commented Jan 24, 2022

I ended up moving the contracts to a hardhat project and am able to compile them! I chose to use hardhat bc I wasn't very familiar with ganache/truffle. Now I'm running into issues with the deployment constructor. It looks like I need 4 constructor arguments:

constructor(DAOFactory _daoFactory, ENS _ens, MiniMeTokenFactory _miniMeFactory, IFIFSResolvingRegistrar _aragonID)

This is what my trust.js file looks like (I'm trying to deploy the contract using this script). I'm not sure how to get the constructor working here.

// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// When running the script with `npx hardhat run <script>` you'll find the Hardhat
// Runtime Environment's members available in the global scope.
const hre = require("hardhat");
const factory = require("DAOFactory");

async function main() {
  // Hardhat always runs the compile task when running scripts with its command
  // line interface.
  //
  // If this script is run directly using `node` you may want to call compile
  // manually to make sure everything is compiled
  // await hre.run('compile');

  // We get the contract to deploy
  const Machine = await hre.ethers.getContractFactory("TrustTemplate");
  
  let _daoFactory = '';
  let _ens = '';
  let _miniMeFactory = '';
  let _aragonID = '';

  const machine = await Machine.deploy(_daoFactory, _ens, _miniMeFactory, _aragonID);

  await machine.deployed();

  console.log("TrustDAO deployed to:", machine.address);
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

@alibama
Copy link

alibama commented Jan 26, 2022

Hi @sorenrood my belief is that you may need to use NVM to run node 12 for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants