Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
settings: {
outputSelection: {
"*": {
"*": [
"abi",
"evm.bytecode.object",
"evm.bytecode.sourceMap",
"evm.deployedBytecode.object",
"evm.deployedBytecode.sourceMap"
]
}
}
}
});
var solcOut = JSON.parse(solc.compileStandard(solcIn));
// contracts now grouped by solidity source file
var rawA = solcOut.contracts["A.sol"].A;
var A = Schema.normalize(rawA);
var expected = {
abi: rawA.abi,
bytecode: "0x" + rawA.evm.bytecode.object,
deployedBytecode: "0x" + rawA.evm.deployedBytecode.object,
sourceMap: rawA.evm.bytecode.sourceMap,
deployedSourceMap: rawA.evm.deployedBytecode.sourceMap
};
Object.keys(expected).forEach(function (key) {
var expectedValue = expected[key];
function invokeCompiler(input) {
if (useLocalSolc) {
var result = child_process.spawnSync('solc', ['--optimize', '--standard-json', '-'], {input: input, encoding: 'utf-8'})
if (result.status != 0) {
console.log("Error invoking compiler:".red)
console.log(result.output[2])
}
return result.output[1]
} else {
return require('solc').compileStandard(input)
}
}
it("Complex ABI should be out of source order when solc compiles it", function(){
var alphabetic = ['andThird', 'second', 'theFirst', 'LogB', 'LogA', 'LogD', 'LogC'];
var input = {
language: "Solidity",
sources: { "ComplexOrdered.sol": { content: complexOrderedSource },
"InheritB.sol": { content: inheritedSource },},
settings: { outputSelection: { "*": { "*": ["abi"] } } }
};
var result = solc.compileStandard(JSON.stringify(input));
result = JSON.parse(result);
var abi = result.contracts["ComplexOrdered.sol"]["ComplexOrdered"].abi.map(function(item){
return item.name;
});
assert.deepEqual(abi, alphabetic);
});