How to use the @nomiclabs/buidler/plugins.readArtifact 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 nomiclabs / buidler / packages / buidler-etherscan / src / index.ts View on Github external
throw new BuidlerPluginError(
          "Please provide etherscan api token via buidler.config.js (etherscan.apiKey)"
        );
      }

      let source: string;
      try {
        source = await run(TASK_FLATTEN_GET_FLATTENED_SOURCE);
      } catch (_) {
        throw new BuidlerPluginError(
          `Your ${taskArgs.contractName} contract constains a cyclic dependency, Etherscan doesn't currently support contracts with such dependencies through its API, please use their GUI at https://etherscan.io/verifyContract to verify your contract.`
        );
      }

      await run(TASK_COMPILE);
      const abi = (await readArtifact(
        config.paths.artifacts,
        taskArgs.contractName
      )).abi;
      config.solc.fullVersion = await getLongVersion(config.solc.version);

      const request = toRequest({
        apiKey: etherscan.apiKey,
        contractAddress: taskArgs.address,
        sourceCode: source,
        contractName: taskArgs.contractName,
        compilerVersion: config.solc.fullVersion,
        optimizationsUsed: config.solc.optimizer.enabled,
        runs: config.solc.optimizer.runs,
        constructorArguments: AbiEncoder.encodeConstructor(
          abi,
          taskArgs.constructorArguments
github OffchainLabs / arbitrum / packages / arb-bridge-eth / scripts / deployLib.ts View on Github external
export default async function deploy_contracts(bre: BuidlerRuntimeEnvironment) {
  const ethers = bre.ethers
  const config = bre.config

  const OneStepProof = await ethers.getContractFactory('OneStepProof')
  const MessagesChallenge = await ethers.getContractFactory('MessagesChallenge')
  const InboxTopChallenge = await ethers.getContractFactory('InboxTopChallenge')
  const ArbRollup = await ethers.getContractFactory('ArbRollup')
  const GlobalInbox = await ethers.getContractFactory('GlobalInbox')
  const ChallengeFactory = await ethers.getContractFactory('ChallengeFactory')
  const ArbFactory = await ethers.getContractFactory('ArbFactory')

  const one_step_proof = await OneStepProof.deploy()
  logDeploy('OneStepProof', one_step_proof)

  const cArtifact = await readArtifact(
    config.paths.artifacts,
    'ExecutionChallenge'
  )
  const linkedBytecode = linkBytecode(cArtifact, {
    OneStepProof: one_step_proof.address,
  })
  const ExecutionChallenge = await ethers.getContractFactory(
    cArtifact.abi,
    linkedBytecode
  )

  const message_challenge = await MessagesChallenge.deploy()
  logDeploy('MessagesChallenge', message_challenge)
  const inbox_top_challenge = await InboxTopChallenge.deploy()
  logDeploy('InboxTopChallenge', inbox_top_challenge)
  const execution_challenge = await ExecutionChallenge.deploy()
github nomiclabs / buidler / packages / buidler-ethers / src / index.ts View on Github external
getContract: async (name: string) => {
          const { ethers } = await import("ethers");
          const artifact = await readArtifact(env.config.paths.artifacts, name);
          const bytecode = artifact.bytecode;
          const signers = await env.ethers.signers();
          return new ethers.ContractFactory(artifact.abi, bytecode, signers[0]);
        },
        signers: async () => {