hardhat/types#ActionType TypeScript Examples

The following examples show how to use hardhat/types#ActionType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.ts    From hardhat-tenderly with GNU General Public License v3.0 6 votes vote down vote up
verifyContract: ActionType<VerifyArguments> = async (
  { contracts },
  { config, hardhatArguments, run }
) => {
  if (contracts === undefined) {
    throw new HardhatPluginError(
      PluginName,
      `At least one contract must be provided (ContractName=Address)`
    );
  }

  const requestContracts = await extractContractData(
    contracts,
    hardhatArguments.network,
    config,
    run
  );
  const solcConfig = {
    compiler_version: config.solidity.compilers[0].version,
    optimizations_used: config.solidity.compilers[0].settings.optimizer.enabled,
    optimizations_count: config.solidity.compilers[0].settings.optimizer.runs
  };

  await TenderlyService.verifyContracts({
    config: solcConfig,
    contracts: requestContracts
  });
}
Example #2
Source File: overrideQueryFunctions.ts    From balancer-v2-monorepo with GNU General Public License v3.0 6 votes vote down vote up
override: ActionType<any> = async (
  args: any,
  env: HardhatRuntimeEnvironment,
  run: RunSuperFunction<any>
): Promise<any> => {
  const result = await run();
  DIRECTORIES.forEach(traverseDirectory);
  return result;
}
Example #3
Source File: index.ts    From hardhat-tenderly with GNU General Public License v3.0 5 votes vote down vote up
pushContracts: ActionType<VerifyArguments> = async (
  { contracts },
  { config, hardhatArguments, run }
) => {
  if (contracts === undefined) {
    throw new HardhatPluginError(
      PluginName,
      `At least one contract must be provided (ContractName=Address)`
    );
  }

  if (config.tenderly.project === undefined) {
    throw new HardhatPluginError(
      PluginName,
      `Please provide the project field in the tenderly object in hardhat.config.js`
    );
  }

  if (config.tenderly.username === undefined) {
    throw new HardhatPluginError(
      PluginName,
      `Please provide the username field in the tenderly object in hardhat.config.js`
    );
  }

  const requestContracts = await extractContractData(
    contracts,
    hardhatArguments.network,
    config,
    run
  );
  const solcConfig = {
    compiler_version: config.solidity.compilers[0].version,
    optimizations_used: config.solidity.compilers[0].settings.optimizer.enabled,
    optimizations_count: config.solidity.compilers[0].settings.optimizer.runs
  };

  await TenderlyService.pushContracts(
    {
      config: solcConfig,
      contracts: requestContracts
    },
    config.tenderly.project,
    config.tenderly.username
  );
}