How to use @0x/sol-trace - 10 common examples

To help you get started, we’ve selected a few @0x/sol-trace 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 smartcontractkit / chainlink / evm-test-helpers / src / setup.ts View on Github external
export function provider(): ethers.providers.JsonRpcProvider {
  const providerEngine = new Web3ProviderEngine()
  providerEngine.addProvider(new FakeGasEstimateSubprovider(5 * 10 ** 6)) // Ganache does a poor job of estimating gas, so just crank it up for testing.

  if (process.env.DEBUG) {
    debug('Debugging enabled, using sol-trace module...')
    const defaultFromAddress = ''
    const artifactAdapter = new SolCompilerArtifactAdapter(
      path.resolve('dist/artifacts'),
      path.resolve('contracts'),
    )
    const revertTraceSubprovider = new RevertTraceSubprovider(
      artifactAdapter,
      defaultFromAddress,
      true,
    )
    providerEngine.addProvider(revertTraceSubprovider)
  }

  providerEngine.addProvider(new GanacheSubprovider({ gasLimit: 8_000_000 }))
  providerEngine.start()

  return new ethers.providers.Web3Provider(providerEngine)
}
github smartcontractkit / chainlink / evm-test-helpers / src / setup.ts View on Github external
export function provider(): ethers.providers.JsonRpcProvider {
  const providerEngine = new Web3ProviderEngine()
  providerEngine.addProvider(new FakeGasEstimateSubprovider(5 * 10 ** 6)) // Ganache does a poor job of estimating gas, so just crank it up for testing.

  if (process.env.DEBUG) {
    debug('Debugging enabled, using sol-trace module...')
    const defaultFromAddress = ''
    const artifactAdapter = new SolCompilerArtifactAdapter(
      path.resolve('dist/artifacts'),
      path.resolve('contracts'),
    )
    const revertTraceSubprovider = new RevertTraceSubprovider(
      artifactAdapter,
      defaultFromAddress,
      true,
    )
    providerEngine.addProvider(revertTraceSubprovider)
  }

  providerEngine.addProvider(new GanacheSubprovider({ gasLimit: 8_000_000 }))
  providerEngine.start()

  return new ethers.providers.Web3Provider(providerEngine)
}
github smartcontractkit / chainlink / evm-test-helpers / src / setup.ts View on Github external
export function provider(): ethers.providers.JsonRpcProvider {
  const providerEngine = new Web3ProviderEngine()
  providerEngine.addProvider(new FakeGasEstimateSubprovider(5 * 10 ** 6)) // Ganache does a poor job of estimating gas, so just crank it up for testing.

  if (process.env.DEBUG) {
    debug('Debugging enabled, using sol-trace module...')
    const defaultFromAddress = ''
    const artifactAdapter = new SolCompilerArtifactAdapter(
      path.resolve('dist/artifacts'),
      path.resolve('contracts'),
    )
    const revertTraceSubprovider = new RevertTraceSubprovider(
      artifactAdapter,
      defaultFromAddress,
      true,
    )
    providerEngine.addProvider(revertTraceSubprovider)
  }
github sablierhq / sablier / packages / protocol / truffle-config.js View on Github external
switch (process.env.MODE) {
  case "profile":
    global.profilerSubprovider = new ProfilerSubprovider(artifactAdapter, defaultFromAddress, isVerbose);
    global.profilerSubprovider.stop();
    provider.addProvider(global.profilerSubprovider);
    break;
  case "coverage":
    global.coverageSubprovider = new CoverageSubprovider(
      artifactAdapter,
      defaultFromAddress,
      coverageSubproviderConfig,
    );
    provider.addProvider(global.coverageSubprovider);
    break;
  case "trace":
    provider.addProvider(new RevertTraceSubprovider(artifactAdapter, defaultFromAddress, isVerbose));
    break;
  default:
    // Due to some strange error, contracts do not get deployed when using the ganache subprovider
    // required by the 0x tools
    kovanProvider = createProvider("kovan");
    rinkebyProvider = createProvider("rinkeby");
    ropstenProvider = createProvider("ropsten");
    break;
}

if (process.env.MODE) {
  provider.addProvider(new GanacheSubprovider());
  provider.start((err) => {
    if (err !== undefined) {
      console.log(err);
      process.exit(1);
github smartcontractkit / chainlink / integration-scripts / src / common.ts View on Github external
console.log(chalk.green('Outputting artifacts to:', artifacts))
  await compiler.compileAsync()

  const defaultFromAddress = await ethers.Wallet.fromMnemonic(
    mnemonic,
    path,
  ).getAddress()
  console.log(
    chalk.green(
      'Default from address derived from mnemonic:',
      defaultFromAddress,
    ),
  )

  const artifactAdapter = new SolCompilerArtifactAdapter(artifacts, contracts)
  const revertTraceSubprovider = new RevertTraceSubprovider(
    artifactAdapter,
    defaultFromAddress,
    true,
  )

  const providerEngine = new Web3ProviderEngine()
  providerEngine.addProvider(new FakeGasEstimateSubprovider(4 * 10 ** 6)) // Ganache does a poor job of estimating gas, so just crank it up for testing.
  providerEngine.addProvider(revertTraceSubprovider)
  providerEngine.addProvider(
    // Start an in-process ganache instance
    new GanacheSubprovider({
      mnemonic,
      hdPath: path,
      vmErrorsOnRPCResponse: true,
    }),
  )
github celo-org / celo-monorepo / packages / protocol / truffle-config.js View on Github external
provider: function() {
      if (coverageProvider == null) {
        console.log('building provider!')
        coverageProvider = new ProviderEngine()

        const projectRoot = ''
        const artifactAdapter = new TruffleArtifactAdapter(projectRoot, SOLC_VERSION)
        global.coverageSubprovider = new CoverageSubprovider(artifactAdapter, DEVELOPMENT_FROM, {
          isVerbose: true,
          ignoreFilesGlobs: [
            // Proxies
            '**/*Proxy.sol',

            // Test contracts
            '**/test/*.sol',

            // Interfaces
            '**/interfaces/*.sol',
          ],
        })
        coverageProvider.addProvider(global.coverageSubprovider)

        coverageProvider.addProvider(
github smartcontractkit / chainlink / integration-scripts / src / common.ts View on Github external
console.log(chalk.green('Compiling contracts in:', contracts))
  console.log(chalk.green('Outputting artifacts to:', artifacts))
  await compiler.compileAsync()

  const defaultFromAddress = await ethers.Wallet.fromMnemonic(
    mnemonic,
    path,
  ).getAddress()
  console.log(
    chalk.green(
      'Default from address derived from mnemonic:',
      defaultFromAddress,
    ),
  )

  const artifactAdapter = new SolCompilerArtifactAdapter(artifacts, contracts)
  const revertTraceSubprovider = new RevertTraceSubprovider(
    artifactAdapter,
    defaultFromAddress,
    true,
  )

  const providerEngine = new Web3ProviderEngine()
  providerEngine.addProvider(new FakeGasEstimateSubprovider(4 * 10 ** 6)) // Ganache does a poor job of estimating gas, so just crank it up for testing.
  providerEngine.addProvider(revertTraceSubprovider)
  providerEngine.addProvider(
    // Start an in-process ganache instance
    new GanacheSubprovider({
      mnemonic,
      hdPath: path,
      vmErrorsOnRPCResponse: true,
    }),
github smartcontractkit / chainlink / integration-scripts / src / common.ts View on Github external
).getAddress()
  console.log(
    chalk.green(
      'Default from address derived from mnemonic:',
      defaultFromAddress,
    ),
  )

  const artifactAdapter = new SolCompilerArtifactAdapter(artifacts, contracts)
  const revertTraceSubprovider = new RevertTraceSubprovider(
    artifactAdapter,
    defaultFromAddress,
    true,
  )

  const providerEngine = new Web3ProviderEngine()
  providerEngine.addProvider(new FakeGasEstimateSubprovider(4 * 10 ** 6)) // Ganache does a poor job of estimating gas, so just crank it up for testing.
  providerEngine.addProvider(revertTraceSubprovider)
  providerEngine.addProvider(
    // Start an in-process ganache instance
    new GanacheSubprovider({
      mnemonic,
      hdPath: path,
      vmErrorsOnRPCResponse: true,
    }),
  )
  providerEngine.start()

  const provider = new ethers.providers.Web3Provider(providerEngine)
  const accounts = await provider.listAccounts()
  console.log(chalk.green(`Accounts from provider: ${accounts}`))
github 0xProject / 0x-monorepo / contracts / test-utils / src / revert_trace.ts View on Github external
_getRevertTraceSubprovider(): RevertTraceSubprovider {
        const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS;
        const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter();
        const isVerbose = true;
        const subprovider = new RevertTraceSubprovider(solCompilerArtifactAdapter, defaultFromAddress, isVerbose);
        return subprovider;
    },
};
github 0xProject / 0x-monorepo / contracts / test-utils / src / revert_trace.ts View on Github external
_getRevertTraceSubprovider(): RevertTraceSubprovider {
        const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS;
        const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter();
        const isVerbose = true;
        const subprovider = new RevertTraceSubprovider(solCompilerArtifactAdapter, defaultFromAddress, isVerbose);
        return subprovider;
    },
};

@0x/sol-trace

Prints stack trace on Solidity revert

Apache-2.0
Latest version published 2 years ago

Package Health Score

56 / 100
Full package analysis

Similar packages