Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"**/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
_getProfilerSubprovider(): ProfilerSubprovider {
const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS;
const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter();
const isVerbose = true;
const subprovider = new ProfilerSubprovider(solCompilerArtifactAdapter, defaultFromAddress, isVerbose);
return subprovider;
},
};
_getProfilerSubprovider(): ProfilerSubprovider {
const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS;
const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter();
const isVerbose = true;
const subprovider = new ProfilerSubprovider(solCompilerArtifactAdapter, defaultFromAddress, isVerbose);
return subprovider;
},
};
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,
}
);
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;
}