diff --git a/src/main/java/org/bdware/sc/compiler/YJSCompiler.java b/src/main/java/org/bdware/sc/compiler/YJSCompiler.java index 42d5357..a7daebd 100644 --- a/src/main/java/org/bdware/sc/compiler/YJSCompiler.java +++ b/src/main/java/org/bdware/sc/compiler/YJSCompiler.java @@ -120,7 +120,7 @@ public class YJSCompiler { // 如果没有就不限制,根据gas进行插装 if (0L != cm.getInsnLimit()) { - System.out.println("++++++++++++++++++++++true"); + LOGGER.info("++++++++++++++++++++++true"); } czb.setManifest(cm); Set toParse = new HashSet<>(); @@ -162,6 +162,15 @@ public class YJSCompiler { preSubConName + ".yjs"); czb.put(preSubConName + ".yjs", preSubNode); LOGGER.info("--compile-- " + preSubConName); + + String setGlobalName = cm.main.substring(0, cm.main.length() - 4) + "SetGlobal"; + String setGlobalContract = + "contract " + setGlobalName + "{ function setGlobal (_global) { Global = _global; }}"; + czb.put(setGlobalName + ".yjs", + compile(new ByteArrayInputStream(setGlobalContract.getBytes(StandardCharsets.UTF_8)), + setGlobalName + ".yjs")); + LOGGER.info("--compile-- " + setGlobalName); + return czb; }