How to use the @nomiclabs/buidler/config.internalTask function in @nomiclabs/buidler

To help you get started, we’ve selected a few @nomiclabs/buidler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aragon / aragon-cli / packages / buidler / tasks / start.ts View on Github external
.setAction(async ({}, { web3, run }) => {
    console.log(`Starting...`);

    // Define internal tasks.
    internalTask(TASK_START_NEW_DAO, newDao);
    internalTask(TASK_START_NEW_APP_PROXY, newAppProxy);
    internalTask(TASK_START_UPDATE_PROXY_IMPLEMENTATION, updateProxyImplementation);
    internalTask(TASK_START_WATCH_CONTRACTS, watchContracts)

    // Compile contracts.
    await run('compile')

    // Retrieve active accounts.
    const accounts = await web3.eth.getAccounts();
    const root = accounts[0];

    const dao = await run(TASK_START_NEW_DAO, { root });
    console.log(`New DAO created at: ${dao.address}`);

    const proxy = await run(TASK_START_NEW_APP_PROXY, { root, dao });
    console.log(`New app proxy created at: ${proxy.address}`);
github aragon / aragon-cli / packages / buidler / tasks / start.ts View on Github external
.setAction(async ({}, { web3, run }) => {
    console.log(`Starting...`);

    // Define internal tasks.
    internalTask(TASK_START_NEW_DAO, newDao);
    internalTask(TASK_START_NEW_APP_PROXY, newAppProxy);
    internalTask(TASK_START_UPDATE_PROXY_IMPLEMENTATION, updateProxyImplementation);
    internalTask(TASK_START_WATCH_CONTRACTS, watchContracts)

    // Compile contracts.
    await run('compile')

    // Retrieve active accounts.
    const accounts = await web3.eth.getAccounts();
    const root = accounts[0];

    const dao = await run(TASK_START_NEW_DAO, { root });
    console.log(`New DAO created at: ${dao.address}`);

    const proxy = await run(TASK_START_NEW_APP_PROXY, { root, dao });
    console.log(`New app proxy created at: ${proxy.address}`);
github aragon / aragon-cli / packages / buidler / tasks / start / index.ts View on Github external
TASK_COMPILE,
} from '../task-names';

import {
  createDao,
  deployImplementation,
  createProxy,
  updateProxy,
  createRepo,
  updateRepo,
  setPermissions,
  getMainContractName,
  getMainContractPath
} from './utils/backend';

internalTask(TASK_START_WATCH_CONTRACTS, watchContracts);

const APP_ID = '0xDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF';

/**
 * Main, composite, task.
 */
task(TASK_START, 'Starts Aragon app development').setAction(
  async ({}, { web3, run, artifacts }: BuidlerRuntimeEnvironment) => {
    console.log(`Starting...`);

    await run(TASK_COMPILE);

    // Retrieve active accounts.
    const accounts: string[] = await web3.eth.getAccounts();
    const root = accounts[0];
github aragon / aragon-cli / packages / buidler / tasks / start.ts View on Github external
.setAction(async ({}, { web3, run }) => {
    console.log(`Starting...`);

    // Define internal tasks.
    internalTask(TASK_START_NEW_DAO, newDao);
    internalTask(TASK_START_NEW_APP_PROXY, newAppProxy);
    internalTask(TASK_START_UPDATE_PROXY_IMPLEMENTATION, updateProxyImplementation);
    internalTask(TASK_START_WATCH_CONTRACTS, watchContracts)

    // Compile contracts.
    await run('compile')

    // Retrieve active accounts.
    const accounts = await web3.eth.getAccounts();
    const root = accounts[0];

    const dao = await run(TASK_START_NEW_DAO, { root });
    console.log(`New DAO created at: ${dao.address}`);

    const proxy = await run(TASK_START_NEW_APP_PROXY, { root, dao });
    console.log(`New app proxy created at: ${proxy.address}`);

    await run(TASK_START_WATCH_CONTRACTS, { root, dao })
github nomiclabs / buidler / packages / buidler-truffle4 / src / index.ts View on Github external
accounts = await pweb3.eth.getAccounts();
      }
    }
  );

  internalTask(
    TASK_COMPILE_GET_SOURCE_PATHS,
    async (_, { config }, runSuper) => {
      const sources = await runSuper();
      const testSources = await glob(join(config.paths.tests, "**", "*.sol"));
      return [...sources, ...testSources];
    }
  );

  let wasWarningShown = false;
  internalTask(RUN_TRUFFLE_FIXTURE_TASK, async (_, env) => {
    const paths = env.config.paths;
    const hasFixture = await hasTruffleFixture(paths);

    if (!wasWarningShown) {
      if ((await hasMigrations(paths)) && !hasFixture) {
        console.warn(
          "Your project has Truffle migrations, which have to be turn into a fixture to run your tests with Buidler"
        );

        wasWarningShown = true;
      }
    }

    if (hasFixture) {
      const fixture = await getTruffleFixtureFunction(paths);
      await fixture(env);
github nomiclabs / buidler / packages / buidler-truffle5 / src / index.ts View on Github external
definition(accounts!);
      });
    };
  });

  internalTask(
    TASK_TEST_SETUP_TEST_ENVIRONMENT,
    async (_, { web3, network }) => {
      if (network.name !== BUIDLEREVM_NETWORK_NAME) {
        accounts = await web3.eth.getAccounts();
      }
    }
  );

  internalTask(
    TASK_COMPILE_GET_SOURCE_PATHS,
    async (_, { config }, runSuper) => {
      const sources = await runSuper();
      const testSources = await glob(join(config.paths.tests, "**", "*.sol"));
      return [...sources, ...testSources];
    }
  );

  let wasWarningShown = false;
  internalTask(RUN_TRUFFLE_FIXTURE_TASK, async (_, env) => {
    const paths = env.config.paths;
    const hasFixture = await hasTruffleFixture(paths);

    if (!wasWarningShown) {
      if ((await hasMigrations(paths)) && !hasFixture) {
        console.warn(
github nomiclabs / buidler / packages / buidler-autoexternal / src / index.ts View on Github external
import { TASK_COMPILE_GET_SOURCE_PATHS } from "@nomiclabs/buidler/builtin-tasks/task-names";
import { internalTask } from "@nomiclabs/buidler/config";

import { getAutoexternalConfig } from "./config";
import { generateTestableContracts } from "./contracts";

internalTask(TASK_COMPILE_GET_SOURCE_PATHS, async (_, { config }, runSuper) => {
  const filePaths: string[] = await runSuper();

  const autoexternalConfig = getAutoexternalConfig(config);

  const [
    testableContractPaths,
    failedSourceFiles
  ] = await generateTestableContracts(
    config.paths,
    autoexternalConfig,
    filePaths
  );

  for (const sourceFile of failedSourceFiles) {
    console.warn(
      `A parsing error was encountered. No contract will be generated for ${
github nomiclabs / buidler / packages / buidler-truffle5 / src / index.ts View on Github external
throw new BuidlerPluginError(
          `To run your tests that use Truffle's "contract()" function with the network "${env.network.name}", you need to use Buidler's CLI`
        );
      }

      describe(`Contract: ${description}`, () => {
        before("Running truffle fixture if available", async function() {
          await env.run(RUN_TRUFFLE_FIXTURE_TASK);
        });

        definition(accounts!);
      });
    };
  });

  internalTask(
    TASK_TEST_SETUP_TEST_ENVIRONMENT,
    async (_, { web3, network }) => {
      if (network.name !== BUIDLEREVM_NETWORK_NAME) {
        accounts = await web3.eth.getAccounts();
      }
    }
  );

  internalTask(
    TASK_COMPILE_GET_SOURCE_PATHS,
    async (_, { config }, runSuper) => {
      const sources = await runSuper();
      const testSources = await glob(join(config.paths.tests, "**", "*.sol"));
      return [...sources, ...testSources];
    }
  );
github nomiclabs / buidler / packages / buidler-solpp / src / index.ts View on Github external
);

        await fsExtra.ensureDir(path.dirname(processedFilePath));

        const processedCode = await solpp.processCode(content, opts);

        await fsExtra.writeFile(processedFilePath, processedCode, "utf-8");

        processedPaths.push(processedFilePath);
      }

      return processedPaths;
    }
  );

  internalTask(
    TASK_COMPILE_GET_SOURCE_PATHS,
    async (_, { config, run }, runSuper) => {
      const filePaths: string[] = await runSuper();
      const files = await readFiles(filePaths);
      const opts = getConfig(config);
      return run("buidler-solpp:run-solpp", { files, opts });
    }
  );
}
github nomiclabs / buidler / packages / buidler-solpp / src / index.ts View on Github external
export default function() {
  internalTask(
    "buidler-solpp:run-solpp",
    async (
      { files, opts }: { files: string[][]; opts: SolppConfig },
      { config }: { config: ResolvedBuidlerConfig }
    ) => {
      const processedPaths: string[] = [];
      const solpp = await import("solpp");
      for (const [filePath, content] of files) {
        const processedFilePath = path.join(
          config.paths.cache,
          PROCESSED_CACHE_DIRNAME,
          path.relative(config.paths.sources, filePath)
        );

        await fsExtra.ensureDir(path.dirname(processedFilePath));