dao-templates icon indicating copy to clipboard operation
dao-templates copied to clipboard

Can't run `scripts/create.js` or `scripts/deploy.js`

Open sorenrood opened this issue 3 years ago • 2 comments

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 avatar Jan 24 '22 05:01 sorenrood

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);
  });

sorenrood avatar Jan 24 '22 07:01 sorenrood

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

alibama avatar Jan 26 '22 17:01 alibama