How to use the @nomiclabs/buidler/config.task 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
TASK_START_NEW_DAO,
  TASK_START_NEW_APP_PROXY,
  TASK_START_UPDATE_PROXY_IMPLEMENTATION,
  TASK_START_WATCH_CONTRACTS
} from './task-names'

// import {
//   TASK_COMPILE
// } from '@nomiclabs/buidler/src/builtin-tasks/task-names'

import filewatcher from 'filewatcher'

const BASE_NAMESPACE = '0xf1f3eb40f5bc1ad1344716ced8b8a0431d840b5783aea1fd01786bc26f35ac0f';
const APP_ID = '0xDEADBEEF';

task(TASK_START, 'Starts Aragon app development')
  .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];
github aragon / aragon-cli / packages / buidler / tasks / start / index.ts View on Github external
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];

    // Create a DAO.
    const dao = await createDao(root, artifacts);
    console.log(`New DAO created at: ${dao.address}`);

    // Create an APM repo for the app.
    const repo = await createRepo(root, artifacts);
    console.log(`New APM Repository created at: ${repo.address}`)
github sc-forks / solidity-coverage / plugins / buidler.plugin.js View on Github external
function plugin() {

  // UI for the task flags...
  const ui = new PluginUI();

  task("coverage", "Generates a code coverage report for tests")

    .addOptionalParam("testfiles",  ui.flags.file,       null, types.string)
    .addOptionalParam("solcoverjs", ui.flags.solcoverjs, null, types.string)
    .addOptionalParam('temp',       ui.flags.temp,       null, types.string)

    .setAction(async function(args, env){
      let error;
      let ui;
      let api;
      let config;

      try {
        death(buidlerUtils.finish.bind(null, config, api)); // Catch interrupt signals

        config = buidlerUtils.normalizeConfig(env.config, args);
        ui = new PluginUI(config.logger.log);
github OffchainLabs / arbitrum / packages / arb-bridge-eth / scripts / verifyTask.ts View on Github external
export default function setupVerifyTask(): void {
  task(
    'verify-contracts',
    'Verifies arbitrum deployment on etherscan',
    async (_taskArgs, bre) => {
      const { deployments } = bre
      await deployments.getOrNull('ArbFactory')
      const contracts = await deployments.all()

      console.log('Verifying contracts on etherscan')
      for (const contractName in contracts) {
        const contractInfo = contracts[contractName as keyof typeof contracts]
        console.log(`Verifying ${contractName}`)
        try {
          await bre.run('verify', {
            address: contractInfo.address,
            constructorArguments: contractInfo.args,
          })
github nomiclabs / buidler / packages / buidler-etherscan / src / index.ts View on Github external
TASK_FLATTEN_GET_FLATTENED_SOURCE
} from "@nomiclabs/buidler/builtin-tasks/task-names";
import { task } from "@nomiclabs/buidler/config";
import { BuidlerPluginError, readArtifact } from "@nomiclabs/buidler/plugins";

import AbiEncoder from "./AbiEncoder";
import { getDefaultEtherscanConfig } from "./config";
import {
  getVerificationStatus,
  verifyContract
} from "./etherscan/EtherscanService";
import { toRequest } from "./etherscan/EtherscanVerifyContractRequest";
import { getLongVersion } from "./solc/SolcVersions";
import { EtherscanConfig } from "./types";

task("verify-contract", "Verifies contract on etherscan")
  .addParam("contractName", "Name of the deployed contract")
  .addParam("address", "Deployed address of smart contract")
  .addOptionalParam(
    "libraries",
    'Stringified JSON object in format of {library1: "0x2956356cd2a2bf3202f771f50d3d14a367b48071"}'
  )
  .addOptionalVariadicPositionalParam(
    "constructorArguments",
    "arguments for contract constructor",
    []
  )
  .setAction(
    async (
      taskArgs: {
        contractName: string;
        address: string;
github nomiclabs / buidler / packages / buidler-solhint / src / index.ts View on Github external
export default function() {
  internalTask("buidler-solhint:run-solhint", async (_, { config }) => {
    const { processPath } = await import("solhint/lib/index");
    return processPath(
      join(config.paths.sources, "**", "*.sol"),
      await getSolhintConfig(config.paths.root)
    );
  });

  task("check", async (_, { run }, runSuper) => {
    if (runSuper.isDefined) {
      await runSuper();
    }

    const reports = await run("buidler-solhint:run-solhint");

    printReport(reports);
  });
}
github nomiclabs / buidler / packages / buidler-ganache / src / index.ts View on Github external
export default function() {
  task(TASK_TEST, async (args, env, runSuper) => {
    return handlePluginTask(args, env, runSuper);
  });

  task(TASK_RUN, async (args, env, runSuper) => {
    return handlePluginTask(args, env, runSuper);
  });

  extendConfig((resolvedConfig: any, config: any) => {
    const defaultOptions = GanacheService.getDefaultOptions();

    if (config.networks && config.networks.ganache) {
      const customOptions = config.networks.ganache;
      resolvedConfig.networks.ganache = { ...defaultOptions, ...customOptions };
    } else {
      resolvedConfig.networks.ganache = defaultOptions;
    }
  });
}
github nomiclabs / buidler / packages / buidler-ganache / src / index.ts View on Github external
export default function() {
  task(TASK_TEST, async (args, env, runSuper) => {
    return handlePluginTask(args, env, runSuper);
  });

  task(TASK_RUN, async (args, env, runSuper) => {
    return handlePluginTask(args, env, runSuper);
  });

  extendConfig((resolvedConfig: any, config: any) => {
    const defaultOptions = GanacheService.getDefaultOptions();

    if (config.networks && config.networks.ganache) {
      const customOptions = config.networks.ganache;
      resolvedConfig.networks.ganache = { ...defaultOptions, ...customOptions };
    } else {
      resolvedConfig.networks.ganache = defaultOptions;
    }