Updated CLI solc to versin 0.7.1.

This commit is contained in:
Richard Moore 2020-09-23 00:00:21 -04:00
parent c4de88af6f
commit 4306b3563a
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
4 changed files with 15 additions and 10 deletions

View File

@ -68,8 +68,8 @@ function _compile(_solc: any, source: string, options?: CompilerOptions): Array<
if (!ver || ver[1] !== "0") { throw new Error("unknown version"); }
const version = parseFloat(ver[2] + "." + ver[3]);
//if (version < 4.11 || version >= 7) {
if (version < 5.0 || version >= 7.0) {
//if (version < 4.11 || version >= 8) {
if (version < 5.0 || version >= 8.0) {
throw new Error(`unsupported version: ${ ver[1] }.${ ver[2] }.${ ver[3] }`);
}

View File

@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.7.1;
import "./libraries/lib.sol";

View File

@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.7.1;
library Lib {
function f() internal returns (uint) {

View File

@ -11,12 +11,17 @@ describe('Test solc', function () {
this.timeout(1200000);
const filename = resolve(__dirname, '../contracts/test-solc/consumer.sol');
const source = fs.readFileSync(filename).toString();
const code = solc.compile(source, { filename, optimize: true })
.filter(((contract: any) => contract.name === 'Consumer'))[0];
const { bytecode, interface: iface } = code;
assert(bytecode.length > 2, 'The bytecode should should have a length');
assert(bytecode.startsWith('0x'), 'The bytecode should start with 0x');
assert(iface.functions['f()'], 'The interface should have function f()');
try {
const code = solc.compile(source, { filename, optimize: true })
.filter(((contract: any) => contract.name === 'Consumer'))[0];
const { bytecode, interface: iface } = code;
assert(bytecode.length > 2, 'The bytecode should should have a length');
assert(bytecode.startsWith('0x'), 'The bytecode should start with 0x');
assert(iface.functions['f()'], 'The interface should have function f()');
} catch (error) {
console.log(error);
throw error;
}
});
});