Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('loadCompier without solcVersion', async () => {
const solcLoaded = await loadCompiler(requiredInputs);
expect(solcLoaded.version()).to.equal(solc.version());
});
});
function requiresDifferentCompiler(solcVersion) {
const currentVersion = solc.version();
const current = currentVersion.split('+')[0].split('.');
const wanted = solcVersion.split('.');
if(current[0] !== wanted[0]) return true;
if(current[1] !== wanted[1]) return true;
if(parseInt(wanted[2], 10) > parseInt(current[2], 10)) return true;
return false;
}
async function main() {
myLog(0, 1, "solc version: " + solc.version());
switch (network){
case 'm':
rpcUrl = mainnetUrl;
break;
case 'k':
rpcUrl = kovanPublicNode;
break;
case 'r':
rpcUrl = ropstenPublicNode;
break;
default: {
myLog(1, 0, "error: invalid network parameter, choose: m / r / k");
}
}
process.on('message', async(m) => {
if (m.command === 'compile') {
try {
const input = m.payload;
const installedSlocVersion = 'v' + Solc.version();
const requiredSolcVersion = m.version;
if(installedSlocVersion.includes(requiredSolcVersion)) {
const output = await Solc.compileStandardWrapper(JSON.stringify(input));
process.send({ compiled: output });
} else {
Solc.loadRemoteVersion(requiredSolcVersion, async(err, solcSnapshot) => {
if (err) {
process.send({ error: err });
} else {
const output = await solcSnapshot.compile(JSON.stringify(input));
process.send({ compiled: output });
}
});
}
} catch (e) {