Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const prepareCoverage = async (workingDirectory, port, ignoreFiles) => {
let artifactAdapter = new SolCompilerArtifactAdapter(artifacts, workingDirectory);
let coverageSubproviderConfig = {
isVerbose,
ignoreFilesGlobs: ['**/node_modules/**']
}
if (ignoreFiles) {
ignoreFiles = ignoreFiles.split(',')
ignoreFiles = ignoreFiles.map(file => "**/" + file)
coverageSubproviderConfig.ignoreFilesGlobs = coverageSubproviderConfig.ignoreFilesGlobs.concat(ignoreFiles)
}
global.coverageSubprovider = new CoverageSubprovider(
artifactAdapter,
defaultFromAddress,
coverageSubproviderConfig
);
provider.addProvider(global.coverageSubprovider);
provider.addProvider(new RpcProvider({ rpcUrl: `http://localhost:${port}` }));
global.provider = provider;
// start pulling blocks
provider.start();
return provider
}
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(
new WebsocketSubprovider({
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
// required by the 0x tools
kovanProvider = createProvider("kovan");
rinkebyProvider = createProvider("rinkeby");
ropstenProvider = createProvider("ropsten");
break;
it('Should set the right localNodeProvider if the deployer is runned from coverage command', () => {
const provider = new ProviderEngine();
global.coverageSubprovider = new CoverageSubprovider();
provider.addProvider(global.coverageSubprovider);
provider.addProvider(new RpcProvider({ rpcUrl: `http://localhost:${config.alternativePort}` }));
global.provider = provider;
const deployer = new etherlime.JSONRPCPrivateKeyDeployer(config.randomPrivateKey, config.alternativeNodeUrl, defaultConfigs);
assert.deepEqual(global.provider._providers[1].rpcUrl, config.alternativeNodeUrl, "The stored provider url does not match the inputted one");
assert.deepEqual(global.provider._providers[1].rpcUrl, deployer.provider.connection.url, "The stored connection url does not match the inputted one");
})
it('Should set the right localNodeProvider if the deployer is runned from coverage command', () => {
const provider = new ProviderEngine();
global.coverageSubprovider = new CoverageSubprovider();
provider.addProvider(global.coverageSubprovider);
provider.addProvider(new RpcProvider({ rpcUrl: `http://localhost:${config.alternativePort}` }));
global.provider = provider;
const deployer = new etherlime.JSONRPCPrivateKeyDeployer(config.randomPrivateKey, config.alternativeNodeUrl, defaultConfigs);
assert.deepEqual(global.provider._providers[1].rpcUrl, config.alternativeNodeUrl, "The stored provider url does not match the inputted one");
assert.deepEqual(global.provider._providers[1].rpcUrl, deployer.provider.connection.url, "The stored connection url does not match the inputted one");
})
const prepareCoverage = async (workingDirectory, port, ignoreFiles) => {
let artifactAdapter = new SolCompilerArtifactAdapter(artifacts, workingDirectory);
let coverageSubproviderConfig = {
isVerbose,
ignoreFilesGlobs: ['**/node_modules/**']
}
if (ignoreFiles) {
ignoreFiles = ignoreFiles.split(',')
ignoreFiles = ignoreFiles.map(file => "**/" + file)
coverageSubproviderConfig.ignoreFilesGlobs = coverageSubproviderConfig.ignoreFilesGlobs.concat(ignoreFiles)
}
global.coverageSubprovider = new CoverageSubprovider(
artifactAdapter,
defaultFromAddress,
coverageSubproviderConfig
);
_getCoverageSubprovider(): CoverageSubprovider {
const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS;
const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter();
const isVerbose = true;
const subprovider = new CoverageSubprovider(solCompilerArtifactAdapter, defaultFromAddress, isVerbose);
return subprovider;
},
};
reporter: 'eth-gas-reporter',
reporterOptions: {
currency: 'USD',
gasPrice: 1
}
}
: {}
const projectRoot = ''
const solcVersion = '0.4.24'
const defaultFromAddress = '0x5409ed021d9299bf6814279a6a1411a7e866a631'
const isVerbose = true
const artifactAdapter = new TruffleArtifactAdapter(projectRoot, solcVersion)
const provider = new Web3ProviderEngine()
if (process.env.SOLIDITY_COVERAGE === 'true') {
global.coverageSubprovider = new CoverageSubprovider(artifactAdapter, defaultFromAddress, {
isVerbose,
ignoreFilesGlobs: ['**/Migrations.sol', '**/node_modules/**', '**/mocks/**', '**/interfaces/**']
})
provider.addProvider(global.coverageSubprovider)
const ganacheSubprovider = new GanacheSubprovider({
default_balance_ether: '1000000000000000000000000',
total_accounts: 10,
port: 8545
})
provider.addProvider(ganacheSubprovider)
provider.start(err => {
if (err !== undefined) {
process.exit(1)
}
})
provider.send = provider.sendAsync.bind(provider)
process.env.GASREPORT === 'true'
? {
reporter: 'eth-gas-reporter',
reporterOptions: {
currency: 'USD',
gasPrice: 1
}
}
: {}
const projectRoot = ''
const solcVersion = '0.4.24'
const defaultFromAddress = '0x5409ed021d9299bf6814279a6a1411a7e866a631'
const isVerbose = true
const artifactAdapter = new TruffleArtifactAdapter(projectRoot, solcVersion)
const provider = new Web3ProviderEngine()
if (process.env.SOLIDITY_COVERAGE === 'true') {
global.coverageSubprovider = new CoverageSubprovider(artifactAdapter, defaultFromAddress, {
isVerbose,
ignoreFilesGlobs: ['**/Migrations.sol', '**/node_modules/**', '**/mocks/**', '**/interfaces/**']
})
provider.addProvider(global.coverageSubprovider)
const ganacheSubprovider = new GanacheSubprovider({
default_balance_ether: '1000000000000000000000000',
total_accounts: 10,
port: 8545
})
provider.addProvider(ganacheSubprovider)
provider.start(err => {
if (err !== undefined) {
process.exit(1)
}
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,
}
);
provider.addProvider(global.coverageSubprovider);
} else if (mode === "trace") {
const revertTraceSubprovider = new RevertTraceSubprovider(
artifactAdapter,
defaultFromAddress,
isVerbose
);
provider.addProvider(revertTraceSubprovider);
}