diff --git a/src/main/java/console/common/ConsoleUtils.java b/src/main/java/console/common/ConsoleUtils.java index a2eea709..6ed682b7 100644 --- a/src/main/java/console/common/ConsoleUtils.java +++ b/src/main/java/console/common/ConsoleUtils.java @@ -860,7 +860,7 @@ public static void main(String[] args) { String LIBS_OPTION = "libraries"; String SOL_VERSION_OPTION = "sol-version"; - Version DEFAULT_SOL_VERSION = Version.V0_8_26; + Version DEFAULT_SOL_VERSION = Version.V0_8_11; String BIN_OPTION = "bin"; String SM_BIN_OPTION = "sm-bin"; diff --git a/src/main/java/console/contract/ConsoleContractImpl.java b/src/main/java/console/contract/ConsoleContractImpl.java index ffce0b1d..c8176932 100644 --- a/src/main/java/console/contract/ConsoleContractImpl.java +++ b/src/main/java/console/contract/ConsoleContractImpl.java @@ -247,7 +247,18 @@ public TransactionResponse deploySolidity( throws ConsoleMessageException { try { boolean isContractParallelAnalysis = false; - Version version = Version.V0_8_26; + Version version = Version.V0_8_11; + try { + String flag = + client.getSystemConfigByKey("feature_evm_cancun") + .getSystemConfig() + .getValue(); + if (Integer.parseInt(flag) == 1) { + version = Version.V0_8_26; + } + } catch (Exception e) { + version = Version.V0_8_11; + } if (!inputParams.isEmpty()) { int lastIndexOf = inputParams.lastIndexOf("-p"); if (lastIndexOf != -1) { @@ -1077,10 +1088,20 @@ private String getSolidityAbi(String contractFileName) throws Exception { List defaultOptions = Arrays.asList(ABI, BIN, METADATA); List options = new ArrayList<>(defaultOptions); + Version version = Version.V0_8_11; + try { + String flag = + client.getSystemConfigByKey("feature_evm_cancun").getSystemConfig().getValue(); + if (Integer.parseInt(flag) == 1) { + version = Version.V0_8_26; + } + } catch (Exception e) { + version = Version.V0_8_11; + } logger.debug( "compileSolToBinAndAbi, solc version:{} ,basePath: {}", - Version.V0_8_26, + version, solFile.getParentFile().getCanonicalPath()); SolidityCompiler.Option basePath = new SolidityCompiler.CustomOption( @@ -1093,7 +1114,7 @@ private String getSolidityAbi(String contractFileName) throws Exception { solFile, (client.getCryptoType() == CryptoType.SM_TYPE), true, - Version.V0_8_26, + version, options.toArray(new SolidityCompiler.Option[0])); if (logger.isDebugEnabled()) { diff --git a/src/main/resources/contract/solidity/HelloWorld.sol b/src/main/resources/contract/solidity/HelloWorld.sol index 1b429432..7f501618 100644 --- a/src/main/resources/contract/solidity/HelloWorld.sol +++ b/src/main/resources/contract/solidity/HelloWorld.sol @@ -1,4 +1,3 @@ -pragma solidity >=0.6.10 <=0.8.26; contract HelloWorld { string name;