Skip to content

Commit

Permalink
Updated CLI solc to versin 0.7.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Sep 23, 2020
1 parent c4de88a commit 4306b35
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/cli/src.ts/solc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] }`);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/tests/contracts/test-solc/consumer.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.7.1;

import "./libraries/lib.sol";

Expand Down
2 changes: 1 addition & 1 deletion packages/tests/contracts/test-solc/libraries/lib.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.7.1;

library Lib {
function f() internal returns (uint) {
Expand Down
17 changes: 11 additions & 6 deletions packages/tests/src.ts/test-solc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});

});

0 comments on commit 4306b35

Please sign in to comment.