How to use the @0x/sol-profiler.ProfilerSubprovider function in @0x/sol-profiler

To help you get started, we’ve selected a few @0x/sol-profiler 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 sablierhq / sablier / packages / protocol / truffle-config.js View on Github external
"**/test/**",
    "**/zeppelin/**",
  ],
};

const projectRoot = "";
const artifactAdapter = new TruffleArtifactAdapter(projectRoot, compilerConfig.solcVersion);
const provider = new ProviderEngine();

let kovanProvider;
let rinkebyProvider;
let ropstenProvider;

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
github 0xProject / 0x-monorepo / contracts / test-utils / src / profiler.ts View on Github external
_getProfilerSubprovider(): ProfilerSubprovider {
        const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS;
        const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter();
        const isVerbose = true;
        const subprovider = new ProfilerSubprovider(solCompilerArtifactAdapter, defaultFromAddress, isVerbose);
        return subprovider;
    },
};
github 0xProject / dev-tools-truffle-example / truffle-config.js View on Github external
const { TruffleArtifactAdapter } = require("@0x/sol-trace");
const { ProfilerSubprovider } = require("@0x/sol-profiler");
const { CoverageSubprovider } = require("@0x/sol-coverage");
const { RevertTraceSubprovider } = require("@0x/sol-trace");

const mode = process.env.MODE;

const projectRoot = "";
const solcVersion = "0.5.0";
const defaultFromAddress = "0x5409ed021d9299bf6814279a6a1411a7e866a631";
const isVerbose = true;
const artifactAdapter = new TruffleArtifactAdapter(projectRoot, solcVersion);
const provider = new ProviderEngine();

if (mode === "profile") {
  global.profilerSubprovider = new ProfilerSubprovider(
    artifactAdapter,
    defaultFromAddress,
    isVerbose
  );
  global.profilerSubprovider.stop();
  provider.addProvider(global.profilerSubprovider);
  provider.addProvider(new WebsocketSubprovider({ rpcUrl: "http://localhost:8545" }));
} else {
  if (mode === "coverage") {
    global.coverageSubprovider = new CoverageSubprovider(
      artifactAdapter,
      defaultFromAddress,
      {
        isVerbose,
      }
    );
github AztecProtocol / AZTEC / packages / protocol / truffle-config.js View on Github external
const coverageSubproviderConfig = {
    isVerbose,
    ignoreFilesGlobs: ['**/Migrations.sol', '**/node_modules/**', '**/interfaces/**', '**/test/**'],
};
const artifactAdapter = new TruffleArtifactAdapter(projectRoot, compilerConfig.solcVersion);
const engine = new ProviderEngine();

let defaultFromAddress;
const testModes = ['profile', 'coverage', 'trace'];
if (testModes.includes(process.env.MODE)) {
    defaultFromAddress = getFirstAddress();
}

switch (process.env.MODE) {
    case 'profile':
        global.profilerSubprovider = new ProfilerSubprovider(artifactAdapter, defaultFromAddress, isVerbose);
        engine.addProvider(global.profilerSubprovider);
        break;
    case 'coverage':
        global.coverageSubprovider = new CoverageSubprovider(artifactAdapter, defaultFromAddress, coverageSubproviderConfig);
        engine.addProvider(global.coverageSubprovider);
        break;
    case 'trace':
        engine.addProvider(new RevertTraceSubprovider(artifactAdapter, defaultFromAddress, isVerbose));
        break;
    default:
        rinkebyProvider = createProvider('rinkeby');
        mainnetProvider = createProvider('mainnet');
        ropstenProvider = createProvider('ropsten');
        break;
}

@0x/sol-profiler

Generate profiler reports for Solidity code

Apache-2.0
Latest version published 2 years ago

Package Health Score

58 / 100
Full package analysis

Similar packages