From 18223c419803aa18066636f075c4aad7d106cab1 Mon Sep 17 00:00:00 2001 From: Georgiy Komarov Date: Wed, 23 Oct 2024 22:17:38 -0400 Subject: [PATCH] feat(driver): Leverage `ImportGraph` to resolve entry points (#194) * feat(driver): Leverage ImportGraph to resolve entry points Closes #57 * fix: Paths * chore: Update changelog * fix: API uses in tests, paths * fix(tests): Remove actual outputs from git --- .gitignore | 12 +- CHANGELOG.md | 1 + .../implicit-init/test/implicitInit.spec.ts | 2 +- src/cli/cli.ts | 4 +- src/cli/driver.ts | 186 ++-- src/cli/index.ts | 1 - src/cli/path.ts | 60 -- src/cli/singleContract.ts | 207 ---- src/internals/context.ts | 31 +- src/internals/ir/builders/imports.ts | 36 +- src/internals/ir/builders/ir.ts | 29 +- src/internals/ir/imports.ts | 39 + src/internals/ir/types.ts | 2 +- src/internals/tact/config.ts | 156 ++- src/internals/tact/index.ts | 1 + src/internals/tact/parser.ts | 37 + src/internals/warnings.ts | 7 +- src/tools/dumpImports.ts | 3 +- test/all/sample-jetton.cfg.dot | 141 --- test/all/sample-jetton.cfg.json | 885 ------------------ test/all/sample-jetton.cfg.mmd | 128 --- test/all/sample-jetton.expected.cfg.dot | 230 ++--- test/all/sample-jetton.expected.cfg.json | 134 +-- test/all/sample-jetton.expected.cfg.mmd | 212 ++--- test/all/sample-jetton.imports.dot | 4 - test/all/sample-jetton.imports.json | 17 - test/all/sample-jetton.imports.mmd | 4 - test/all/syntax.cfg.dot | 63 -- test/all/syntax.cfg.json | 377 -------- test/all/syntax.cfg.mmd | 55 -- test/all/syntax.imports.dot | 4 - test/all/syntax.imports.json | 15 - test/all/syntax.imports.mmd | 4 - test/cli.spec.ts | 4 +- 34 files changed, 622 insertions(+), 2469 deletions(-) delete mode 100644 src/cli/path.ts delete mode 100644 src/cli/singleContract.ts create mode 100644 src/internals/tact/parser.ts delete mode 100644 test/all/sample-jetton.cfg.dot delete mode 100644 test/all/sample-jetton.cfg.json delete mode 100644 test/all/sample-jetton.cfg.mmd delete mode 100644 test/all/sample-jetton.imports.dot delete mode 100644 test/all/sample-jetton.imports.json delete mode 100644 test/all/sample-jetton.imports.mmd delete mode 100644 test/all/syntax.cfg.dot delete mode 100644 test/all/syntax.cfg.json delete mode 100644 test/all/syntax.cfg.mmd delete mode 100644 test/all/syntax.imports.dot delete mode 100644 test/all/syntax.imports.json delete mode 100644 test/all/syntax.imports.mmd diff --git a/.gitignore b/.gitignore index 6d9b215f..b646c83c 100644 --- a/.gitignore +++ b/.gitignore @@ -138,12 +138,12 @@ test/all/**/*.dot test/all/**/*.mmd test/all/**/*.actual.out test/detectors/**/*.actual.out -!test/all/**/*.cfg.json -!test/all/**/*.cfg.dot -!test/all/**/*.cfg.mmd -!test/all/**/*.imports.json -!test/all/**/*.imports.dot -!test/all/**/*.imports.mmd +!test/all/**/*.expected.cfg.json +!test/all/**/*.expected.cfg.dot +!test/all/**/*.expected.cfg.mmd +!test/all/**/*.expected.imports.json +!test/all/**/*.expected.imports.dot +!test/all/**/*.expected.imports.mmd # Generated code src/version-info.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index e1430e97..97ccd0c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `UnusedExpressionResult` detector: PR [#190](https://github.com/nowarp/misti/pull/190) - `--list-detectors` CLI option: PR [#192](https://github.com/nowarp/misti/pull/192) - Import Graph: PR [#180](https://github.com/nowarp/misti/pull/180) +- Leverage `ImportGraph` to resolve entry points: PR [#194](https://github.com/nowarp/misti/pull/194) ### Changed - Improved and optimized the test suite: PR [#184](https://github.com/nowarp/misti/pull/184) diff --git a/examples/implicit-init/test/implicitInit.spec.ts b/examples/implicit-init/test/implicitInit.spec.ts index 14d6ab02..3ed9aad9 100644 --- a/examples/implicit-init/test/implicitInit.spec.ts +++ b/examples/implicit-init/test/implicitInit.spec.ts @@ -9,7 +9,7 @@ describe("ImplicitInit Detector Tests", () => { "tactConfig.json", ); const config = path.resolve(__dirname, "project", "mistiConfig.json"); - const driver = await Driver.create(tactConfigPath, { config }); + const driver = await Driver.create([tactConfigPath], { config }); expect(driver.detectors.length).toBe(1); expect(driver.detectors[0].id).toBe("ImplicitInit"); diff --git a/src/cli/cli.ts b/src/cli/cli.ts index bdd2ae79..33b9f5bb 100644 --- a/src/cli/cli.ts +++ b/src/cli/cli.ts @@ -24,7 +24,7 @@ export function createMistiCommand(): Command { .name("misti") .description("TON Static Analyzer") .version(`Misti ${MISTI_VERSION}\nSupported Tact version: ${TACT_VERSION}`) - .arguments("[TACT_CONFIG_PATH|TACT_FILE_PATH]"); + .arguments("[paths...]"); cliOptions.forEach((option) => command.addOption(option)); command.action(async (_tactPath, options) => { const logger = new Logger(); @@ -56,7 +56,7 @@ export async function runMistiCommand( command: Command = createMistiCommand(), ): Promise<[Driver, MistiResult]> { await command.parseAsync(args, { from: "user" }); - const driver = await Driver.create(command.args[0], command.opts()); + const driver = await Driver.create(command.args, command.opts()); const result = await driver.execute(); return [driver, result]; } diff --git a/src/cli/driver.ts b/src/cli/driver.ts index 7d788a32..f270c0ab 100644 --- a/src/cli/driver.ts +++ b/src/cli/driver.ts @@ -1,19 +1,14 @@ import { CLIOptions, cliOptionDefaults } from "./options"; -import { MistiTactPath } from "./path"; -import { - MistiResult, - ToolOutput, - MistiResultTool, - WarningOutput, -} from "./result"; -import { SingleContractProjectManager } from "./singleContract"; +import { MistiResult, ToolOutput, WarningOutput } from "./result"; import { OutputFormat } from "./types"; import { Detector, findBuiltInDetector } from "../detectors/detector"; import { MistiContext } from "../internals/context"; import { ExecutionException, InternalException } from "../internals/exceptions"; -import { CompilationUnit, ProjectName } from "../internals/ir"; +import { CompilationUnit, ImportGraph, ProjectName } from "../internals/ir"; import { createIR } from "../internals/ir/builders/"; +import { ImportGraphBuilder } from "../internals/ir/builders/imports"; import { Logger } from "../internals/logger"; +import { TactConfigManager, parseTactProject } from "../internals/tact"; import { unreachable } from "../internals/util"; import { MistiTactWarning, @@ -35,38 +30,18 @@ export class Driver { outputPath: string; disabledDetectors: Set; colorizeOutput: boolean; - tactConfigPath: string | undefined; + /** + * Compilation units representing the actual entrypoints of the analysis targets + * based on user's input. Might be empty if no paths are specified. + */ + cus: Map; /** Minimum severity level to report warnings. */ minSeverity: Severity; outputFormat: OutputFormat; - singleContractProjectManager: SingleContractProjectManager | undefined; - private constructor(tactPath: string | undefined, options: CLIOptions) { - let mistiTactPath: MistiTactPath | undefined; - if (tactPath) { - const singleContract = tactPath.endsWith(".tact"); - if (!fs.existsSync(tactPath)) { - throw ExecutionException.make( - `${singleContract ? "Contract" : "Project"} ${tactPath} is not available.`, - ); - } - if (singleContract) { - this.singleContractProjectManager = - SingleContractProjectManager.fromContractPath(tactPath); - this.tactConfigPath = - this.singleContractProjectManager.createTempProjectDir(); - mistiTactPath = { - kind: "contract", - tempConfigPath: path.resolve(this.tactConfigPath), - originalPath: path.resolve(tactPath), - }; - } else { - // Tact supports absolute paths only - this.tactConfigPath = path.resolve(tactPath); - mistiTactPath = { kind: "config", path: path.resolve(tactPath) }; - } - } - this.ctx = new MistiContext(mistiTactPath, options); + private constructor(tactPaths: string[], options: CLIOptions) { + this.ctx = new MistiContext(options); + this.cus = this.createCUs(tactPaths); this.disabledDetectors = new Set(options.disabledDetectors ?? []); this.colorizeOutput = options.colors; this.minSeverity = options.minSeverity; @@ -79,12 +54,12 @@ export class Driver { * @param tactPath Path to the Tact project configuration of to a single Tact contract. */ public static async create( - tactPath: string | undefined, + tactPaths: string[], options: Partial = {}, ): Promise { const mergedOptions: CLIOptions = { ...cliOptionDefaults, ...options }; this.checkCLIOptions(mergedOptions); - const driver = new Driver(tactPath, mergedOptions); + const driver = new Driver(tactPaths, mergedOptions); await driver.initializeDetectors(); await driver.initializeTools(); if (!driver.ctx.souffleAvailable) { @@ -93,6 +68,73 @@ export class Driver { return driver; } + /** + * Resolves the filepaths provided as an input to Misti to initialize the + * compilation units which are IR entries to target analysis on. + * + * @param tactPaths Paths received from the user. + * @returns Created compilation units. + */ + private createCUs(tactPaths: string[]): Map { + return [...new Set(tactPaths)] + .filter( + (tactPath) => + fs.existsSync(tactPath) || + (this.ctx.logger.error(`${tactPath} is not available`), false), + ) + .reduce((acc, tactPath) => { + // TODO: Check on the available import graphs if some of the inputs are already added + let importGraph: ImportGraph; + let configManager: TactConfigManager; + if (tactPath.endsWith(".tact")) { + importGraph = ImportGraphBuilder.make(this.ctx, [tactPath]).build(); + let projectRoot = importGraph.resolveProjectRoot(); + if (projectRoot === undefined) { + projectRoot = path.dirname(tactPath); + this.ctx.logger.warn( + `Cannot resolve project path. Trying ${projectRoot}`, + ); + } + const projectName = path.basename(tactPath, ".tact") as ProjectName; + // TODO: Try to merge them into one of the existing configs. + configManager = TactConfigManager.fromContract( + projectRoot, + tactPath, + projectName, + ); + const projectConfig = configManager.findProjectByName(projectName); + if (projectConfig === undefined) { + throw InternalException.make( + [ + `Cannot find ${projectName} in the configuration file generated for ${tactPath}:`, + JSON.stringify(configManager.getConfig, null, 2), + ].join("\n"), + ); + } + const ast = parseTactProject(this.ctx, projectConfig, projectRoot); + const cu = createIR(this.ctx, projectName, ast, importGraph); + acc.set(projectName, cu); + } else { + configManager = TactConfigManager.fromConfig(tactPath); + importGraph = ImportGraphBuilder.make( + this.ctx, + configManager.getEntryPoints(), + ).build(); + configManager.getProjects().forEach((configProject) => { + const ast = parseTactProject( + this.ctx, + configProject, + configManager.getProjectRoot(), + ); + const projectName = configProject.name as ProjectName; + const cu = createIR(this.ctx, projectName, ast, importGraph); + acc.set(projectName, cu); + }); + } + return acc; + }, new Map()); + } + /** * Check CLI options for ambiguities. * @throws If Misti cannot be executed with the given options @@ -245,8 +287,19 @@ export class Driver { * Entry point of code analysis and tools execution. */ public async execute(): Promise { + if (this.cus.size === 0) { + return { kind: "ok" }; + } + if (this.detectors.length === 0 && this.tools.length === 0) { + this.ctx.logger.warn( + "Nothing to execute. Please specify at least one detector or tool.", + ); + return { kind: "ok" }; + } try { - return await this.executeImpl(); + return this.tools.length > 0 + ? await this.executeTools() + : await this.executeAnalysis(); } catch (err) { const result = [] as string[]; if (err instanceof Error) { @@ -263,54 +316,16 @@ export class Driver { } } - /** - * Executes checks on all compilation units and reports found warnings sorted by severity. - */ - private async executeImpl(): Promise | never { - try { - if (!this.tactConfigPath) { - throw ExecutionException.make( - "Please specify a path to a Tact project or Tact contract", - ); - } - const cus: Map = createIR( - this.ctx, - this.tactConfigPath, - ); - if (this.detectors.length === 0 && this.tools.length === 0) { - this.ctx.logger.warn( - "Nothing to execute. Please specify at least one detector or tool.", - ); - return { kind: "ok" }; - } - const result = - this.tools.length > 0 - ? await this.executeTools(cus) - : await this.executeAnalysis(cus); - return result; - } finally { - if (this.singleContractProjectManager) { - try { - this.singleContractProjectManager.cleanup(); - } catch (error) { - throw error; - } - } - } - } - /** * Executes all the initialized detectors on the compilation units. * @param cus Map of compilation units * @returns MistiResult containing detectors output */ - private async executeAnalysis( - cus: Map, - ): Promise { + private async executeAnalysis(): Promise { const allWarnings = await (async () => { const warningsMap = new Map(); await Promise.all( - Array.from(cus.entries()).map(async ([projectName, cu]) => { + Array.from(this.cus.entries()).map(async ([projectName, cu]) => { const warnings = await this.checkCU(cu); warningsMap.set(projectName, warnings); }), @@ -318,7 +333,7 @@ export class Driver { return warningsMap; })(); const filteredWarnings: Map = - this.filterImportedWarnings(Array.from(cus.keys()), allWarnings); + this.filterImportedWarnings(Array.from(this.cus.keys()), allWarnings); this.filterSuppressedWarnings(filteredWarnings); const reported = new Set(); const warningsOutput: WarningOutput[] = []; @@ -358,14 +373,11 @@ export class Driver { /** * Executes all the initialized tools on the compilation units. - * @param cus Map of compilation units * @returns MistiResult containing tool outputs */ - private async executeTools( - cus: Map, - ): Promise { + private async executeTools(): Promise { const toolOutputs = await Promise.all( - Array.from(cus.values()).flatMap((cu) => + Array.from(this.cus.values()).flatMap((cu) => this.tools.map((tool) => { try { return tool.run(cu); @@ -432,7 +444,7 @@ export class Driver { if ( new Set(allProjectNames).size === new Set(projects).size && [...new Set(allProjectNames)].every((value) => - new Set(projects).has(value), + new Set(projects).has(value as ProjectName), ) ) { projectWarnings.push(warn); diff --git a/src/cli/index.ts b/src/cli/index.ts index acca1768..3b70d23c 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -2,5 +2,4 @@ export * from "./driver"; export * from "./result"; export * from "./types"; export * from "./options"; -export * from "./path"; export * from "./cli"; diff --git a/src/cli/path.ts b/src/cli/path.ts deleted file mode 100644 index a49ebb29..00000000 --- a/src/cli/path.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { unreachable } from "../internals/util"; -import path from "path"; - -/** - * Path to a Tact contract or configuration provided by the user. - */ -export type MistiTactPath = - | { - kind: "config"; - /** - * Absolute path to the tact.config.json. - */ - path: string; - } - | { - kind: "contract"; - /** - * A path to a temporary configuration file generated internally in Misti (absolute). - */ - tempConfigPath: string; - /** - * A path to the contract as it was specified by the user (absolute). - */ - originalPath: string; - }; - -/** - * Returns path to a contract or configuration file as it is provided by the user. - */ -export function getOriginalPath(path: MistiTactPath): string { - switch (path.kind) { - case "config": - return path.path; - case "contract": - return path.originalPath; - default: - unreachable(path); - } -} - -/** - * Returns an actual path to a configuration file used in Misti. - */ -export function getActualPath(path: MistiTactPath): string { - switch (path.kind) { - case "config": - return path.path; - case "contract": - return path.tempConfigPath; - default: - unreachable(path); - } -} - -/** - * Returns an absolute path to an actual project directory used by Misti. - */ -export function getProjectDirectory(tactPath: MistiTactPath): string { - return path.dirname(getActualPath(tactPath)); -} diff --git a/src/cli/singleContract.ts b/src/cli/singleContract.ts deleted file mode 100644 index 6b606ed7..00000000 --- a/src/cli/singleContract.ts +++ /dev/null @@ -1,207 +0,0 @@ -import { ExecutionException, tryMsg } from "../internals/exceptions"; -import fs from "fs"; -import os from "os"; -import path from "path"; - -/** - * Encapsulates logic of handling single Tact contracts without user-defined configuration. - */ -export class SingleContractProjectManager { - /** - * Path to the created temporary directory. - */ - private tempDirPath: string; - - private constructor(private contractPath: string) { - this.tempDirPath = this.createTempDir(); - } - - static fromContractPath(contractPath: string): SingleContractProjectManager { - return new SingleContractProjectManager(contractPath); - } - - /** - * Cleans up the created temporary directory structure. - * This method should be called after using this class. - */ - public cleanup(): void { - try { - if (fs.existsSync(this.tempDirPath)) { - fs.rmSync(this.tempDirPath, { recursive: true, force: true }); - } - } catch (_) {} - } - - /** - * Creates a temporary project directory containing the Tact configuration file and contract. - * @param copyAll If true, copies all .tact and .fc files to the temporary directory; - * otherwise, copies only the main contract file. - * @returns Path to the created Tact project configuration. - */ - public createTempProjectDir(copyAll = true): string { - const contractDir = path.dirname(this.contractPath); - const contractName = this.extractContractName(); - const rootDir = this.findRootDir(contractDir); - - let relativeContractPath: string; - - if (rootDir) { - this.copyContractFiles(copyAll, this.contractPath, rootDir); - relativeContractPath = path.join( - "./", - path.relative(rootDir, this.contractPath), - ); - } else { - this.copyContractFiles(copyAll, this.contractPath, null); - relativeContractPath = `./${path.basename(this.contractPath)}`; - } - - const configPath = path.join(this.tempDirPath, "tact.config.json"); - this.createConfig(configPath, relativeContractPath, contractName); - - return configPath; - } - - /** - * Copies contract files to the temporary directory. - * @param copyAll If true, copies all .tact and .fc files; otherwise, copies only the main contract file. - * @param srcPath Path to the source contract file. - * @param rootDir Root directory containing .git or node_modules, or null if not found. - */ - private copyContractFiles( - copyAll: boolean, - srcPath: string, - rootDir: string | null, - ): void { - if (copyAll) { - const sourceDir = rootDir || path.dirname(srcPath); - this.copyFiles(sourceDir, sourceDir); - } else { - let destPath: string; - if (rootDir) { - const relativePath = path.relative(rootDir, srcPath); - destPath = path.join(this.tempDirPath, relativePath); - const destDirPath = path.dirname(destPath); - if (!fs.existsSync(destDirPath)) { - fs.mkdirSync(destDirPath, { recursive: true }); - } - } else { - destPath = path.join(this.tempDirPath, path.basename(srcPath)); - } - fs.copyFileSync(srcPath, destPath); - } - } - - /** - * Recursively copies .tact and .fc files from the source directory to the temporary - * directory, preserving directory structure relative to the root directory. - * @param srcDir Source directory to copy files from. - * @param rootDir Root directory to calculate relative paths. - */ - private copyFiles(srcDir: string, rootDir: string): void { - const entries = fs.readdirSync(srcDir, { withFileTypes: true }); - for (const entry of entries) { - const srcPath = path.join(srcDir, entry.name); - const relativePath = path.relative(rootDir, srcPath); - const destPath = path.join(this.tempDirPath, relativePath); - - if (entry.isDirectory()) { - this.copyFiles(srcPath, rootDir); - } else if (entry.isFile()) { - if ([".tact", ".fc"].includes(path.extname(entry.name))) { - const destDirPath = path.dirname(destPath); - if (!fs.existsSync(destDirPath)) { - fs.mkdirSync(destDirPath, { recursive: true }); - } - fs.copyFileSync(srcPath, destPath); - } - } - } - } - - /** - * Creates a Tact project configuration file in the temporary directory. - * @param configPath - Path to the configuration file. - * @param relativeContractPath - Relative path to the contract file from the configuration file. - * @param contractName - Name of the contract. - */ - private createConfig( - configPath: string, - relativeContractPath: string, - contractName: string, - ): void { - const config = { - projects: [ - { - name: contractName, - path: relativeContractPath, - output: "./output", - options: { - external: true, - }, - }, - ], - }; - - tryMsg( - () => fs.writeFileSync(configPath, JSON.stringify(config), "utf8"), - `Cannot create a default project configuration at ${configPath}`, - ); - } - - /** - * Finds the root directory containing .git or node_modules by searching upwards from the starting directory. - * @param startingDir Directory to start searching from. - * @returns Path to the root directory if found; otherwise, null. - */ - private findRootDir(startingDir: string): string | null { - let currentDir = startingDir; - while (true) { - if ( - fs.existsSync(path.join(currentDir, ".git")) || - fs.existsSync(path.join(currentDir, "node_modules")) - ) { - return currentDir; - } - const parentDir = path.dirname(currentDir); - if (parentDir === currentDir) { - return null; // reached fs root - } - currentDir = parentDir; - } - } - - /** - * Extracts the contract name from the contract path. - * @returns The contract name. - * @throws ExecutionException if the contract path is invalid. - */ - private extractContractName(): string | never { - const fileName = path.basename(this.contractPath); - if (!fileName) { - throw ExecutionException.make( - `Invalid contract path: ${this.contractPath}`, - ); - } - return fileName.replace(/\.[^/.]+$/, ""); - } - - /** - * Creates a temporary directory for the single contract project configuration. - * - * @throws If the temporary directory already exists and not empty. - * @returns Path to the created temporary directory. - */ - private createTempDir(): string { - const baseDir = path.join(os.tmpdir(), "misti"); - fs.mkdirSync(baseDir, { recursive: true }); - const tempDirPrefix = path.join(baseDir, "temp-"); - const temp = fs.mkdtempSync(tempDirPrefix); - if (fs.existsSync(temp) && fs.readdirSync(temp).length > 0) { - throw ExecutionException.make( - `Temporary directory is not empty: ${temp}`, - ); - } - return temp; - } -} diff --git a/src/internals/context.ts b/src/internals/context.ts index 8515d461..917e0fe2 100644 --- a/src/internals/context.ts +++ b/src/internals/context.ts @@ -2,10 +2,7 @@ import { MistiConfig } from "./config"; import { DebugLogger, Logger, QuietLogger, TraceLogger } from "./logger"; import { CLIOptions, cliOptionDefaults } from "../cli"; import { throwZodError } from "./exceptions"; -import { TactConfigManager } from "./tact/config"; -import { MistiTactPath, getActualPath, getProjectDirectory } from "../cli/path"; import { execSync } from "child_process"; -import path from "path"; /** * Represents the context for a Misti run. @@ -19,19 +16,10 @@ export class MistiContext { */ readonly souffleAvailable: boolean; - /** - * Path to the Tact contract/configuration provided by the user. - */ - readonly tactPath: MistiTactPath | undefined; - /** * Initializes the context for Misti, setting up configuration and appropriate logger. */ - constructor( - tactPath: MistiTactPath | undefined, - options: CLIOptions = cliOptionDefaults, - ) { - this.tactPath = tactPath; + constructor(options: CLIOptions = cliOptionDefaults) { this.souffleAvailable = this.checkSouffleInstallation( options.souffleBinary, ); @@ -84,21 +72,4 @@ export class MistiContext { return false; } } - - /** - * Returns entry points taking into account the user's configuration. - * - * @returns Absolute paths to entrypoint files. - */ - public getEntryPoints(): string[] { - if (this.tactPath === undefined) { - return []; - } - const configPath = getActualPath(this.tactPath); - const projectDir = getProjectDirectory(this.tactPath); - const configManager = new TactConfigManager(this, configPath); - return configManager.config.projects.map((project) => - path.resolve(projectDir, project.path), - ); - } } diff --git a/src/internals/ir/builders/imports.ts b/src/internals/ir/builders/imports.ts index f482f79f..7a732d18 100644 --- a/src/internals/ir/builders/imports.ts +++ b/src/internals/ir/builders/imports.ts @@ -27,19 +27,29 @@ import { Node, NonterminalNode } from "ohm-js"; import path from "path"; export class ImportGraphBuilder { - private constructor(private ctx: MistiContext) {} + private constructor( + private readonly ctx: MistiContext, + private readonly entryPoints: string[], + ) {} - public static make(ctx: MistiContext): ImportGraphBuilder { - return new ImportGraphBuilder(ctx); + /** + * Creates an ImportGraphBuilder. + * + * @param ctx Misti context. + * @param entryPoints Absolute paths to entry points to build import graph from. + */ + public static make( + ctx: MistiContext, + entryPoints: string[], + ): ImportGraphBuilder { + return new ImportGraphBuilder(ctx, entryPoints); } public build(): ImportGraph { const nodes: ImportNode[] = []; const edges: ImportEdge[] = []; const visited = new Set(); - this.ctx - .getEntryPoints() - .forEach((e) => this.processFile(e, nodes, edges, visited)); + this.entryPoints.forEach((e) => this.processFile(e, nodes, edges, visited)); return new ImportGraph(nodes, edges); } @@ -55,19 +65,11 @@ export class ImportGraphBuilder { visited.add(filePath); const fileContent = fs.readFileSync(filePath, "utf8"); - const imports = Parser.parseImports(fileContent, filePath, "user"); - - // Use the actual path when working in single contract mode, not the temporary directory. - let importPath = filePath; - if (this.ctx.tactPath && this.ctx.tactPath.kind === "contract") { - const tempDir = path.dirname(this.ctx.tactPath.tempConfigPath); - importPath = path.relative(tempDir, filePath); - } - + const imports = ParserHack.parseImports(fileContent, filePath, "user"); const node = new ImportNode( this.generateNodeName(filePath), definedInStdlib(this.ctx, filePath) ? "stdlib" : "user", - importPath, + filePath, this.determineLanguage(filePath), this.hasContract(fileContent), ); @@ -155,7 +157,7 @@ export class ImportGraphBuilder { // TODO: Should be removed when https://github.com/tact-lang/tact/issues/965 is fixed. // eslint-disable-next-line @typescript-eslint/no-namespace -export namespace Parser { +export namespace ParserHack { let CURRENT_FILE: string | null; let ORIGIN: ItemOrigin | null; diff --git a/src/internals/ir/builders/ir.ts b/src/internals/ir/builders/ir.ts index 685e1dbe..f3caa05d 100644 --- a/src/internals/ir/builders/ir.ts +++ b/src/internals/ir/builders/ir.ts @@ -11,14 +11,13 @@ import { Edge, FunctionKind, FunctionName, + ImportGraph, ProjectName, } from ".."; import { TactASTStoreBuilder } from "./astStore"; -import { ImportGraphBuilder } from "./imports"; import { MistiContext } from "../../context"; import { InternalException } from "../../exceptions"; import { formatPosition } from "../../tact"; -import { TactConfigManager } from "../../tact/config"; import { unreachable } from "../../util"; import { AstContractDeclaration, @@ -79,6 +78,7 @@ export class TactIRBuilder { private ctx: MistiContext, private projectName: ProjectName, private ast: AstStore, + private imports: ImportGraph, ) { this.registerFunctions(); this.registerContracts(); @@ -87,8 +87,9 @@ export class TactIRBuilder { ctx: MistiContext, projectName: ProjectName, ast: AstStore, + imports: ImportGraph, ): TactIRBuilder { - return new TactIRBuilder(ctx, projectName, ast); + return new TactIRBuilder(ctx, projectName, ast, imports); } /** @@ -100,7 +101,7 @@ export class TactIRBuilder { return new CompilationUnit( this.projectName, TactASTStoreBuilder.make(this.ctx, this.ast).build(), - ImportGraphBuilder.make(this.ctx).build(), + this.imports, functions, contracts, ); @@ -540,19 +541,17 @@ export class TactIRBuilder { } /** - * Creates the Intermediate Representation (IR) for projects defined in a Tact configuration file. + * Creates the Intermediate Representation (IR) for the given projects. + * + * @param ast AST parsed using the Tact parser. + * @param imports An optional imports graph for the given projects, if available. * @returns A mapping of project names to their corresponding CompilationUnit objects. */ export function createIR( ctx: MistiContext, - tactConfigPath: string, -): Map { - const configManager = new TactConfigManager(ctx, tactConfigPath); - const astEntries: Map = - configManager.parseTactProjects(); - return Array.from(astEntries).reduce((acc, [projectName, ast]) => { - const cu = TactIRBuilder.make(ctx, projectName, ast).build(); - acc.set(projectName, cu); - return acc; - }, new Map()); + projectName: ProjectName, + ast: AstStore, + imports: ImportGraph, +): CompilationUnit { + return TactIRBuilder.make(ctx, projectName, ast, imports).build(); } diff --git a/src/internals/ir/imports.ts b/src/internals/ir/imports.ts index 05356dc5..1258ee02 100644 --- a/src/internals/ir/imports.ts +++ b/src/internals/ir/imports.ts @@ -1,6 +1,7 @@ import { IdxGenerator } from "./indices"; import { SrcInfo } from "@tact-lang/compiler/dist/grammar/ast"; import { ItemOrigin } from "@tact-lang/compiler/dist/grammar/grammar"; +import path from "path"; export type ImportNodeIdx = number; export type ImportEdgeIdx = number; @@ -90,6 +91,44 @@ export class ImportGraph { this.edges.forEach(callback); } + /** + * Resolves project root based on the import directives. + * The project root is a directory including all the imported files. + * + * @returns Project root directory or undefined if there are no user imports. + */ + public resolveProjectRoot(): string | undefined { + let projectRoot: string | undefined; + this.nodes.forEach((node) => { + if (node.origin === "user") { + if (!projectRoot) { + projectRoot = path.dirname(node.importPath); + } else { + if (!projectRoot.includes(path.dirname(node.importPath))) { + projectRoot = this.findCommonParent( + projectRoot, + path.dirname(node.importPath), + ); + } + } + } + }); + return projectRoot ? path.resolve(projectRoot) : undefined; + } + + /** + * Finds the common parent directory between two paths. + */ + private findCommonParent(path1: string, path2: string): string { + const parts1 = path1.split(path.sep); + const parts2 = path2.split(path.sep); + let i = 0; + while (i < parts1.length && i < parts2.length && parts1[i] === parts2[i]) { + i++; + } + return parts1.slice(0, i).join(path.sep) || path.sep; + } + /** * Returns true if `parent` imports `child`, directly or indirectly. */ diff --git a/src/internals/ir/types.ts b/src/internals/ir/types.ts index ad267a00..85848ea3 100644 --- a/src/internals/ir/types.ts +++ b/src/internals/ir/types.ts @@ -1,4 +1,4 @@ -export type ProjectName = string; +export type ProjectName = string & { readonly __brand: unique symbol }; export type FunctionName = string; export type ContractName = string; diff --git a/src/internals/tact/config.ts b/src/internals/tact/config.ts index 415c508c..1fe4a499 100644 --- a/src/internals/tact/config.ts +++ b/src/internals/tact/config.ts @@ -1,34 +1,116 @@ +import { ExecutionException, throwZodError } from "../exceptions"; import { ProjectName } from "../ir"; -import { getStdlibPath } from "./stdlib"; -import { MistiContext } from "../context"; import { - ExecutionException, - TactException, - throwZodError, -} from "../exceptions"; -import { - ConfigProject, Config as TactConfig, + ConfigProject, parseConfig, } from "@tact-lang/compiler/dist/config/parseConfig"; -import { CompilerContext } from "@tact-lang/compiler/dist/context"; -import { getRawAST } from "@tact-lang/compiler/dist/grammar/store"; -import { AstStore } from "@tact-lang/compiler/dist/grammar/store"; -import { enableFeatures } from "@tact-lang/compiler/dist/pipeline/build"; -import { precompile } from "@tact-lang/compiler/dist/pipeline/precompile"; -import { createNodeFileSystem } from "@tact-lang/compiler/dist/vfs/createNodeFileSystem"; import fs from "fs"; import path from "path"; +/** + * Manages the logic around the Tact configuration file. + * + * Tact config describes the structure of the project, and includes the entry + * points to run compilation and analysis on. + */ export class TactConfigManager { - /** Tact config parsed with Zod. */ - public config: TactConfig; + private constructor( + /** + * An absolute path to the root directory storing the configuration file. + * + * If the config is generated for the Tact contract, it should be a directory containing all the imported files. + */ + private projectRoot: string, + /** Tact config parsed with Zod. */ + private config: TactConfig, + ) {} + + /** + * Creates a TactConfigManager from a Tact configuration file typically specified by the user. + * + * @param ctx Misti context. + * @param tactConfigPath Path to the Tact configuration file. + */ + public static fromConfig(tactConfigPath: string): TactConfigManager { + return new TactConfigManager( + path.resolve(path.dirname(tactConfigPath)), + this.readTactConfig(tactConfigPath), + ); + } + + /** + * Creates a TactConfigManager from a single Tact contract. + * + * @param ctx Misti context. + * @param projectName Name of the project. + * @param contractPath Path to the Tact contract. + */ + public static fromContract( + projectRoot: string, + contractPath: string, + projectName: ProjectName = path.basename( + contractPath, + ".tact", + ) as ProjectName, + ): TactConfigManager { + const tactConfig: TactConfig = { + projects: [ + { + name: projectName, + path: path.relative(projectRoot, contractPath), + output: "/tmp/misti/output", // never used + options: { + debug: false, + external: true, + }, + }, + ], + }; + return new TactConfigManager(path.resolve(projectRoot), tactConfig); + } - constructor( - private ctx: MistiContext, - private tactConfigPath: string, - ) { - this.config = this.readTactConfig(); + public getConfig(): TactConfig { + return this.config; + } + + /** + * Returns absolute path to the project root. + */ + public getProjectRoot(): string { + return this.projectRoot; + } + + /** + * Gets projects defined within the configuration file. + */ + public getProjects(): ConfigProject[] { + return this.config.projects; + } + + /** + * Find the project config based on the provided name. + */ + public findProjectByName( + projectName: ProjectName, + ): ConfigProject | undefined { + return this.config.projects.find((project) => projectName === project.name); + } + + /** + * Find the project config based on the provided path. + */ + public findProjectByPath(projectPath: string): ConfigProject | undefined { + return this.config.projects.find( + (project) => projectPath === this.resolveProjectPath(project.path), + ); + } + + /** + * Returns an absolute path or the project based on the project path. + */ + public resolveProjectPath(projectPath: string): string { + return path.resolve(this.projectRoot, projectPath); } /** @@ -37,8 +119,8 @@ export class TactConfigManager { * @throws If the config file does not exist or cannot be parsed. * @returns The parsed TactConfig object. */ - private readTactConfig(): TactConfig { - const resolvedPath = path.resolve(this.tactConfigPath); + private static readTactConfig(tactConfigPath: string): TactConfig { + const resolvedPath = path.resolve(tactConfigPath); if (!fs.existsSync(resolvedPath)) { throw ExecutionException.make( `Unable to find config file at ${resolvedPath}`, @@ -58,31 +140,9 @@ export class TactConfigManager { } /** - * Parses the projects defined in the Tact configuration file, generating an AST for each. - * @param config The Tact configuration object. - * @returns A mapping of project names to their corresponding ASTs. + * Returns absolute paths to entry points specified in the Tact configuration file. */ - public parseTactProjects(): Map { - const project = createNodeFileSystem( - path.dirname(this.tactConfigPath), - false, - ); - const stdlibPath = this.ctx.config.tactStdlibPath ?? getStdlibPath(); - const stdlib = createNodeFileSystem(stdlibPath, false); - return this.config.projects.reduce( - (acc: Map, projectConfig: ConfigProject) => { - this.ctx.logger.debug(`Parsing project ${projectConfig.name} ...`); - try { - let ctx = new CompilerContext(); - ctx = enableFeatures(ctx, this.ctx.logger, projectConfig); - ctx = precompile(ctx, project, stdlib, projectConfig.path); - acc.set(projectConfig.name, getRawAST(ctx)); - return acc; - } catch (error: unknown) { - throw TactException.make(error); - } - }, - new Map(), - ); + public getEntryPoints(): string[] { + return this.config.projects.map((p) => this.resolveProjectPath(p.path)); } } diff --git a/src/internals/tact/index.ts b/src/internals/tact/index.ts index cd4ebabd..0e58ce5d 100644 --- a/src/internals/tact/index.ts +++ b/src/internals/tact/index.ts @@ -3,3 +3,4 @@ export * from "./util"; export * from "./constEval"; export * from "./stdlib"; export * from "./config"; +export * from "./parser"; diff --git a/src/internals/tact/parser.ts b/src/internals/tact/parser.ts new file mode 100644 index 00000000..1b60bcde --- /dev/null +++ b/src/internals/tact/parser.ts @@ -0,0 +1,37 @@ +import { getStdlibPath } from "./stdlib"; +import { MistiContext } from "../context"; +import { TactException } from "../exceptions"; +import { ConfigProject } from "@tact-lang/compiler/dist/config/parseConfig"; +import { CompilerContext } from "@tact-lang/compiler/dist/context"; +import { getRawAST } from "@tact-lang/compiler/dist/grammar/store"; +import { AstStore } from "@tact-lang/compiler/dist/grammar/store"; +import { enableFeatures } from "@tact-lang/compiler/dist/pipeline/build"; +import { precompile } from "@tact-lang/compiler/dist/pipeline/precompile"; +import { createNodeFileSystem } from "@tact-lang/compiler/dist/vfs/createNodeFileSystem"; + +/** + * Parses the project defined in the Tact configuration file, generating its AST. + * + * @param mistiCtx Misti context + * @param projectRoot Absolute path to the root the project + * @param config The Tact configuration object: contents of the existing file or a generated object + * @returns A mapping of project names to their corresponding ASTs. + */ +export function parseTactProject( + mistiCtx: MistiContext, + projectConfig: ConfigProject, + projectRoot: string, +): AstStore | never { + const project = createNodeFileSystem(projectRoot, false); + const stdlibPath = mistiCtx.config.tactStdlibPath ?? getStdlibPath(); + const stdlib = createNodeFileSystem(stdlibPath, false); + mistiCtx.logger.debug(`Parsing project ${projectConfig.name} ...`); + try { + let ctx = new CompilerContext(); + ctx = enableFeatures(ctx, mistiCtx.logger, projectConfig); + ctx = precompile(ctx, project, stdlib, projectConfig.path); + return getRawAST(ctx); + } catch (error: unknown) { + throw TactException.make(error); + } +} diff --git a/src/internals/warnings.ts b/src/internals/warnings.ts index 872bd859..b7c57d37 100644 --- a/src/internals/warnings.ts +++ b/src/internals/warnings.ts @@ -1,6 +1,5 @@ import { MistiContext } from "./context"; import { InternalException } from "./exceptions"; -import { getOriginalPath } from "../cli/path"; import { SrcInfo } from "@tact-lang/compiler/dist/grammar/ast"; import * as path from "path"; @@ -128,11 +127,7 @@ export class MistiTactWarning { const lcStr = `${lc}`; const lcLines = lcStr.split("\n"); lcLines.shift(); - const contractPath = - ctx.tactPath && ctx.tactPath.kind === "contract" - ? getOriginalPath(ctx.tactPath) - : loc.file; - const shownPath = path.relative(process.cwd(), contractPath); + const shownPath = path.relative(process.cwd(), loc.file); return `${shownPath}:${lc.lineNum}:${lc.colNum}:\n${lcLines.join("\n")}`; })() : ""; diff --git a/src/tools/dumpImports.ts b/src/tools/dumpImports.ts index 65eab851..2cfa2c78 100644 --- a/src/tools/dumpImports.ts +++ b/src/tools/dumpImports.ts @@ -3,6 +3,7 @@ import { ToolOutput } from "../cli/result"; import { CompilationUnit, ImportGraph } from "../internals/ir"; import { unreachable } from "../internals/util"; import JSONbig from "json-bigint"; +import path from "path"; interface DumpImportGraphOptions extends Record { format: "dot" | "json" | "mmd"; @@ -191,7 +192,7 @@ class JSONDumper { idx: node.idx, name: node.name, origin: node.origin, - importPath: node.importPath, + importPath: path.relative(process.cwd(), node.importPath), language: node.language, hasContract: node.hasContract, inEdges: Array.from(node.inEdges), diff --git a/test/all/sample-jetton.cfg.dot b/test/all/sample-jetton.cfg.dot deleted file mode 100644 index 1c8f15be..00000000 --- a/test/all/sample-jetton.cfg.dot +++ /dev/null @@ -1,141 +0,0 @@ -digraph "sample-jetton" { - node [shape=box]; - subgraph "cluster_SampleJetton__init_1905" { - label="SampleJetton__init_1905"; - "SampleJetton__init_1905_68" [label="self.totalSupply = 0"]; - "SampleJetton__init_1905_69" [label="self.max_supply = max_supply"]; - "SampleJetton__init_1905_70" [label="self.owner = owner"]; - "SampleJetton__init_1905_71" [label="self.mintable = true"]; - "SampleJetton__init_1905_72" [label="self.content = content",style=filled,fillcolor="#66A7DB"]; - "SampleJetton__init_1905_68" -> "SampleJetton__init_1905_69"; - "SampleJetton__init_1905_69" -> "SampleJetton__init_1905_70"; - "SampleJetton__init_1905_70" -> "SampleJetton__init_1905_71"; - "SampleJetton__init_1905_71" -> "SampleJetton__init_1905_72"; - } - subgraph "cluster_SampleJetton__receive_internal_simple_1855" { - label="SampleJetton__receive_internal_simple_1855"; - "SampleJetton__receive_internal_simple_1855_73" [label="let ctx: Context = context()"]; - "SampleJetton__receive_internal_simple_1855_74" [label="require(ctx.sender == self.owner, \"Not Owner\")"]; - "SampleJetton__receive_internal_simple_1855_75" [label="require(self.mintable, \"Can't Mint Anymore\")"]; - "SampleJetton__receive_internal_simple_1855_76" [label="self.mint(msg.receiver, msg.amount, self.owner)",style=filled,fillcolor="#66A7DB"]; - "SampleJetton__receive_internal_simple_1855_73" -> "SampleJetton__receive_internal_simple_1855_74"; - "SampleJetton__receive_internal_simple_1855_74" -> "SampleJetton__receive_internal_simple_1855_75"; - "SampleJetton__receive_internal_simple_1855_75" -> "SampleJetton__receive_internal_simple_1855_76"; - } - subgraph "cluster_SampleJetton__receive_internal_comment_1880_Mint: 100" { - label="SampleJetton__receive_internal_comment_1880_Mint: 100"; - "SampleJetton__receive_internal_comment_1880_Mint: 100_77" [label="let ctx: Context = context()"]; - "SampleJetton__receive_internal_comment_1880_Mint: 100_78" [label="require(self.mintable, \"Can't Mint Anymore\")"]; - "SampleJetton__receive_internal_comment_1880_Mint: 100_79" [label="self.mint(ctx.sender, 100, self.owner)",style=filled,fillcolor="#66A7DB"]; - "SampleJetton__receive_internal_comment_1880_Mint: 100_77" -> "SampleJetton__receive_internal_comment_1880_Mint: 100_78"; - "SampleJetton__receive_internal_comment_1880_Mint: 100_78" -> "SampleJetton__receive_internal_comment_1880_Mint: 100_79"; - } - subgraph "cluster_SampleJetton__receive_internal_comment_1903_Owner: MintClose" { - label="SampleJetton__receive_internal_comment_1903_Owner: MintClose"; - "SampleJetton__receive_internal_comment_1903_Owner: MintClose_80" [label="let ctx: Context = context()"]; - "SampleJetton__receive_internal_comment_1903_Owner: MintClose_81" [label="require(ctx.sender == self.owner, \"Not Owner\")"]; - "SampleJetton__receive_internal_comment_1903_Owner: MintClose_82" [label="self.mintable = false",style=filled,fillcolor="#66A7DB"]; - "SampleJetton__receive_internal_comment_1903_Owner: MintClose_80" -> "SampleJetton__receive_internal_comment_1903_Owner: MintClose_81"; - "SampleJetton__receive_internal_comment_1903_Owner: MintClose_81" -> "SampleJetton__receive_internal_comment_1903_Owner: MintClose_82"; - } - subgraph "cluster_JettonDefaultWallet__init_2908" { - label="JettonDefaultWallet__init_2908"; - "JettonDefaultWallet__init_2908_83" [label="self.balance = 0"]; - "JettonDefaultWallet__init_2908_84" [label="self.owner = owner"]; - "JettonDefaultWallet__init_2908_85" [label="self.master = master",style=filled,fillcolor="#66A7DB"]; - "JettonDefaultWallet__init_2908_83" -> "JettonDefaultWallet__init_2908_84"; - "JettonDefaultWallet__init_2908_84" -> "JettonDefaultWallet__init_2908_85"; - } - subgraph "cluster_JettonDefaultWallet__receive_internal_simple_2515" { - label="JettonDefaultWallet__receive_internal_simple_2515"; - "JettonDefaultWallet__receive_internal_simple_2515_86" [label="let ctx: Context = context()"]; - "JettonDefaultWallet__receive_internal_simple_2515_87" [label="require(ctx.sender == self.owner, \"Invalid sender\")"]; - "JettonDefaultWallet__receive_internal_simple_2515_88" [label="let fwdFee: Int = ctx.readForwardFee() + ctx.readForwardFee()"]; - "JettonDefaultWallet__receive_internal_simple_2515_89" [label="let final: Int = 2 * self.gasConsumption + self.minTonsForStorage + fwdFee"]; - "JettonDefaultWallet__receive_internal_simple_2515_90" [label="require(ctx.value > min(final, ton(\"0.01\")), \"Invalid value!!\")"]; - "JettonDefaultWallet__receive_internal_simple_2515_91" [label="self.balance = self.balance - msg.amount"]; - "JettonDefaultWallet__receive_internal_simple_2515_92" [label="require(self.balance >= 0, \"Invalid balance\")"]; - "JettonDefaultWallet__receive_internal_simple_2515_93" [label="let init: StateInit = initOf JettonDefaultWallet(self.master, msg.destination)"]; - "JettonDefaultWallet__receive_internal_simple_2515_94" [label="let walletAddress: Address = contractAddress(init)"]; - "JettonDefaultWallet__receive_internal_simple_2515_95" [label="send(SendParameters{to: walletAddress, value: 0, mode: SendRemainingValue, bounce: false, body: TokenTransferInternal{queryId: msg.queryId, amount: msg.amount, from: self.owner, response_destination: msg.response_destination, forward_ton_amount: msg.forward_ton_amount, forward_payload: msg.forward_payload}.toCell(), code: init.code, data: init.data})",style=filled,fillcolor="#66A7DB"]; - "JettonDefaultWallet__receive_internal_simple_2515_86" -> "JettonDefaultWallet__receive_internal_simple_2515_87"; - "JettonDefaultWallet__receive_internal_simple_2515_87" -> "JettonDefaultWallet__receive_internal_simple_2515_88"; - "JettonDefaultWallet__receive_internal_simple_2515_88" -> "JettonDefaultWallet__receive_internal_simple_2515_89"; - "JettonDefaultWallet__receive_internal_simple_2515_89" -> "JettonDefaultWallet__receive_internal_simple_2515_90"; - "JettonDefaultWallet__receive_internal_simple_2515_90" -> "JettonDefaultWallet__receive_internal_simple_2515_91"; - "JettonDefaultWallet__receive_internal_simple_2515_91" -> "JettonDefaultWallet__receive_internal_simple_2515_92"; - "JettonDefaultWallet__receive_internal_simple_2515_92" -> "JettonDefaultWallet__receive_internal_simple_2515_93"; - "JettonDefaultWallet__receive_internal_simple_2515_93" -> "JettonDefaultWallet__receive_internal_simple_2515_94"; - "JettonDefaultWallet__receive_internal_simple_2515_94" -> "JettonDefaultWallet__receive_internal_simple_2515_95"; - } - subgraph "cluster_JettonDefaultWallet__receive_internal_simple_2685" { - label="JettonDefaultWallet__receive_internal_simple_2685"; - "JettonDefaultWallet__receive_internal_simple_2685_96" [label="let ctx: Context = context()"]; - "JettonDefaultWallet__receive_internal_simple_2685_97" [label="if (ctx.sender != self.master)"]; - "JettonDefaultWallet__receive_internal_simple_2685_98" [label="let sInit: StateInit = initOf JettonDefaultWallet(self.master, msg.from)"]; - "JettonDefaultWallet__receive_internal_simple_2685_99" [label="require(contractAddress(sInit) == ctx.sender, \"Invalid sender!\")"]; - "JettonDefaultWallet__receive_internal_simple_2685_100" [label="self.balance = self.balance + msg.amount"]; - "JettonDefaultWallet__receive_internal_simple_2685_101" [label="require(self.balance >= 0, \"Invalid balance\")"]; - "JettonDefaultWallet__receive_internal_simple_2685_102" [label="if (msg.forward_ton_amount > 0)"]; - "JettonDefaultWallet__receive_internal_simple_2685_103" [label="send(SendParameters{to: self.owner, value: msg.forward_ton_amount, bounce: false, body: TokenNotification{queryId: msg.queryId, amount: msg.amount, from: msg.from, forward_payload: msg.forward_payload}.toCell()})"]; - "JettonDefaultWallet__receive_internal_simple_2685_104" [label="let msgValue: Int = self.msgValue(ctx.value)"]; - "JettonDefaultWallet__receive_internal_simple_2685_105" [label="let fwdFee: Int = ctx.readForwardFee()"]; - "JettonDefaultWallet__receive_internal_simple_2685_106" [label="msgValue = msgValue - msg.forward_ton_amount - fwdFee"]; - "JettonDefaultWallet__receive_internal_simple_2685_107" [label="if (msg.response_destination != null)"]; - "JettonDefaultWallet__receive_internal_simple_2685_108" [label="send(SendParameters{to: !!msg.response_destination, value: msgValue, bounce: false, body: TokenExcesses{queryId: msg.queryId}.toCell(), mode: SendIgnoreErrors})",style=filled,fillcolor="#66A7DB"]; - "JettonDefaultWallet__receive_internal_simple_2685_96" -> "JettonDefaultWallet__receive_internal_simple_2685_97"; - "JettonDefaultWallet__receive_internal_simple_2685_97" -> "JettonDefaultWallet__receive_internal_simple_2685_98"; - "JettonDefaultWallet__receive_internal_simple_2685_98" -> "JettonDefaultWallet__receive_internal_simple_2685_99"; - "JettonDefaultWallet__receive_internal_simple_2685_99" -> "JettonDefaultWallet__receive_internal_simple_2685_100"; - "JettonDefaultWallet__receive_internal_simple_2685_100" -> "JettonDefaultWallet__receive_internal_simple_2685_101"; - "JettonDefaultWallet__receive_internal_simple_2685_101" -> "JettonDefaultWallet__receive_internal_simple_2685_102"; - "JettonDefaultWallet__receive_internal_simple_2685_102" -> "JettonDefaultWallet__receive_internal_simple_2685_103"; - "JettonDefaultWallet__receive_internal_simple_2685_103" -> "JettonDefaultWallet__receive_internal_simple_2685_104"; - "JettonDefaultWallet__receive_internal_simple_2685_104" -> "JettonDefaultWallet__receive_internal_simple_2685_105"; - "JettonDefaultWallet__receive_internal_simple_2685_105" -> "JettonDefaultWallet__receive_internal_simple_2685_106"; - "JettonDefaultWallet__receive_internal_simple_2685_106" -> "JettonDefaultWallet__receive_internal_simple_2685_107"; - "JettonDefaultWallet__receive_internal_simple_2685_107" -> "JettonDefaultWallet__receive_internal_simple_2685_108"; - } - subgraph "cluster_JettonDefaultWallet__msgValue" { - label="JettonDefaultWallet__msgValue"; - "JettonDefaultWallet__msgValue_109" [label="let tonBalanceBeforeMsg: Int = myBalance() - value"]; - "JettonDefaultWallet__msgValue_110" [label="let storageFee: Int = self.minTonsForStorage - min(tonBalanceBeforeMsg, self.minTonsForStorage)"]; - "JettonDefaultWallet__msgValue_111" [label="value -= storageFee + self.gasConsumption"]; - "JettonDefaultWallet__msgValue_112" [label="return value",style=filled,fillcolor="#66A7DB"]; - "JettonDefaultWallet__msgValue_109" -> "JettonDefaultWallet__msgValue_110"; - "JettonDefaultWallet__msgValue_110" -> "JettonDefaultWallet__msgValue_111"; - "JettonDefaultWallet__msgValue_111" -> "JettonDefaultWallet__msgValue_112"; - } - subgraph "cluster_JettonDefaultWallet__receive_internal_simple_2830" { - label="JettonDefaultWallet__receive_internal_simple_2830"; - "JettonDefaultWallet__receive_internal_simple_2830_113" [label="let ctx: Context = context()"]; - "JettonDefaultWallet__receive_internal_simple_2830_114" [label="require(ctx.sender == self.owner, \"Invalid sender\")"]; - "JettonDefaultWallet__receive_internal_simple_2830_115" [label="self.balance = self.balance - msg.amount"]; - "JettonDefaultWallet__receive_internal_simple_2830_116" [label="require(self.balance >= 0, \"Invalid balance\")"]; - "JettonDefaultWallet__receive_internal_simple_2830_117" [label="let fwdFee: Int = ctx.readForwardFee()"]; - "JettonDefaultWallet__receive_internal_simple_2830_118" [label="require(ctx.value > fwdFee + 2 * self.gasConsumption + self.minTonsForStorage, \"Invalid value - Burn\")"]; - "JettonDefaultWallet__receive_internal_simple_2830_119" [label="send(SendParameters{to: self.master, value: 0, mode: SendRemainingValue, bounce: true, body: TokenBurnNotification{queryId: msg.queryId, amount: msg.amount, owner: self.owner, response_destination: self.owner}.toCell()})",style=filled,fillcolor="#66A7DB"]; - "JettonDefaultWallet__receive_internal_simple_2830_113" -> "JettonDefaultWallet__receive_internal_simple_2830_114"; - "JettonDefaultWallet__receive_internal_simple_2830_114" -> "JettonDefaultWallet__receive_internal_simple_2830_115"; - "JettonDefaultWallet__receive_internal_simple_2830_115" -> "JettonDefaultWallet__receive_internal_simple_2830_116"; - "JettonDefaultWallet__receive_internal_simple_2830_116" -> "JettonDefaultWallet__receive_internal_simple_2830_117"; - "JettonDefaultWallet__receive_internal_simple_2830_117" -> "JettonDefaultWallet__receive_internal_simple_2830_118"; - "JettonDefaultWallet__receive_internal_simple_2830_118" -> "JettonDefaultWallet__receive_internal_simple_2830_119"; - } - subgraph "cluster_JettonDefaultWallet__receive_bounce_2874" { - label="JettonDefaultWallet__receive_bounce_2874"; - "JettonDefaultWallet__receive_bounce_2874_120" [label="let op: Int = msg.loadUint(32)"]; - "JettonDefaultWallet__receive_bounce_2874_121" [label="let queryId: Int = msg.loadUint(64)"]; - "JettonDefaultWallet__receive_bounce_2874_122" [label="let jettonAmount: Int = msg.loadCoins()"]; - "JettonDefaultWallet__receive_bounce_2874_123" [label="require(op == 0x178d4519 || op == 0x7bdd97de, \"Invalid bounced message\")"]; - "JettonDefaultWallet__receive_bounce_2874_124" [label="self.balance = self.balance + jettonAmount",style=filled,fillcolor="#66A7DB"]; - "JettonDefaultWallet__receive_bounce_2874_120" -> "JettonDefaultWallet__receive_bounce_2874_121"; - "JettonDefaultWallet__receive_bounce_2874_121" -> "JettonDefaultWallet__receive_bounce_2874_122"; - "JettonDefaultWallet__receive_bounce_2874_122" -> "JettonDefaultWallet__receive_bounce_2874_123"; - "JettonDefaultWallet__receive_bounce_2874_123" -> "JettonDefaultWallet__receive_bounce_2874_124"; - } - subgraph "cluster_JettonDefaultWallet__get_wallet_data" { - label="JettonDefaultWallet__get_wallet_data"; - "JettonDefaultWallet__get_wallet_data_125" [label="return JettonWalletData{balance: self.balance, owner: self.owner, master: self.master, walletCode: initOf JettonDefaultWallet(self.master, self.owner).code}",style=filled,fillcolor="#66A7DB"]; - } -} diff --git a/test/all/sample-jetton.cfg.json b/test/all/sample-jetton.cfg.json deleted file mode 100644 index 3e1ac753..00000000 --- a/test/all/sample-jetton.cfg.json +++ /dev/null @@ -1,885 +0,0 @@ -{ - "projectName": "sample-jetton", - "functions": [], - "contracts": [ - { - "name": "SampleJetton", - "methods": [ - { - "name": "SampleJetton.init_1905", - "cfg": { - "nodes": [ - { - "id": 68, - "stmtID": 1794, - "srcEdges": [], - "dstEdges": [ - 57 - ] - }, - { - "id": 69, - "stmtID": 1799, - "srcEdges": [ - 57 - ], - "dstEdges": [ - 58 - ] - }, - { - "id": 70, - "stmtID": 1804, - "srcEdges": [ - 58 - ], - "dstEdges": [ - 59 - ] - }, - { - "id": 71, - "stmtID": 1809, - "srcEdges": [ - 59 - ], - "dstEdges": [ - 60 - ] - }, - { - "id": 72, - "stmtID": 1814, - "srcEdges": [ - 60 - ], - "dstEdges": [] - } - ], - "edges": [ - { - "id": 57, - "src": 68, - "dst": 69 - }, - { - "id": 58, - "src": 69, - "dst": 70 - }, - { - "id": 59, - "src": 70, - "dst": 71 - }, - { - "id": 60, - "src": 71, - "dst": 72 - } - ] - } - }, - { - "name": "SampleJetton.receive_internal_simple_1855", - "cfg": { - "nodes": [ - { - "id": 73, - "stmtID": 1823, - "srcEdges": [], - "dstEdges": [ - 61 - ] - }, - { - "id": 74, - "stmtID": 1834, - "srcEdges": [ - 61 - ], - "dstEdges": [ - 62 - ] - }, - { - "id": 75, - "stmtID": 1841, - "srcEdges": [ - 62 - ], - "dstEdges": [ - 63 - ] - }, - { - "id": 76, - "stmtID": 1854, - "srcEdges": [ - 63 - ], - "dstEdges": [] - } - ], - "edges": [ - { - "id": 61, - "src": 73, - "dst": 74 - }, - { - "id": 62, - "src": 74, - "dst": 75 - }, - { - "id": 63, - "src": 75, - "dst": 76 - } - ] - } - }, - { - "name": "SampleJetton.receive_internal_comment_1880_Mint: 100", - "cfg": { - "nodes": [ - { - "id": 77, - "stmtID": 1861, - "srcEdges": [], - "dstEdges": [ - 64 - ] - }, - { - "id": 78, - "stmtID": 1868, - "srcEdges": [ - 64 - ], - "dstEdges": [ - 65 - ] - }, - { - "id": 79, - "stmtID": 1879, - "srcEdges": [ - 65 - ], - "dstEdges": [] - } - ], - "edges": [ - { - "id": 64, - "src": 77, - "dst": 78 - }, - { - "id": 65, - "src": 78, - "dst": 79 - } - ] - } - }, - { - "name": "SampleJetton.receive_internal_comment_1903_Owner: MintClose", - "cfg": { - "nodes": [ - { - "id": 80, - "stmtID": 1886, - "srcEdges": [], - "dstEdges": [ - 66 - ] - }, - { - "id": 81, - "stmtID": 1897, - "srcEdges": [ - 66 - ], - "dstEdges": [ - 67 - ] - }, - { - "id": 82, - "stmtID": 1902, - "srcEdges": [ - 67 - ], - "dstEdges": [] - } - ], - "edges": [ - { - "id": 66, - "src": 80, - "dst": 81 - }, - { - "id": 67, - "src": 81, - "dst": 82 - } - ] - } - } - ] - }, - { - "name": "JettonDefaultWallet", - "methods": [ - { - "name": "JettonDefaultWallet.init_2908", - "cfg": { - "nodes": [ - { - "id": 83, - "stmtID": 2346, - "srcEdges": [], - "dstEdges": [ - 68 - ] - }, - { - "id": 84, - "stmtID": 2351, - "srcEdges": [ - 68 - ], - "dstEdges": [ - 69 - ] - }, - { - "id": 85, - "stmtID": 2356, - "srcEdges": [ - 69 - ], - "dstEdges": [] - } - ], - "edges": [ - { - "id": 68, - "src": 83, - "dst": 84 - }, - { - "id": 69, - "src": 84, - "dst": 85 - } - ] - } - }, - { - "name": "JettonDefaultWallet.receive_internal_simple_2515", - "cfg": { - "nodes": [ - { - "id": 86, - "stmtID": 2365, - "srcEdges": [], - "dstEdges": [ - 70 - ] - }, - { - "id": 87, - "stmtID": 2376, - "srcEdges": [ - 70 - ], - "dstEdges": [ - 71 - ] - }, - { - "id": 88, - "stmtID": 2386, - "srcEdges": [ - 71 - ], - "dstEdges": [ - 72 - ] - }, - { - "id": 89, - "stmtID": 2400, - "srcEdges": [ - 72 - ], - "dstEdges": [ - 73 - ] - }, - { - "id": 90, - "stmtID": 2414, - "srcEdges": [ - 73 - ], - "dstEdges": [ - 74 - ] - }, - { - "id": 91, - "stmtID": 2425, - "srcEdges": [ - 74 - ], - "dstEdges": [ - 75 - ] - }, - { - "id": 92, - "stmtID": 2434, - "srcEdges": [ - 75 - ], - "dstEdges": [ - 76 - ] - }, - { - "id": 93, - "stmtID": 2445, - "srcEdges": [ - 76 - ], - "dstEdges": [ - 77 - ] - }, - { - "id": 94, - "stmtID": 2451, - "srcEdges": [ - 77 - ], - "dstEdges": [ - 78 - ] - }, - { - "id": 95, - "stmtID": 2514, - "srcEdges": [ - 78 - ], - "dstEdges": [] - } - ], - "edges": [ - { - "id": 70, - "src": 86, - "dst": 87 - }, - { - "id": 71, - "src": 87, - "dst": 88 - }, - { - "id": 72, - "src": 88, - "dst": 89 - }, - { - "id": 73, - "src": 89, - "dst": 90 - }, - { - "id": 74, - "src": 90, - "dst": 91 - }, - { - "id": 75, - "src": 91, - "dst": 92 - }, - { - "id": 76, - "src": 92, - "dst": 93 - }, - { - "id": 77, - "src": 93, - "dst": 94 - }, - { - "id": 78, - "src": 94, - "dst": 95 - } - ] - } - }, - { - "name": "JettonDefaultWallet.receive_internal_simple_2685", - "cfg": { - "nodes": [ - { - "id": 96, - "stmtID": 2523, - "srcEdges": [], - "dstEdges": [ - 79 - ] - }, - { - "id": 97, - "stmtID": 2553, - "srcEdges": [ - 79 - ], - "dstEdges": [ - 80 - ] - }, - { - "id": 98, - "stmtID": 2541, - "srcEdges": [ - 80 - ], - "dstEdges": [ - 81 - ] - }, - { - "id": 99, - "stmtID": 2552, - "srcEdges": [ - 81 - ], - "dstEdges": [ - 82 - ] - }, - { - "id": 100, - "stmtID": 2564, - "srcEdges": [ - 82 - ], - "dstEdges": [ - 83 - ] - }, - { - "id": 101, - "stmtID": 2573, - "srcEdges": [ - 83 - ], - "dstEdges": [ - 84 - ] - }, - { - "id": 102, - "stmtID": 2623, - "srcEdges": [ - 84 - ], - "dstEdges": [ - 85 - ] - }, - { - "id": 103, - "stmtID": 2622, - "srcEdges": [ - 85 - ], - "dstEdges": [ - 86 - ] - }, - { - "id": 104, - "stmtID": 2632, - "srcEdges": [ - 86 - ], - "dstEdges": [ - 87 - ] - }, - { - "id": 105, - "stmtID": 2638, - "srcEdges": [ - 87 - ], - "dstEdges": [ - 88 - ] - }, - { - "id": 106, - "stmtID": 2647, - "srcEdges": [ - 88 - ], - "dstEdges": [ - 89 - ] - }, - { - "id": 107, - "stmtID": 2684, - "srcEdges": [ - 89 - ], - "dstEdges": [ - 90 - ] - }, - { - "id": 108, - "stmtID": 2683, - "srcEdges": [ - 90 - ], - "dstEdges": [] - } - ], - "edges": [ - { - "id": 79, - "src": 96, - "dst": 97 - }, - { - "id": 80, - "src": 97, - "dst": 98 - }, - { - "id": 81, - "src": 98, - "dst": 99 - }, - { - "id": 82, - "src": 99, - "dst": 100 - }, - { - "id": 83, - "src": 100, - "dst": 101 - }, - { - "id": 84, - "src": 101, - "dst": 102 - }, - { - "id": 85, - "src": 102, - "dst": 103 - }, - { - "id": 86, - "src": 103, - "dst": 104 - }, - { - "id": 87, - "src": 104, - "dst": 105 - }, - { - "id": 88, - "src": 105, - "dst": 106 - }, - { - "id": 89, - "src": 106, - "dst": 107 - }, - { - "id": 90, - "src": 107, - "dst": 108 - } - ] - } - }, - { - "name": "JettonDefaultWallet.msgValue", - "cfg": { - "nodes": [ - { - "id": 109, - "stmtID": 2697, - "srcEdges": [], - "dstEdges": [ - 91 - ] - }, - { - "id": 110, - "stmtID": 2710, - "srcEdges": [ - 91 - ], - "dstEdges": [ - 92 - ] - }, - { - "id": 111, - "stmtID": 2717, - "srcEdges": [ - 92 - ], - "dstEdges": [ - 93 - ] - }, - { - "id": 112, - "stmtID": 2719, - "srcEdges": [ - 93 - ], - "dstEdges": [] - } - ], - "edges": [ - { - "id": 91, - "src": 109, - "dst": 110 - }, - { - "id": 92, - "src": 110, - "dst": 111 - }, - { - "id": 93, - "src": 111, - "dst": 112 - } - ] - } - }, - { - "name": "JettonDefaultWallet.receive_internal_simple_2830", - "cfg": { - "nodes": [ - { - "id": 113, - "stmtID": 2728, - "srcEdges": [], - "dstEdges": [ - 94 - ] - }, - { - "id": 114, - "stmtID": 2739, - "srcEdges": [ - 94 - ], - "dstEdges": [ - 95 - ] - }, - { - "id": 115, - "stmtID": 2750, - "srcEdges": [ - 95 - ], - "dstEdges": [ - 96 - ] - }, - { - "id": 116, - "stmtID": 2759, - "srcEdges": [ - 96 - ], - "dstEdges": [ - 97 - ] - }, - { - "id": 117, - "stmtID": 2765, - "srcEdges": [ - 97 - ], - "dstEdges": [ - 98 - ] - }, - { - "id": 118, - "stmtID": 2784, - "srcEdges": [ - 98 - ], - "dstEdges": [ - 99 - ] - }, - { - "id": 119, - "stmtID": 2829, - "srcEdges": [ - 99 - ], - "dstEdges": [] - } - ], - "edges": [ - { - "id": 94, - "src": 113, - "dst": 114 - }, - { - "id": 95, - "src": 114, - "dst": 115 - }, - { - "id": 96, - "src": 115, - "dst": 116 - }, - { - "id": 97, - "src": 116, - "dst": 117 - }, - { - "id": 98, - "src": 117, - "dst": 118 - }, - { - "id": 99, - "src": 118, - "dst": 119 - } - ] - } - }, - { - "name": "JettonDefaultWallet.receive_bounce_2874", - "cfg": { - "nodes": [ - { - "id": 120, - "stmtID": 2840, - "srcEdges": [], - "dstEdges": [ - 100 - ] - }, - { - "id": 121, - "stmtID": 2847, - "srcEdges": [ - 100 - ], - "dstEdges": [ - 101 - ] - }, - { - "id": 122, - "stmtID": 2853, - "srcEdges": [ - 101 - ], - "dstEdges": [ - 102 - ] - }, - { - "id": 123, - "stmtID": 2864, - "srcEdges": [ - 102 - ], - "dstEdges": [ - 103 - ] - }, - { - "id": 124, - "stmtID": 2873, - "srcEdges": [ - 103 - ], - "dstEdges": [] - } - ], - "edges": [ - { - "id": 100, - "src": 120, - "dst": 121 - }, - { - "id": 101, - "src": 121, - "dst": 122 - }, - { - "id": 102, - "src": 122, - "dst": 123 - }, - { - "id": 103, - "src": 123, - "dst": 124 - } - ] - } - }, - { - "name": "JettonDefaultWallet.get_wallet_data", - "cfg": { - "nodes": [ - { - "id": 125, - "stmtID": 2906, - "srcEdges": [], - "dstEdges": [] - } - ], - "edges": [] - } - } - ] - } - ] -} \ No newline at end of file diff --git a/test/all/sample-jetton.cfg.mmd b/test/all/sample-jetton.cfg.mmd deleted file mode 100644 index b2cbd227..00000000 --- a/test/all/sample-jetton.cfg.mmd +++ /dev/null @@ -1,128 +0,0 @@ -graph TD -subgraph SampleJetton__init_1905 - SampleJetton__init_1905_68["self.totalSupply = 0"] - SampleJetton__init_1905_69["self.max_supply = max_supply"] - SampleJetton__init_1905_70["self.owner = owner"] - SampleJetton__init_1905_71["self.mintable = true"] - SampleJetton__init_1905_72["self.content = content"]:::exitNode - SampleJetton__init_1905_68 --> SampleJetton__init_1905_69 - SampleJetton__init_1905_69 --> SampleJetton__init_1905_70 - SampleJetton__init_1905_70 --> SampleJetton__init_1905_71 - SampleJetton__init_1905_71 --> SampleJetton__init_1905_72 -end -subgraph SampleJetton__receive_internal_simple_1855 - SampleJetton__receive_internal_simple_1855_73["let ctx: Context = context()"] - SampleJetton__receive_internal_simple_1855_74["require(ctx.sender == self.owner, 'Not Owner')"] - SampleJetton__receive_internal_simple_1855_75["require(self.mintable, 'Can't Mint Anymore')"] - SampleJetton__receive_internal_simple_1855_76["self.mint(msg.receiver, msg.amount, self.owner)"]:::exitNode - SampleJetton__receive_internal_simple_1855_73 --> SampleJetton__receive_internal_simple_1855_74 - SampleJetton__receive_internal_simple_1855_74 --> SampleJetton__receive_internal_simple_1855_75 - SampleJetton__receive_internal_simple_1855_75 --> SampleJetton__receive_internal_simple_1855_76 -end -subgraph SampleJetton__receive_internal_comment_1880_Mint__100 - SampleJetton__receive_internal_comment_1880_Mint__100_77["let ctx: Context = context()"] - SampleJetton__receive_internal_comment_1880_Mint__100_78["require(self.mintable, 'Can't Mint Anymore')"] - SampleJetton__receive_internal_comment_1880_Mint__100_79["self.mint(ctx.sender, 100, self.owner)"]:::exitNode - SampleJetton__receive_internal_comment_1880_Mint__100_77 --> SampleJetton__receive_internal_comment_1880_Mint__100_78 - SampleJetton__receive_internal_comment_1880_Mint__100_78 --> SampleJetton__receive_internal_comment_1880_Mint__100_79 -end -subgraph SampleJetton__receive_internal_comment_1903_Owner__MintClose - SampleJetton__receive_internal_comment_1903_Owner__MintClose_80["let ctx: Context = context()"] - SampleJetton__receive_internal_comment_1903_Owner__MintClose_81["require(ctx.sender == self.owner, 'Not Owner')"] - SampleJetton__receive_internal_comment_1903_Owner__MintClose_82["self.mintable = false"]:::exitNode - SampleJetton__receive_internal_comment_1903_Owner__MintClose_80 --> SampleJetton__receive_internal_comment_1903_Owner__MintClose_81 - SampleJetton__receive_internal_comment_1903_Owner__MintClose_81 --> SampleJetton__receive_internal_comment_1903_Owner__MintClose_82 -end -subgraph JettonDefaultWallet__init_2908 - JettonDefaultWallet__init_2908_83["self.balance = 0"] - JettonDefaultWallet__init_2908_84["self.owner = owner"] - JettonDefaultWallet__init_2908_85["self.master = master"]:::exitNode - JettonDefaultWallet__init_2908_83 --> JettonDefaultWallet__init_2908_84 - JettonDefaultWallet__init_2908_84 --> JettonDefaultWallet__init_2908_85 -end -subgraph JettonDefaultWallet__receive_internal_simple_2515 - JettonDefaultWallet__receive_internal_simple_2515_86["let ctx: Context = context()"] - JettonDefaultWallet__receive_internal_simple_2515_87["require(ctx.sender == self.owner, 'Invalid sender')"] - JettonDefaultWallet__receive_internal_simple_2515_88["let fwdFee: Int = ctx.readForwardFee() + ctx.readForwardFee()"] - JettonDefaultWallet__receive_internal_simple_2515_89["let final: Int = 2 * self.gasConsumption + self.minTonsForStorage + fwdFee"] - JettonDefaultWallet__receive_internal_simple_2515_90["require(ctx.value > min(final, ton('0.01')), 'Invalid value!!')"] - JettonDefaultWallet__receive_internal_simple_2515_91["self.balance = self.balance - msg.amount"] - JettonDefaultWallet__receive_internal_simple_2515_92["require(self.balance >= 0, 'Invalid balance')"] - JettonDefaultWallet__receive_internal_simple_2515_93["let init: StateInit = initOf JettonDefaultWallet(self.master, msg.destination)"] - JettonDefaultWallet__receive_internal_simple_2515_94["let walletAddress: Address = contractAddress(init)"] - JettonDefaultWallet__receive_internal_simple_2515_95["send(SendParameters{to: walletAddress, value: 0, mode: SendRemainingValue, bounce: false, body: TokenTransferInternal{queryId: msg.queryId, amount: msg.amount, from: self.owner, response_destination: msg.response_destination, forward_ton_amount: msg.forward_ton_amount, forward_payload: msg.forward_payload}.toCell(), code: init.code, data: init.data})"]:::exitNode - JettonDefaultWallet__receive_internal_simple_2515_86 --> JettonDefaultWallet__receive_internal_simple_2515_87 - JettonDefaultWallet__receive_internal_simple_2515_87 --> JettonDefaultWallet__receive_internal_simple_2515_88 - JettonDefaultWallet__receive_internal_simple_2515_88 --> JettonDefaultWallet__receive_internal_simple_2515_89 - JettonDefaultWallet__receive_internal_simple_2515_89 --> JettonDefaultWallet__receive_internal_simple_2515_90 - JettonDefaultWallet__receive_internal_simple_2515_90 --> JettonDefaultWallet__receive_internal_simple_2515_91 - JettonDefaultWallet__receive_internal_simple_2515_91 --> JettonDefaultWallet__receive_internal_simple_2515_92 - JettonDefaultWallet__receive_internal_simple_2515_92 --> JettonDefaultWallet__receive_internal_simple_2515_93 - JettonDefaultWallet__receive_internal_simple_2515_93 --> JettonDefaultWallet__receive_internal_simple_2515_94 - JettonDefaultWallet__receive_internal_simple_2515_94 --> JettonDefaultWallet__receive_internal_simple_2515_95 -end -subgraph JettonDefaultWallet__receive_internal_simple_2685 - JettonDefaultWallet__receive_internal_simple_2685_96["let ctx: Context = context()"] - JettonDefaultWallet__receive_internal_simple_2685_97["if (ctx.sender != self.master)"] - JettonDefaultWallet__receive_internal_simple_2685_98["let sInit: StateInit = initOf JettonDefaultWallet(self.master, msg.from)"] - JettonDefaultWallet__receive_internal_simple_2685_99["require(contractAddress(sInit) == ctx.sender, 'Invalid sender!')"] - JettonDefaultWallet__receive_internal_simple_2685_100["self.balance = self.balance + msg.amount"] - JettonDefaultWallet__receive_internal_simple_2685_101["require(self.balance >= 0, 'Invalid balance')"] - JettonDefaultWallet__receive_internal_simple_2685_102["if (msg.forward_ton_amount > 0)"] - JettonDefaultWallet__receive_internal_simple_2685_103["send(SendParameters{to: self.owner, value: msg.forward_ton_amount, bounce: false, body: TokenNotification{queryId: msg.queryId, amount: msg.amount, from: msg.from, forward_payload: msg.forward_payload}.toCell()})"] - JettonDefaultWallet__receive_internal_simple_2685_104["let msgValue: Int = self.msgValue(ctx.value)"] - JettonDefaultWallet__receive_internal_simple_2685_105["let fwdFee: Int = ctx.readForwardFee()"] - JettonDefaultWallet__receive_internal_simple_2685_106["msgValue = msgValue - msg.forward_ton_amount - fwdFee"] - JettonDefaultWallet__receive_internal_simple_2685_107["if (msg.response_destination != null)"] - JettonDefaultWallet__receive_internal_simple_2685_108["send(SendParameters{to: !!msg.response_destination, value: msgValue, bounce: false, body: TokenExcesses{queryId: msg.queryId}.toCell(), mode: SendIgnoreErrors})"]:::exitNode - JettonDefaultWallet__receive_internal_simple_2685_96 --> JettonDefaultWallet__receive_internal_simple_2685_97 - JettonDefaultWallet__receive_internal_simple_2685_97 --> JettonDefaultWallet__receive_internal_simple_2685_98 - JettonDefaultWallet__receive_internal_simple_2685_98 --> JettonDefaultWallet__receive_internal_simple_2685_99 - JettonDefaultWallet__receive_internal_simple_2685_99 --> JettonDefaultWallet__receive_internal_simple_2685_100 - JettonDefaultWallet__receive_internal_simple_2685_100 --> JettonDefaultWallet__receive_internal_simple_2685_101 - JettonDefaultWallet__receive_internal_simple_2685_101 --> JettonDefaultWallet__receive_internal_simple_2685_102 - JettonDefaultWallet__receive_internal_simple_2685_102 --> JettonDefaultWallet__receive_internal_simple_2685_103 - JettonDefaultWallet__receive_internal_simple_2685_103 --> JettonDefaultWallet__receive_internal_simple_2685_104 - JettonDefaultWallet__receive_internal_simple_2685_104 --> JettonDefaultWallet__receive_internal_simple_2685_105 - JettonDefaultWallet__receive_internal_simple_2685_105 --> JettonDefaultWallet__receive_internal_simple_2685_106 - JettonDefaultWallet__receive_internal_simple_2685_106 --> JettonDefaultWallet__receive_internal_simple_2685_107 - JettonDefaultWallet__receive_internal_simple_2685_107 --> JettonDefaultWallet__receive_internal_simple_2685_108 -end -subgraph JettonDefaultWallet__msgValue - JettonDefaultWallet__msgValue_109["let tonBalanceBeforeMsg: Int = myBalance() - value"] - JettonDefaultWallet__msgValue_110["let storageFee: Int = self.minTonsForStorage - min(tonBalanceBeforeMsg, self.minTonsForStorage)"] - JettonDefaultWallet__msgValue_111["value -= storageFee + self.gasConsumption"] - JettonDefaultWallet__msgValue_112["return value"]:::exitNode - JettonDefaultWallet__msgValue_109 --> JettonDefaultWallet__msgValue_110 - JettonDefaultWallet__msgValue_110 --> JettonDefaultWallet__msgValue_111 - JettonDefaultWallet__msgValue_111 --> JettonDefaultWallet__msgValue_112 -end -subgraph JettonDefaultWallet__receive_internal_simple_2830 - JettonDefaultWallet__receive_internal_simple_2830_113["let ctx: Context = context()"] - JettonDefaultWallet__receive_internal_simple_2830_114["require(ctx.sender == self.owner, 'Invalid sender')"] - JettonDefaultWallet__receive_internal_simple_2830_115["self.balance = self.balance - msg.amount"] - JettonDefaultWallet__receive_internal_simple_2830_116["require(self.balance >= 0, 'Invalid balance')"] - JettonDefaultWallet__receive_internal_simple_2830_117["let fwdFee: Int = ctx.readForwardFee()"] - JettonDefaultWallet__receive_internal_simple_2830_118["require(ctx.value > fwdFee + 2 * self.gasConsumption + self.minTonsForStorage, 'Invalid value - Burn')"] - JettonDefaultWallet__receive_internal_simple_2830_119["send(SendParameters{to: self.master, value: 0, mode: SendRemainingValue, bounce: true, body: TokenBurnNotification{queryId: msg.queryId, amount: msg.amount, owner: self.owner, response_destination: self.owner}.toCell()})"]:::exitNode - JettonDefaultWallet__receive_internal_simple_2830_113 --> JettonDefaultWallet__receive_internal_simple_2830_114 - JettonDefaultWallet__receive_internal_simple_2830_114 --> JettonDefaultWallet__receive_internal_simple_2830_115 - JettonDefaultWallet__receive_internal_simple_2830_115 --> JettonDefaultWallet__receive_internal_simple_2830_116 - JettonDefaultWallet__receive_internal_simple_2830_116 --> JettonDefaultWallet__receive_internal_simple_2830_117 - JettonDefaultWallet__receive_internal_simple_2830_117 --> JettonDefaultWallet__receive_internal_simple_2830_118 - JettonDefaultWallet__receive_internal_simple_2830_118 --> JettonDefaultWallet__receive_internal_simple_2830_119 -end -subgraph JettonDefaultWallet__receive_bounce_2874 - JettonDefaultWallet__receive_bounce_2874_120["let op: Int = msg.loadUint(32)"] - JettonDefaultWallet__receive_bounce_2874_121["let queryId: Int = msg.loadUint(64)"] - JettonDefaultWallet__receive_bounce_2874_122["let jettonAmount: Int = msg.loadCoins()"] - JettonDefaultWallet__receive_bounce_2874_123["require(op == 0x178d4519 || op == 0x7bdd97de, 'Invalid bounced message')"] - JettonDefaultWallet__receive_bounce_2874_124["self.balance = self.balance + jettonAmount"]:::exitNode - JettonDefaultWallet__receive_bounce_2874_120 --> JettonDefaultWallet__receive_bounce_2874_121 - JettonDefaultWallet__receive_bounce_2874_121 --> JettonDefaultWallet__receive_bounce_2874_122 - JettonDefaultWallet__receive_bounce_2874_122 --> JettonDefaultWallet__receive_bounce_2874_123 - JettonDefaultWallet__receive_bounce_2874_123 --> JettonDefaultWallet__receive_bounce_2874_124 -end -subgraph JettonDefaultWallet__get_wallet_data - JettonDefaultWallet__get_wallet_data_125["return JettonWalletData{balance: self.balance, owner: self.owner, master: self.master, walletCode: initOf JettonDefaultWallet(self.master, self.owner).code}"]:::exitNode -end diff --git a/test/all/sample-jetton.expected.cfg.dot b/test/all/sample-jetton.expected.cfg.dot index 1c8f15be..6c88cd8e 100644 --- a/test/all/sample-jetton.expected.cfg.dot +++ b/test/all/sample-jetton.expected.cfg.dot @@ -1,100 +1,100 @@ digraph "sample-jetton" { node [shape=box]; - subgraph "cluster_SampleJetton__init_1905" { - label="SampleJetton__init_1905"; - "SampleJetton__init_1905_68" [label="self.totalSupply = 0"]; - "SampleJetton__init_1905_69" [label="self.max_supply = max_supply"]; - "SampleJetton__init_1905_70" [label="self.owner = owner"]; - "SampleJetton__init_1905_71" [label="self.mintable = true"]; - "SampleJetton__init_1905_72" [label="self.content = content",style=filled,fillcolor="#66A7DB"]; - "SampleJetton__init_1905_68" -> "SampleJetton__init_1905_69"; - "SampleJetton__init_1905_69" -> "SampleJetton__init_1905_70"; - "SampleJetton__init_1905_70" -> "SampleJetton__init_1905_71"; - "SampleJetton__init_1905_71" -> "SampleJetton__init_1905_72"; + subgraph "cluster_SampleJetton__init_1907" { + label="SampleJetton__init_1907"; + "SampleJetton__init_1907_68" [label="self.totalSupply = 0"]; + "SampleJetton__init_1907_69" [label="self.max_supply = max_supply"]; + "SampleJetton__init_1907_70" [label="self.owner = owner"]; + "SampleJetton__init_1907_71" [label="self.mintable = true"]; + "SampleJetton__init_1907_72" [label="self.content = content",style=filled,fillcolor="#66A7DB"]; + "SampleJetton__init_1907_68" -> "SampleJetton__init_1907_69"; + "SampleJetton__init_1907_69" -> "SampleJetton__init_1907_70"; + "SampleJetton__init_1907_70" -> "SampleJetton__init_1907_71"; + "SampleJetton__init_1907_71" -> "SampleJetton__init_1907_72"; } - subgraph "cluster_SampleJetton__receive_internal_simple_1855" { - label="SampleJetton__receive_internal_simple_1855"; - "SampleJetton__receive_internal_simple_1855_73" [label="let ctx: Context = context()"]; - "SampleJetton__receive_internal_simple_1855_74" [label="require(ctx.sender == self.owner, \"Not Owner\")"]; - "SampleJetton__receive_internal_simple_1855_75" [label="require(self.mintable, \"Can't Mint Anymore\")"]; - "SampleJetton__receive_internal_simple_1855_76" [label="self.mint(msg.receiver, msg.amount, self.owner)",style=filled,fillcolor="#66A7DB"]; - "SampleJetton__receive_internal_simple_1855_73" -> "SampleJetton__receive_internal_simple_1855_74"; - "SampleJetton__receive_internal_simple_1855_74" -> "SampleJetton__receive_internal_simple_1855_75"; - "SampleJetton__receive_internal_simple_1855_75" -> "SampleJetton__receive_internal_simple_1855_76"; + subgraph "cluster_SampleJetton__receive_internal_simple_1857" { + label="SampleJetton__receive_internal_simple_1857"; + "SampleJetton__receive_internal_simple_1857_73" [label="let ctx: Context = context()"]; + "SampleJetton__receive_internal_simple_1857_74" [label="require(ctx.sender == self.owner, \"Not Owner\")"]; + "SampleJetton__receive_internal_simple_1857_75" [label="require(self.mintable, \"Can't Mint Anymore\")"]; + "SampleJetton__receive_internal_simple_1857_76" [label="self.mint(msg.receiver, msg.amount, self.owner)",style=filled,fillcolor="#66A7DB"]; + "SampleJetton__receive_internal_simple_1857_73" -> "SampleJetton__receive_internal_simple_1857_74"; + "SampleJetton__receive_internal_simple_1857_74" -> "SampleJetton__receive_internal_simple_1857_75"; + "SampleJetton__receive_internal_simple_1857_75" -> "SampleJetton__receive_internal_simple_1857_76"; } - subgraph "cluster_SampleJetton__receive_internal_comment_1880_Mint: 100" { - label="SampleJetton__receive_internal_comment_1880_Mint: 100"; - "SampleJetton__receive_internal_comment_1880_Mint: 100_77" [label="let ctx: Context = context()"]; - "SampleJetton__receive_internal_comment_1880_Mint: 100_78" [label="require(self.mintable, \"Can't Mint Anymore\")"]; - "SampleJetton__receive_internal_comment_1880_Mint: 100_79" [label="self.mint(ctx.sender, 100, self.owner)",style=filled,fillcolor="#66A7DB"]; - "SampleJetton__receive_internal_comment_1880_Mint: 100_77" -> "SampleJetton__receive_internal_comment_1880_Mint: 100_78"; - "SampleJetton__receive_internal_comment_1880_Mint: 100_78" -> "SampleJetton__receive_internal_comment_1880_Mint: 100_79"; + subgraph "cluster_SampleJetton__receive_internal_comment_1882_Mint: 100" { + label="SampleJetton__receive_internal_comment_1882_Mint: 100"; + "SampleJetton__receive_internal_comment_1882_Mint: 100_77" [label="let ctx: Context = context()"]; + "SampleJetton__receive_internal_comment_1882_Mint: 100_78" [label="require(self.mintable, \"Can't Mint Anymore\")"]; + "SampleJetton__receive_internal_comment_1882_Mint: 100_79" [label="self.mint(ctx.sender, 100, self.owner)",style=filled,fillcolor="#66A7DB"]; + "SampleJetton__receive_internal_comment_1882_Mint: 100_77" -> "SampleJetton__receive_internal_comment_1882_Mint: 100_78"; + "SampleJetton__receive_internal_comment_1882_Mint: 100_78" -> "SampleJetton__receive_internal_comment_1882_Mint: 100_79"; } - subgraph "cluster_SampleJetton__receive_internal_comment_1903_Owner: MintClose" { - label="SampleJetton__receive_internal_comment_1903_Owner: MintClose"; - "SampleJetton__receive_internal_comment_1903_Owner: MintClose_80" [label="let ctx: Context = context()"]; - "SampleJetton__receive_internal_comment_1903_Owner: MintClose_81" [label="require(ctx.sender == self.owner, \"Not Owner\")"]; - "SampleJetton__receive_internal_comment_1903_Owner: MintClose_82" [label="self.mintable = false",style=filled,fillcolor="#66A7DB"]; - "SampleJetton__receive_internal_comment_1903_Owner: MintClose_80" -> "SampleJetton__receive_internal_comment_1903_Owner: MintClose_81"; - "SampleJetton__receive_internal_comment_1903_Owner: MintClose_81" -> "SampleJetton__receive_internal_comment_1903_Owner: MintClose_82"; + subgraph "cluster_SampleJetton__receive_internal_comment_1905_Owner: MintClose" { + label="SampleJetton__receive_internal_comment_1905_Owner: MintClose"; + "SampleJetton__receive_internal_comment_1905_Owner: MintClose_80" [label="let ctx: Context = context()"]; + "SampleJetton__receive_internal_comment_1905_Owner: MintClose_81" [label="require(ctx.sender == self.owner, \"Not Owner\")"]; + "SampleJetton__receive_internal_comment_1905_Owner: MintClose_82" [label="self.mintable = false",style=filled,fillcolor="#66A7DB"]; + "SampleJetton__receive_internal_comment_1905_Owner: MintClose_80" -> "SampleJetton__receive_internal_comment_1905_Owner: MintClose_81"; + "SampleJetton__receive_internal_comment_1905_Owner: MintClose_81" -> "SampleJetton__receive_internal_comment_1905_Owner: MintClose_82"; } - subgraph "cluster_JettonDefaultWallet__init_2908" { - label="JettonDefaultWallet__init_2908"; - "JettonDefaultWallet__init_2908_83" [label="self.balance = 0"]; - "JettonDefaultWallet__init_2908_84" [label="self.owner = owner"]; - "JettonDefaultWallet__init_2908_85" [label="self.master = master",style=filled,fillcolor="#66A7DB"]; - "JettonDefaultWallet__init_2908_83" -> "JettonDefaultWallet__init_2908_84"; - "JettonDefaultWallet__init_2908_84" -> "JettonDefaultWallet__init_2908_85"; + subgraph "cluster_JettonDefaultWallet__init_2910" { + label="JettonDefaultWallet__init_2910"; + "JettonDefaultWallet__init_2910_83" [label="self.balance = 0"]; + "JettonDefaultWallet__init_2910_84" [label="self.owner = owner"]; + "JettonDefaultWallet__init_2910_85" [label="self.master = master",style=filled,fillcolor="#66A7DB"]; + "JettonDefaultWallet__init_2910_83" -> "JettonDefaultWallet__init_2910_84"; + "JettonDefaultWallet__init_2910_84" -> "JettonDefaultWallet__init_2910_85"; } - subgraph "cluster_JettonDefaultWallet__receive_internal_simple_2515" { - label="JettonDefaultWallet__receive_internal_simple_2515"; - "JettonDefaultWallet__receive_internal_simple_2515_86" [label="let ctx: Context = context()"]; - "JettonDefaultWallet__receive_internal_simple_2515_87" [label="require(ctx.sender == self.owner, \"Invalid sender\")"]; - "JettonDefaultWallet__receive_internal_simple_2515_88" [label="let fwdFee: Int = ctx.readForwardFee() + ctx.readForwardFee()"]; - "JettonDefaultWallet__receive_internal_simple_2515_89" [label="let final: Int = 2 * self.gasConsumption + self.minTonsForStorage + fwdFee"]; - "JettonDefaultWallet__receive_internal_simple_2515_90" [label="require(ctx.value > min(final, ton(\"0.01\")), \"Invalid value!!\")"]; - "JettonDefaultWallet__receive_internal_simple_2515_91" [label="self.balance = self.balance - msg.amount"]; - "JettonDefaultWallet__receive_internal_simple_2515_92" [label="require(self.balance >= 0, \"Invalid balance\")"]; - "JettonDefaultWallet__receive_internal_simple_2515_93" [label="let init: StateInit = initOf JettonDefaultWallet(self.master, msg.destination)"]; - "JettonDefaultWallet__receive_internal_simple_2515_94" [label="let walletAddress: Address = contractAddress(init)"]; - "JettonDefaultWallet__receive_internal_simple_2515_95" [label="send(SendParameters{to: walletAddress, value: 0, mode: SendRemainingValue, bounce: false, body: TokenTransferInternal{queryId: msg.queryId, amount: msg.amount, from: self.owner, response_destination: msg.response_destination, forward_ton_amount: msg.forward_ton_amount, forward_payload: msg.forward_payload}.toCell(), code: init.code, data: init.data})",style=filled,fillcolor="#66A7DB"]; - "JettonDefaultWallet__receive_internal_simple_2515_86" -> "JettonDefaultWallet__receive_internal_simple_2515_87"; - "JettonDefaultWallet__receive_internal_simple_2515_87" -> "JettonDefaultWallet__receive_internal_simple_2515_88"; - "JettonDefaultWallet__receive_internal_simple_2515_88" -> "JettonDefaultWallet__receive_internal_simple_2515_89"; - "JettonDefaultWallet__receive_internal_simple_2515_89" -> "JettonDefaultWallet__receive_internal_simple_2515_90"; - "JettonDefaultWallet__receive_internal_simple_2515_90" -> "JettonDefaultWallet__receive_internal_simple_2515_91"; - "JettonDefaultWallet__receive_internal_simple_2515_91" -> "JettonDefaultWallet__receive_internal_simple_2515_92"; - "JettonDefaultWallet__receive_internal_simple_2515_92" -> "JettonDefaultWallet__receive_internal_simple_2515_93"; - "JettonDefaultWallet__receive_internal_simple_2515_93" -> "JettonDefaultWallet__receive_internal_simple_2515_94"; - "JettonDefaultWallet__receive_internal_simple_2515_94" -> "JettonDefaultWallet__receive_internal_simple_2515_95"; + subgraph "cluster_JettonDefaultWallet__receive_internal_simple_2517" { + label="JettonDefaultWallet__receive_internal_simple_2517"; + "JettonDefaultWallet__receive_internal_simple_2517_86" [label="let ctx: Context = context()"]; + "JettonDefaultWallet__receive_internal_simple_2517_87" [label="require(ctx.sender == self.owner, \"Invalid sender\")"]; + "JettonDefaultWallet__receive_internal_simple_2517_88" [label="let fwdFee: Int = ctx.readForwardFee() + ctx.readForwardFee()"]; + "JettonDefaultWallet__receive_internal_simple_2517_89" [label="let final: Int = 2 * self.gasConsumption + self.minTonsForStorage + fwdFee"]; + "JettonDefaultWallet__receive_internal_simple_2517_90" [label="require(ctx.value > min(final, ton(\"0.01\")), \"Invalid value!!\")"]; + "JettonDefaultWallet__receive_internal_simple_2517_91" [label="self.balance = self.balance - msg.amount"]; + "JettonDefaultWallet__receive_internal_simple_2517_92" [label="require(self.balance >= 0, \"Invalid balance\")"]; + "JettonDefaultWallet__receive_internal_simple_2517_93" [label="let init: StateInit = initOf JettonDefaultWallet(self.master, msg.destination)"]; + "JettonDefaultWallet__receive_internal_simple_2517_94" [label="let walletAddress: Address = contractAddress(init)"]; + "JettonDefaultWallet__receive_internal_simple_2517_95" [label="send(SendParameters{to: walletAddress, value: 0, mode: SendRemainingValue, bounce: false, body: TokenTransferInternal{queryId: msg.queryId, amount: msg.amount, from: self.owner, response_destination: msg.response_destination, forward_ton_amount: msg.forward_ton_amount, forward_payload: msg.forward_payload}.toCell(), code: init.code, data: init.data})",style=filled,fillcolor="#66A7DB"]; + "JettonDefaultWallet__receive_internal_simple_2517_86" -> "JettonDefaultWallet__receive_internal_simple_2517_87"; + "JettonDefaultWallet__receive_internal_simple_2517_87" -> "JettonDefaultWallet__receive_internal_simple_2517_88"; + "JettonDefaultWallet__receive_internal_simple_2517_88" -> "JettonDefaultWallet__receive_internal_simple_2517_89"; + "JettonDefaultWallet__receive_internal_simple_2517_89" -> "JettonDefaultWallet__receive_internal_simple_2517_90"; + "JettonDefaultWallet__receive_internal_simple_2517_90" -> "JettonDefaultWallet__receive_internal_simple_2517_91"; + "JettonDefaultWallet__receive_internal_simple_2517_91" -> "JettonDefaultWallet__receive_internal_simple_2517_92"; + "JettonDefaultWallet__receive_internal_simple_2517_92" -> "JettonDefaultWallet__receive_internal_simple_2517_93"; + "JettonDefaultWallet__receive_internal_simple_2517_93" -> "JettonDefaultWallet__receive_internal_simple_2517_94"; + "JettonDefaultWallet__receive_internal_simple_2517_94" -> "JettonDefaultWallet__receive_internal_simple_2517_95"; } - subgraph "cluster_JettonDefaultWallet__receive_internal_simple_2685" { - label="JettonDefaultWallet__receive_internal_simple_2685"; - "JettonDefaultWallet__receive_internal_simple_2685_96" [label="let ctx: Context = context()"]; - "JettonDefaultWallet__receive_internal_simple_2685_97" [label="if (ctx.sender != self.master)"]; - "JettonDefaultWallet__receive_internal_simple_2685_98" [label="let sInit: StateInit = initOf JettonDefaultWallet(self.master, msg.from)"]; - "JettonDefaultWallet__receive_internal_simple_2685_99" [label="require(contractAddress(sInit) == ctx.sender, \"Invalid sender!\")"]; - "JettonDefaultWallet__receive_internal_simple_2685_100" [label="self.balance = self.balance + msg.amount"]; - "JettonDefaultWallet__receive_internal_simple_2685_101" [label="require(self.balance >= 0, \"Invalid balance\")"]; - "JettonDefaultWallet__receive_internal_simple_2685_102" [label="if (msg.forward_ton_amount > 0)"]; - "JettonDefaultWallet__receive_internal_simple_2685_103" [label="send(SendParameters{to: self.owner, value: msg.forward_ton_amount, bounce: false, body: TokenNotification{queryId: msg.queryId, amount: msg.amount, from: msg.from, forward_payload: msg.forward_payload}.toCell()})"]; - "JettonDefaultWallet__receive_internal_simple_2685_104" [label="let msgValue: Int = self.msgValue(ctx.value)"]; - "JettonDefaultWallet__receive_internal_simple_2685_105" [label="let fwdFee: Int = ctx.readForwardFee()"]; - "JettonDefaultWallet__receive_internal_simple_2685_106" [label="msgValue = msgValue - msg.forward_ton_amount - fwdFee"]; - "JettonDefaultWallet__receive_internal_simple_2685_107" [label="if (msg.response_destination != null)"]; - "JettonDefaultWallet__receive_internal_simple_2685_108" [label="send(SendParameters{to: !!msg.response_destination, value: msgValue, bounce: false, body: TokenExcesses{queryId: msg.queryId}.toCell(), mode: SendIgnoreErrors})",style=filled,fillcolor="#66A7DB"]; - "JettonDefaultWallet__receive_internal_simple_2685_96" -> "JettonDefaultWallet__receive_internal_simple_2685_97"; - "JettonDefaultWallet__receive_internal_simple_2685_97" -> "JettonDefaultWallet__receive_internal_simple_2685_98"; - "JettonDefaultWallet__receive_internal_simple_2685_98" -> "JettonDefaultWallet__receive_internal_simple_2685_99"; - "JettonDefaultWallet__receive_internal_simple_2685_99" -> "JettonDefaultWallet__receive_internal_simple_2685_100"; - "JettonDefaultWallet__receive_internal_simple_2685_100" -> "JettonDefaultWallet__receive_internal_simple_2685_101"; - "JettonDefaultWallet__receive_internal_simple_2685_101" -> "JettonDefaultWallet__receive_internal_simple_2685_102"; - "JettonDefaultWallet__receive_internal_simple_2685_102" -> "JettonDefaultWallet__receive_internal_simple_2685_103"; - "JettonDefaultWallet__receive_internal_simple_2685_103" -> "JettonDefaultWallet__receive_internal_simple_2685_104"; - "JettonDefaultWallet__receive_internal_simple_2685_104" -> "JettonDefaultWallet__receive_internal_simple_2685_105"; - "JettonDefaultWallet__receive_internal_simple_2685_105" -> "JettonDefaultWallet__receive_internal_simple_2685_106"; - "JettonDefaultWallet__receive_internal_simple_2685_106" -> "JettonDefaultWallet__receive_internal_simple_2685_107"; - "JettonDefaultWallet__receive_internal_simple_2685_107" -> "JettonDefaultWallet__receive_internal_simple_2685_108"; + subgraph "cluster_JettonDefaultWallet__receive_internal_simple_2687" { + label="JettonDefaultWallet__receive_internal_simple_2687"; + "JettonDefaultWallet__receive_internal_simple_2687_96" [label="let ctx: Context = context()"]; + "JettonDefaultWallet__receive_internal_simple_2687_97" [label="if (ctx.sender != self.master)"]; + "JettonDefaultWallet__receive_internal_simple_2687_98" [label="let sInit: StateInit = initOf JettonDefaultWallet(self.master, msg.from)"]; + "JettonDefaultWallet__receive_internal_simple_2687_99" [label="require(contractAddress(sInit) == ctx.sender, \"Invalid sender!\")"]; + "JettonDefaultWallet__receive_internal_simple_2687_100" [label="self.balance = self.balance + msg.amount"]; + "JettonDefaultWallet__receive_internal_simple_2687_101" [label="require(self.balance >= 0, \"Invalid balance\")"]; + "JettonDefaultWallet__receive_internal_simple_2687_102" [label="if (msg.forward_ton_amount > 0)"]; + "JettonDefaultWallet__receive_internal_simple_2687_103" [label="send(SendParameters{to: self.owner, value: msg.forward_ton_amount, bounce: false, body: TokenNotification{queryId: msg.queryId, amount: msg.amount, from: msg.from, forward_payload: msg.forward_payload}.toCell()})"]; + "JettonDefaultWallet__receive_internal_simple_2687_104" [label="let msgValue: Int = self.msgValue(ctx.value)"]; + "JettonDefaultWallet__receive_internal_simple_2687_105" [label="let fwdFee: Int = ctx.readForwardFee()"]; + "JettonDefaultWallet__receive_internal_simple_2687_106" [label="msgValue = msgValue - msg.forward_ton_amount - fwdFee"]; + "JettonDefaultWallet__receive_internal_simple_2687_107" [label="if (msg.response_destination != null)"]; + "JettonDefaultWallet__receive_internal_simple_2687_108" [label="send(SendParameters{to: !!msg.response_destination, value: msgValue, bounce: false, body: TokenExcesses{queryId: msg.queryId}.toCell(), mode: SendIgnoreErrors})",style=filled,fillcolor="#66A7DB"]; + "JettonDefaultWallet__receive_internal_simple_2687_96" -> "JettonDefaultWallet__receive_internal_simple_2687_97"; + "JettonDefaultWallet__receive_internal_simple_2687_97" -> "JettonDefaultWallet__receive_internal_simple_2687_98"; + "JettonDefaultWallet__receive_internal_simple_2687_98" -> "JettonDefaultWallet__receive_internal_simple_2687_99"; + "JettonDefaultWallet__receive_internal_simple_2687_99" -> "JettonDefaultWallet__receive_internal_simple_2687_100"; + "JettonDefaultWallet__receive_internal_simple_2687_100" -> "JettonDefaultWallet__receive_internal_simple_2687_101"; + "JettonDefaultWallet__receive_internal_simple_2687_101" -> "JettonDefaultWallet__receive_internal_simple_2687_102"; + "JettonDefaultWallet__receive_internal_simple_2687_102" -> "JettonDefaultWallet__receive_internal_simple_2687_103"; + "JettonDefaultWallet__receive_internal_simple_2687_103" -> "JettonDefaultWallet__receive_internal_simple_2687_104"; + "JettonDefaultWallet__receive_internal_simple_2687_104" -> "JettonDefaultWallet__receive_internal_simple_2687_105"; + "JettonDefaultWallet__receive_internal_simple_2687_105" -> "JettonDefaultWallet__receive_internal_simple_2687_106"; + "JettonDefaultWallet__receive_internal_simple_2687_106" -> "JettonDefaultWallet__receive_internal_simple_2687_107"; + "JettonDefaultWallet__receive_internal_simple_2687_107" -> "JettonDefaultWallet__receive_internal_simple_2687_108"; } subgraph "cluster_JettonDefaultWallet__msgValue" { label="JettonDefaultWallet__msgValue"; @@ -106,33 +106,33 @@ digraph "sample-jetton" { "JettonDefaultWallet__msgValue_110" -> "JettonDefaultWallet__msgValue_111"; "JettonDefaultWallet__msgValue_111" -> "JettonDefaultWallet__msgValue_112"; } - subgraph "cluster_JettonDefaultWallet__receive_internal_simple_2830" { - label="JettonDefaultWallet__receive_internal_simple_2830"; - "JettonDefaultWallet__receive_internal_simple_2830_113" [label="let ctx: Context = context()"]; - "JettonDefaultWallet__receive_internal_simple_2830_114" [label="require(ctx.sender == self.owner, \"Invalid sender\")"]; - "JettonDefaultWallet__receive_internal_simple_2830_115" [label="self.balance = self.balance - msg.amount"]; - "JettonDefaultWallet__receive_internal_simple_2830_116" [label="require(self.balance >= 0, \"Invalid balance\")"]; - "JettonDefaultWallet__receive_internal_simple_2830_117" [label="let fwdFee: Int = ctx.readForwardFee()"]; - "JettonDefaultWallet__receive_internal_simple_2830_118" [label="require(ctx.value > fwdFee + 2 * self.gasConsumption + self.minTonsForStorage, \"Invalid value - Burn\")"]; - "JettonDefaultWallet__receive_internal_simple_2830_119" [label="send(SendParameters{to: self.master, value: 0, mode: SendRemainingValue, bounce: true, body: TokenBurnNotification{queryId: msg.queryId, amount: msg.amount, owner: self.owner, response_destination: self.owner}.toCell()})",style=filled,fillcolor="#66A7DB"]; - "JettonDefaultWallet__receive_internal_simple_2830_113" -> "JettonDefaultWallet__receive_internal_simple_2830_114"; - "JettonDefaultWallet__receive_internal_simple_2830_114" -> "JettonDefaultWallet__receive_internal_simple_2830_115"; - "JettonDefaultWallet__receive_internal_simple_2830_115" -> "JettonDefaultWallet__receive_internal_simple_2830_116"; - "JettonDefaultWallet__receive_internal_simple_2830_116" -> "JettonDefaultWallet__receive_internal_simple_2830_117"; - "JettonDefaultWallet__receive_internal_simple_2830_117" -> "JettonDefaultWallet__receive_internal_simple_2830_118"; - "JettonDefaultWallet__receive_internal_simple_2830_118" -> "JettonDefaultWallet__receive_internal_simple_2830_119"; + subgraph "cluster_JettonDefaultWallet__receive_internal_simple_2832" { + label="JettonDefaultWallet__receive_internal_simple_2832"; + "JettonDefaultWallet__receive_internal_simple_2832_113" [label="let ctx: Context = context()"]; + "JettonDefaultWallet__receive_internal_simple_2832_114" [label="require(ctx.sender == self.owner, \"Invalid sender\")"]; + "JettonDefaultWallet__receive_internal_simple_2832_115" [label="self.balance = self.balance - msg.amount"]; + "JettonDefaultWallet__receive_internal_simple_2832_116" [label="require(self.balance >= 0, \"Invalid balance\")"]; + "JettonDefaultWallet__receive_internal_simple_2832_117" [label="let fwdFee: Int = ctx.readForwardFee()"]; + "JettonDefaultWallet__receive_internal_simple_2832_118" [label="require(ctx.value > fwdFee + 2 * self.gasConsumption + self.minTonsForStorage, \"Invalid value - Burn\")"]; + "JettonDefaultWallet__receive_internal_simple_2832_119" [label="send(SendParameters{to: self.master, value: 0, mode: SendRemainingValue, bounce: true, body: TokenBurnNotification{queryId: msg.queryId, amount: msg.amount, owner: self.owner, response_destination: self.owner}.toCell()})",style=filled,fillcolor="#66A7DB"]; + "JettonDefaultWallet__receive_internal_simple_2832_113" -> "JettonDefaultWallet__receive_internal_simple_2832_114"; + "JettonDefaultWallet__receive_internal_simple_2832_114" -> "JettonDefaultWallet__receive_internal_simple_2832_115"; + "JettonDefaultWallet__receive_internal_simple_2832_115" -> "JettonDefaultWallet__receive_internal_simple_2832_116"; + "JettonDefaultWallet__receive_internal_simple_2832_116" -> "JettonDefaultWallet__receive_internal_simple_2832_117"; + "JettonDefaultWallet__receive_internal_simple_2832_117" -> "JettonDefaultWallet__receive_internal_simple_2832_118"; + "JettonDefaultWallet__receive_internal_simple_2832_118" -> "JettonDefaultWallet__receive_internal_simple_2832_119"; } - subgraph "cluster_JettonDefaultWallet__receive_bounce_2874" { - label="JettonDefaultWallet__receive_bounce_2874"; - "JettonDefaultWallet__receive_bounce_2874_120" [label="let op: Int = msg.loadUint(32)"]; - "JettonDefaultWallet__receive_bounce_2874_121" [label="let queryId: Int = msg.loadUint(64)"]; - "JettonDefaultWallet__receive_bounce_2874_122" [label="let jettonAmount: Int = msg.loadCoins()"]; - "JettonDefaultWallet__receive_bounce_2874_123" [label="require(op == 0x178d4519 || op == 0x7bdd97de, \"Invalid bounced message\")"]; - "JettonDefaultWallet__receive_bounce_2874_124" [label="self.balance = self.balance + jettonAmount",style=filled,fillcolor="#66A7DB"]; - "JettonDefaultWallet__receive_bounce_2874_120" -> "JettonDefaultWallet__receive_bounce_2874_121"; - "JettonDefaultWallet__receive_bounce_2874_121" -> "JettonDefaultWallet__receive_bounce_2874_122"; - "JettonDefaultWallet__receive_bounce_2874_122" -> "JettonDefaultWallet__receive_bounce_2874_123"; - "JettonDefaultWallet__receive_bounce_2874_123" -> "JettonDefaultWallet__receive_bounce_2874_124"; + subgraph "cluster_JettonDefaultWallet__receive_bounce_2876" { + label="JettonDefaultWallet__receive_bounce_2876"; + "JettonDefaultWallet__receive_bounce_2876_120" [label="let op: Int = msg.loadUint(32)"]; + "JettonDefaultWallet__receive_bounce_2876_121" [label="let queryId: Int = msg.loadUint(64)"]; + "JettonDefaultWallet__receive_bounce_2876_122" [label="let jettonAmount: Int = msg.loadCoins()"]; + "JettonDefaultWallet__receive_bounce_2876_123" [label="require(op == 0x178d4519 || op == 0x7bdd97de, \"Invalid bounced message\")"]; + "JettonDefaultWallet__receive_bounce_2876_124" [label="self.balance = self.balance + jettonAmount",style=filled,fillcolor="#66A7DB"]; + "JettonDefaultWallet__receive_bounce_2876_120" -> "JettonDefaultWallet__receive_bounce_2876_121"; + "JettonDefaultWallet__receive_bounce_2876_121" -> "JettonDefaultWallet__receive_bounce_2876_122"; + "JettonDefaultWallet__receive_bounce_2876_122" -> "JettonDefaultWallet__receive_bounce_2876_123"; + "JettonDefaultWallet__receive_bounce_2876_123" -> "JettonDefaultWallet__receive_bounce_2876_124"; } subgraph "cluster_JettonDefaultWallet__get_wallet_data" { label="JettonDefaultWallet__get_wallet_data"; diff --git a/test/all/sample-jetton.expected.cfg.json b/test/all/sample-jetton.expected.cfg.json index 3e1ac753..282466e8 100644 --- a/test/all/sample-jetton.expected.cfg.json +++ b/test/all/sample-jetton.expected.cfg.json @@ -6,12 +6,12 @@ "name": "SampleJetton", "methods": [ { - "name": "SampleJetton.init_1905", + "name": "SampleJetton.init_1907", "cfg": { "nodes": [ { "id": 68, - "stmtID": 1794, + "stmtID": 1796, "srcEdges": [], "dstEdges": [ 57 @@ -19,7 +19,7 @@ }, { "id": 69, - "stmtID": 1799, + "stmtID": 1801, "srcEdges": [ 57 ], @@ -29,7 +29,7 @@ }, { "id": 70, - "stmtID": 1804, + "stmtID": 1806, "srcEdges": [ 58 ], @@ -39,7 +39,7 @@ }, { "id": 71, - "stmtID": 1809, + "stmtID": 1811, "srcEdges": [ 59 ], @@ -49,7 +49,7 @@ }, { "id": 72, - "stmtID": 1814, + "stmtID": 1816, "srcEdges": [ 60 ], @@ -81,12 +81,12 @@ } }, { - "name": "SampleJetton.receive_internal_simple_1855", + "name": "SampleJetton.receive_internal_simple_1857", "cfg": { "nodes": [ { "id": 73, - "stmtID": 1823, + "stmtID": 1825, "srcEdges": [], "dstEdges": [ 61 @@ -94,7 +94,7 @@ }, { "id": 74, - "stmtID": 1834, + "stmtID": 1836, "srcEdges": [ 61 ], @@ -104,7 +104,7 @@ }, { "id": 75, - "stmtID": 1841, + "stmtID": 1843, "srcEdges": [ 62 ], @@ -114,7 +114,7 @@ }, { "id": 76, - "stmtID": 1854, + "stmtID": 1856, "srcEdges": [ 63 ], @@ -141,12 +141,12 @@ } }, { - "name": "SampleJetton.receive_internal_comment_1880_Mint: 100", + "name": "SampleJetton.receive_internal_comment_1882_Mint: 100", "cfg": { "nodes": [ { "id": 77, - "stmtID": 1861, + "stmtID": 1863, "srcEdges": [], "dstEdges": [ 64 @@ -154,7 +154,7 @@ }, { "id": 78, - "stmtID": 1868, + "stmtID": 1870, "srcEdges": [ 64 ], @@ -164,7 +164,7 @@ }, { "id": 79, - "stmtID": 1879, + "stmtID": 1881, "srcEdges": [ 65 ], @@ -186,12 +186,12 @@ } }, { - "name": "SampleJetton.receive_internal_comment_1903_Owner: MintClose", + "name": "SampleJetton.receive_internal_comment_1905_Owner: MintClose", "cfg": { "nodes": [ { "id": 80, - "stmtID": 1886, + "stmtID": 1888, "srcEdges": [], "dstEdges": [ 66 @@ -199,7 +199,7 @@ }, { "id": 81, - "stmtID": 1897, + "stmtID": 1899, "srcEdges": [ 66 ], @@ -209,7 +209,7 @@ }, { "id": 82, - "stmtID": 1902, + "stmtID": 1904, "srcEdges": [ 67 ], @@ -236,12 +236,12 @@ "name": "JettonDefaultWallet", "methods": [ { - "name": "JettonDefaultWallet.init_2908", + "name": "JettonDefaultWallet.init_2910", "cfg": { "nodes": [ { "id": 83, - "stmtID": 2346, + "stmtID": 2348, "srcEdges": [], "dstEdges": [ 68 @@ -249,7 +249,7 @@ }, { "id": 84, - "stmtID": 2351, + "stmtID": 2353, "srcEdges": [ 68 ], @@ -259,7 +259,7 @@ }, { "id": 85, - "stmtID": 2356, + "stmtID": 2358, "srcEdges": [ 69 ], @@ -281,12 +281,12 @@ } }, { - "name": "JettonDefaultWallet.receive_internal_simple_2515", + "name": "JettonDefaultWallet.receive_internal_simple_2517", "cfg": { "nodes": [ { "id": 86, - "stmtID": 2365, + "stmtID": 2367, "srcEdges": [], "dstEdges": [ 70 @@ -294,7 +294,7 @@ }, { "id": 87, - "stmtID": 2376, + "stmtID": 2378, "srcEdges": [ 70 ], @@ -304,7 +304,7 @@ }, { "id": 88, - "stmtID": 2386, + "stmtID": 2388, "srcEdges": [ 71 ], @@ -314,7 +314,7 @@ }, { "id": 89, - "stmtID": 2400, + "stmtID": 2402, "srcEdges": [ 72 ], @@ -324,7 +324,7 @@ }, { "id": 90, - "stmtID": 2414, + "stmtID": 2416, "srcEdges": [ 73 ], @@ -334,7 +334,7 @@ }, { "id": 91, - "stmtID": 2425, + "stmtID": 2427, "srcEdges": [ 74 ], @@ -344,7 +344,7 @@ }, { "id": 92, - "stmtID": 2434, + "stmtID": 2436, "srcEdges": [ 75 ], @@ -354,7 +354,7 @@ }, { "id": 93, - "stmtID": 2445, + "stmtID": 2447, "srcEdges": [ 76 ], @@ -364,7 +364,7 @@ }, { "id": 94, - "stmtID": 2451, + "stmtID": 2453, "srcEdges": [ 77 ], @@ -374,7 +374,7 @@ }, { "id": 95, - "stmtID": 2514, + "stmtID": 2516, "srcEdges": [ 78 ], @@ -431,12 +431,12 @@ } }, { - "name": "JettonDefaultWallet.receive_internal_simple_2685", + "name": "JettonDefaultWallet.receive_internal_simple_2687", "cfg": { "nodes": [ { "id": 96, - "stmtID": 2523, + "stmtID": 2525, "srcEdges": [], "dstEdges": [ 79 @@ -444,7 +444,7 @@ }, { "id": 97, - "stmtID": 2553, + "stmtID": 2555, "srcEdges": [ 79 ], @@ -454,7 +454,7 @@ }, { "id": 98, - "stmtID": 2541, + "stmtID": 2543, "srcEdges": [ 80 ], @@ -464,7 +464,7 @@ }, { "id": 99, - "stmtID": 2552, + "stmtID": 2554, "srcEdges": [ 81 ], @@ -474,7 +474,7 @@ }, { "id": 100, - "stmtID": 2564, + "stmtID": 2566, "srcEdges": [ 82 ], @@ -484,7 +484,7 @@ }, { "id": 101, - "stmtID": 2573, + "stmtID": 2575, "srcEdges": [ 83 ], @@ -494,7 +494,7 @@ }, { "id": 102, - "stmtID": 2623, + "stmtID": 2625, "srcEdges": [ 84 ], @@ -504,7 +504,7 @@ }, { "id": 103, - "stmtID": 2622, + "stmtID": 2624, "srcEdges": [ 85 ], @@ -514,7 +514,7 @@ }, { "id": 104, - "stmtID": 2632, + "stmtID": 2634, "srcEdges": [ 86 ], @@ -524,7 +524,7 @@ }, { "id": 105, - "stmtID": 2638, + "stmtID": 2640, "srcEdges": [ 87 ], @@ -534,7 +534,7 @@ }, { "id": 106, - "stmtID": 2647, + "stmtID": 2649, "srcEdges": [ 88 ], @@ -544,7 +544,7 @@ }, { "id": 107, - "stmtID": 2684, + "stmtID": 2686, "srcEdges": [ 89 ], @@ -554,7 +554,7 @@ }, { "id": 108, - "stmtID": 2683, + "stmtID": 2685, "srcEdges": [ 90 ], @@ -631,7 +631,7 @@ "nodes": [ { "id": 109, - "stmtID": 2697, + "stmtID": 2699, "srcEdges": [], "dstEdges": [ 91 @@ -639,7 +639,7 @@ }, { "id": 110, - "stmtID": 2710, + "stmtID": 2712, "srcEdges": [ 91 ], @@ -649,7 +649,7 @@ }, { "id": 111, - "stmtID": 2717, + "stmtID": 2719, "srcEdges": [ 92 ], @@ -659,7 +659,7 @@ }, { "id": 112, - "stmtID": 2719, + "stmtID": 2721, "srcEdges": [ 93 ], @@ -686,12 +686,12 @@ } }, { - "name": "JettonDefaultWallet.receive_internal_simple_2830", + "name": "JettonDefaultWallet.receive_internal_simple_2832", "cfg": { "nodes": [ { "id": 113, - "stmtID": 2728, + "stmtID": 2730, "srcEdges": [], "dstEdges": [ 94 @@ -699,7 +699,7 @@ }, { "id": 114, - "stmtID": 2739, + "stmtID": 2741, "srcEdges": [ 94 ], @@ -709,7 +709,7 @@ }, { "id": 115, - "stmtID": 2750, + "stmtID": 2752, "srcEdges": [ 95 ], @@ -719,7 +719,7 @@ }, { "id": 116, - "stmtID": 2759, + "stmtID": 2761, "srcEdges": [ 96 ], @@ -729,7 +729,7 @@ }, { "id": 117, - "stmtID": 2765, + "stmtID": 2767, "srcEdges": [ 97 ], @@ -739,7 +739,7 @@ }, { "id": 118, - "stmtID": 2784, + "stmtID": 2786, "srcEdges": [ 98 ], @@ -749,7 +749,7 @@ }, { "id": 119, - "stmtID": 2829, + "stmtID": 2831, "srcEdges": [ 99 ], @@ -791,12 +791,12 @@ } }, { - "name": "JettonDefaultWallet.receive_bounce_2874", + "name": "JettonDefaultWallet.receive_bounce_2876", "cfg": { "nodes": [ { "id": 120, - "stmtID": 2840, + "stmtID": 2842, "srcEdges": [], "dstEdges": [ 100 @@ -804,7 +804,7 @@ }, { "id": 121, - "stmtID": 2847, + "stmtID": 2849, "srcEdges": [ 100 ], @@ -814,7 +814,7 @@ }, { "id": 122, - "stmtID": 2853, + "stmtID": 2855, "srcEdges": [ 101 ], @@ -824,7 +824,7 @@ }, { "id": 123, - "stmtID": 2864, + "stmtID": 2866, "srcEdges": [ 102 ], @@ -834,7 +834,7 @@ }, { "id": 124, - "stmtID": 2873, + "stmtID": 2875, "srcEdges": [ 103 ], @@ -871,7 +871,7 @@ "nodes": [ { "id": 125, - "stmtID": 2906, + "stmtID": 2908, "srcEdges": [], "dstEdges": [] } diff --git a/test/all/sample-jetton.expected.cfg.mmd b/test/all/sample-jetton.expected.cfg.mmd index b2cbd227..15a6eeab 100644 --- a/test/all/sample-jetton.expected.cfg.mmd +++ b/test/all/sample-jetton.expected.cfg.mmd @@ -1,92 +1,92 @@ graph TD -subgraph SampleJetton__init_1905 - SampleJetton__init_1905_68["self.totalSupply = 0"] - SampleJetton__init_1905_69["self.max_supply = max_supply"] - SampleJetton__init_1905_70["self.owner = owner"] - SampleJetton__init_1905_71["self.mintable = true"] - SampleJetton__init_1905_72["self.content = content"]:::exitNode - SampleJetton__init_1905_68 --> SampleJetton__init_1905_69 - SampleJetton__init_1905_69 --> SampleJetton__init_1905_70 - SampleJetton__init_1905_70 --> SampleJetton__init_1905_71 - SampleJetton__init_1905_71 --> SampleJetton__init_1905_72 +subgraph SampleJetton__init_1907 + SampleJetton__init_1907_68["self.totalSupply = 0"] + SampleJetton__init_1907_69["self.max_supply = max_supply"] + SampleJetton__init_1907_70["self.owner = owner"] + SampleJetton__init_1907_71["self.mintable = true"] + SampleJetton__init_1907_72["self.content = content"]:::exitNode + SampleJetton__init_1907_68 --> SampleJetton__init_1907_69 + SampleJetton__init_1907_69 --> SampleJetton__init_1907_70 + SampleJetton__init_1907_70 --> SampleJetton__init_1907_71 + SampleJetton__init_1907_71 --> SampleJetton__init_1907_72 end -subgraph SampleJetton__receive_internal_simple_1855 - SampleJetton__receive_internal_simple_1855_73["let ctx: Context = context()"] - SampleJetton__receive_internal_simple_1855_74["require(ctx.sender == self.owner, 'Not Owner')"] - SampleJetton__receive_internal_simple_1855_75["require(self.mintable, 'Can't Mint Anymore')"] - SampleJetton__receive_internal_simple_1855_76["self.mint(msg.receiver, msg.amount, self.owner)"]:::exitNode - SampleJetton__receive_internal_simple_1855_73 --> SampleJetton__receive_internal_simple_1855_74 - SampleJetton__receive_internal_simple_1855_74 --> SampleJetton__receive_internal_simple_1855_75 - SampleJetton__receive_internal_simple_1855_75 --> SampleJetton__receive_internal_simple_1855_76 +subgraph SampleJetton__receive_internal_simple_1857 + SampleJetton__receive_internal_simple_1857_73["let ctx: Context = context()"] + SampleJetton__receive_internal_simple_1857_74["require(ctx.sender == self.owner, 'Not Owner')"] + SampleJetton__receive_internal_simple_1857_75["require(self.mintable, 'Can't Mint Anymore')"] + SampleJetton__receive_internal_simple_1857_76["self.mint(msg.receiver, msg.amount, self.owner)"]:::exitNode + SampleJetton__receive_internal_simple_1857_73 --> SampleJetton__receive_internal_simple_1857_74 + SampleJetton__receive_internal_simple_1857_74 --> SampleJetton__receive_internal_simple_1857_75 + SampleJetton__receive_internal_simple_1857_75 --> SampleJetton__receive_internal_simple_1857_76 end -subgraph SampleJetton__receive_internal_comment_1880_Mint__100 - SampleJetton__receive_internal_comment_1880_Mint__100_77["let ctx: Context = context()"] - SampleJetton__receive_internal_comment_1880_Mint__100_78["require(self.mintable, 'Can't Mint Anymore')"] - SampleJetton__receive_internal_comment_1880_Mint__100_79["self.mint(ctx.sender, 100, self.owner)"]:::exitNode - SampleJetton__receive_internal_comment_1880_Mint__100_77 --> SampleJetton__receive_internal_comment_1880_Mint__100_78 - SampleJetton__receive_internal_comment_1880_Mint__100_78 --> SampleJetton__receive_internal_comment_1880_Mint__100_79 +subgraph SampleJetton__receive_internal_comment_1882_Mint__100 + SampleJetton__receive_internal_comment_1882_Mint__100_77["let ctx: Context = context()"] + SampleJetton__receive_internal_comment_1882_Mint__100_78["require(self.mintable, 'Can't Mint Anymore')"] + SampleJetton__receive_internal_comment_1882_Mint__100_79["self.mint(ctx.sender, 100, self.owner)"]:::exitNode + SampleJetton__receive_internal_comment_1882_Mint__100_77 --> SampleJetton__receive_internal_comment_1882_Mint__100_78 + SampleJetton__receive_internal_comment_1882_Mint__100_78 --> SampleJetton__receive_internal_comment_1882_Mint__100_79 end -subgraph SampleJetton__receive_internal_comment_1903_Owner__MintClose - SampleJetton__receive_internal_comment_1903_Owner__MintClose_80["let ctx: Context = context()"] - SampleJetton__receive_internal_comment_1903_Owner__MintClose_81["require(ctx.sender == self.owner, 'Not Owner')"] - SampleJetton__receive_internal_comment_1903_Owner__MintClose_82["self.mintable = false"]:::exitNode - SampleJetton__receive_internal_comment_1903_Owner__MintClose_80 --> SampleJetton__receive_internal_comment_1903_Owner__MintClose_81 - SampleJetton__receive_internal_comment_1903_Owner__MintClose_81 --> SampleJetton__receive_internal_comment_1903_Owner__MintClose_82 +subgraph SampleJetton__receive_internal_comment_1905_Owner__MintClose + SampleJetton__receive_internal_comment_1905_Owner__MintClose_80["let ctx: Context = context()"] + SampleJetton__receive_internal_comment_1905_Owner__MintClose_81["require(ctx.sender == self.owner, 'Not Owner')"] + SampleJetton__receive_internal_comment_1905_Owner__MintClose_82["self.mintable = false"]:::exitNode + SampleJetton__receive_internal_comment_1905_Owner__MintClose_80 --> SampleJetton__receive_internal_comment_1905_Owner__MintClose_81 + SampleJetton__receive_internal_comment_1905_Owner__MintClose_81 --> SampleJetton__receive_internal_comment_1905_Owner__MintClose_82 end -subgraph JettonDefaultWallet__init_2908 - JettonDefaultWallet__init_2908_83["self.balance = 0"] - JettonDefaultWallet__init_2908_84["self.owner = owner"] - JettonDefaultWallet__init_2908_85["self.master = master"]:::exitNode - JettonDefaultWallet__init_2908_83 --> JettonDefaultWallet__init_2908_84 - JettonDefaultWallet__init_2908_84 --> JettonDefaultWallet__init_2908_85 +subgraph JettonDefaultWallet__init_2910 + JettonDefaultWallet__init_2910_83["self.balance = 0"] + JettonDefaultWallet__init_2910_84["self.owner = owner"] + JettonDefaultWallet__init_2910_85["self.master = master"]:::exitNode + JettonDefaultWallet__init_2910_83 --> JettonDefaultWallet__init_2910_84 + JettonDefaultWallet__init_2910_84 --> JettonDefaultWallet__init_2910_85 end -subgraph JettonDefaultWallet__receive_internal_simple_2515 - JettonDefaultWallet__receive_internal_simple_2515_86["let ctx: Context = context()"] - JettonDefaultWallet__receive_internal_simple_2515_87["require(ctx.sender == self.owner, 'Invalid sender')"] - JettonDefaultWallet__receive_internal_simple_2515_88["let fwdFee: Int = ctx.readForwardFee() + ctx.readForwardFee()"] - JettonDefaultWallet__receive_internal_simple_2515_89["let final: Int = 2 * self.gasConsumption + self.minTonsForStorage + fwdFee"] - JettonDefaultWallet__receive_internal_simple_2515_90["require(ctx.value > min(final, ton('0.01')), 'Invalid value!!')"] - JettonDefaultWallet__receive_internal_simple_2515_91["self.balance = self.balance - msg.amount"] - JettonDefaultWallet__receive_internal_simple_2515_92["require(self.balance >= 0, 'Invalid balance')"] - JettonDefaultWallet__receive_internal_simple_2515_93["let init: StateInit = initOf JettonDefaultWallet(self.master, msg.destination)"] - JettonDefaultWallet__receive_internal_simple_2515_94["let walletAddress: Address = contractAddress(init)"] - JettonDefaultWallet__receive_internal_simple_2515_95["send(SendParameters{to: walletAddress, value: 0, mode: SendRemainingValue, bounce: false, body: TokenTransferInternal{queryId: msg.queryId, amount: msg.amount, from: self.owner, response_destination: msg.response_destination, forward_ton_amount: msg.forward_ton_amount, forward_payload: msg.forward_payload}.toCell(), code: init.code, data: init.data})"]:::exitNode - JettonDefaultWallet__receive_internal_simple_2515_86 --> JettonDefaultWallet__receive_internal_simple_2515_87 - JettonDefaultWallet__receive_internal_simple_2515_87 --> JettonDefaultWallet__receive_internal_simple_2515_88 - JettonDefaultWallet__receive_internal_simple_2515_88 --> JettonDefaultWallet__receive_internal_simple_2515_89 - JettonDefaultWallet__receive_internal_simple_2515_89 --> JettonDefaultWallet__receive_internal_simple_2515_90 - JettonDefaultWallet__receive_internal_simple_2515_90 --> JettonDefaultWallet__receive_internal_simple_2515_91 - JettonDefaultWallet__receive_internal_simple_2515_91 --> JettonDefaultWallet__receive_internal_simple_2515_92 - JettonDefaultWallet__receive_internal_simple_2515_92 --> JettonDefaultWallet__receive_internal_simple_2515_93 - JettonDefaultWallet__receive_internal_simple_2515_93 --> JettonDefaultWallet__receive_internal_simple_2515_94 - JettonDefaultWallet__receive_internal_simple_2515_94 --> JettonDefaultWallet__receive_internal_simple_2515_95 +subgraph JettonDefaultWallet__receive_internal_simple_2517 + JettonDefaultWallet__receive_internal_simple_2517_86["let ctx: Context = context()"] + JettonDefaultWallet__receive_internal_simple_2517_87["require(ctx.sender == self.owner, 'Invalid sender')"] + JettonDefaultWallet__receive_internal_simple_2517_88["let fwdFee: Int = ctx.readForwardFee() + ctx.readForwardFee()"] + JettonDefaultWallet__receive_internal_simple_2517_89["let final: Int = 2 * self.gasConsumption + self.minTonsForStorage + fwdFee"] + JettonDefaultWallet__receive_internal_simple_2517_90["require(ctx.value > min(final, ton('0.01')), 'Invalid value!!')"] + JettonDefaultWallet__receive_internal_simple_2517_91["self.balance = self.balance - msg.amount"] + JettonDefaultWallet__receive_internal_simple_2517_92["require(self.balance >= 0, 'Invalid balance')"] + JettonDefaultWallet__receive_internal_simple_2517_93["let init: StateInit = initOf JettonDefaultWallet(self.master, msg.destination)"] + JettonDefaultWallet__receive_internal_simple_2517_94["let walletAddress: Address = contractAddress(init)"] + JettonDefaultWallet__receive_internal_simple_2517_95["send(SendParameters{to: walletAddress, value: 0, mode: SendRemainingValue, bounce: false, body: TokenTransferInternal{queryId: msg.queryId, amount: msg.amount, from: self.owner, response_destination: msg.response_destination, forward_ton_amount: msg.forward_ton_amount, forward_payload: msg.forward_payload}.toCell(), code: init.code, data: init.data})"]:::exitNode + JettonDefaultWallet__receive_internal_simple_2517_86 --> JettonDefaultWallet__receive_internal_simple_2517_87 + JettonDefaultWallet__receive_internal_simple_2517_87 --> JettonDefaultWallet__receive_internal_simple_2517_88 + JettonDefaultWallet__receive_internal_simple_2517_88 --> JettonDefaultWallet__receive_internal_simple_2517_89 + JettonDefaultWallet__receive_internal_simple_2517_89 --> JettonDefaultWallet__receive_internal_simple_2517_90 + JettonDefaultWallet__receive_internal_simple_2517_90 --> JettonDefaultWallet__receive_internal_simple_2517_91 + JettonDefaultWallet__receive_internal_simple_2517_91 --> JettonDefaultWallet__receive_internal_simple_2517_92 + JettonDefaultWallet__receive_internal_simple_2517_92 --> JettonDefaultWallet__receive_internal_simple_2517_93 + JettonDefaultWallet__receive_internal_simple_2517_93 --> JettonDefaultWallet__receive_internal_simple_2517_94 + JettonDefaultWallet__receive_internal_simple_2517_94 --> JettonDefaultWallet__receive_internal_simple_2517_95 end -subgraph JettonDefaultWallet__receive_internal_simple_2685 - JettonDefaultWallet__receive_internal_simple_2685_96["let ctx: Context = context()"] - JettonDefaultWallet__receive_internal_simple_2685_97["if (ctx.sender != self.master)"] - JettonDefaultWallet__receive_internal_simple_2685_98["let sInit: StateInit = initOf JettonDefaultWallet(self.master, msg.from)"] - JettonDefaultWallet__receive_internal_simple_2685_99["require(contractAddress(sInit) == ctx.sender, 'Invalid sender!')"] - JettonDefaultWallet__receive_internal_simple_2685_100["self.balance = self.balance + msg.amount"] - JettonDefaultWallet__receive_internal_simple_2685_101["require(self.balance >= 0, 'Invalid balance')"] - JettonDefaultWallet__receive_internal_simple_2685_102["if (msg.forward_ton_amount > 0)"] - JettonDefaultWallet__receive_internal_simple_2685_103["send(SendParameters{to: self.owner, value: msg.forward_ton_amount, bounce: false, body: TokenNotification{queryId: msg.queryId, amount: msg.amount, from: msg.from, forward_payload: msg.forward_payload}.toCell()})"] - JettonDefaultWallet__receive_internal_simple_2685_104["let msgValue: Int = self.msgValue(ctx.value)"] - JettonDefaultWallet__receive_internal_simple_2685_105["let fwdFee: Int = ctx.readForwardFee()"] - JettonDefaultWallet__receive_internal_simple_2685_106["msgValue = msgValue - msg.forward_ton_amount - fwdFee"] - JettonDefaultWallet__receive_internal_simple_2685_107["if (msg.response_destination != null)"] - JettonDefaultWallet__receive_internal_simple_2685_108["send(SendParameters{to: !!msg.response_destination, value: msgValue, bounce: false, body: TokenExcesses{queryId: msg.queryId}.toCell(), mode: SendIgnoreErrors})"]:::exitNode - JettonDefaultWallet__receive_internal_simple_2685_96 --> JettonDefaultWallet__receive_internal_simple_2685_97 - JettonDefaultWallet__receive_internal_simple_2685_97 --> JettonDefaultWallet__receive_internal_simple_2685_98 - JettonDefaultWallet__receive_internal_simple_2685_98 --> JettonDefaultWallet__receive_internal_simple_2685_99 - JettonDefaultWallet__receive_internal_simple_2685_99 --> JettonDefaultWallet__receive_internal_simple_2685_100 - JettonDefaultWallet__receive_internal_simple_2685_100 --> JettonDefaultWallet__receive_internal_simple_2685_101 - JettonDefaultWallet__receive_internal_simple_2685_101 --> JettonDefaultWallet__receive_internal_simple_2685_102 - JettonDefaultWallet__receive_internal_simple_2685_102 --> JettonDefaultWallet__receive_internal_simple_2685_103 - JettonDefaultWallet__receive_internal_simple_2685_103 --> JettonDefaultWallet__receive_internal_simple_2685_104 - JettonDefaultWallet__receive_internal_simple_2685_104 --> JettonDefaultWallet__receive_internal_simple_2685_105 - JettonDefaultWallet__receive_internal_simple_2685_105 --> JettonDefaultWallet__receive_internal_simple_2685_106 - JettonDefaultWallet__receive_internal_simple_2685_106 --> JettonDefaultWallet__receive_internal_simple_2685_107 - JettonDefaultWallet__receive_internal_simple_2685_107 --> JettonDefaultWallet__receive_internal_simple_2685_108 +subgraph JettonDefaultWallet__receive_internal_simple_2687 + JettonDefaultWallet__receive_internal_simple_2687_96["let ctx: Context = context()"] + JettonDefaultWallet__receive_internal_simple_2687_97["if (ctx.sender != self.master)"] + JettonDefaultWallet__receive_internal_simple_2687_98["let sInit: StateInit = initOf JettonDefaultWallet(self.master, msg.from)"] + JettonDefaultWallet__receive_internal_simple_2687_99["require(contractAddress(sInit) == ctx.sender, 'Invalid sender!')"] + JettonDefaultWallet__receive_internal_simple_2687_100["self.balance = self.balance + msg.amount"] + JettonDefaultWallet__receive_internal_simple_2687_101["require(self.balance >= 0, 'Invalid balance')"] + JettonDefaultWallet__receive_internal_simple_2687_102["if (msg.forward_ton_amount > 0)"] + JettonDefaultWallet__receive_internal_simple_2687_103["send(SendParameters{to: self.owner, value: msg.forward_ton_amount, bounce: false, body: TokenNotification{queryId: msg.queryId, amount: msg.amount, from: msg.from, forward_payload: msg.forward_payload}.toCell()})"] + JettonDefaultWallet__receive_internal_simple_2687_104["let msgValue: Int = self.msgValue(ctx.value)"] + JettonDefaultWallet__receive_internal_simple_2687_105["let fwdFee: Int = ctx.readForwardFee()"] + JettonDefaultWallet__receive_internal_simple_2687_106["msgValue = msgValue - msg.forward_ton_amount - fwdFee"] + JettonDefaultWallet__receive_internal_simple_2687_107["if (msg.response_destination != null)"] + JettonDefaultWallet__receive_internal_simple_2687_108["send(SendParameters{to: !!msg.response_destination, value: msgValue, bounce: false, body: TokenExcesses{queryId: msg.queryId}.toCell(), mode: SendIgnoreErrors})"]:::exitNode + JettonDefaultWallet__receive_internal_simple_2687_96 --> JettonDefaultWallet__receive_internal_simple_2687_97 + JettonDefaultWallet__receive_internal_simple_2687_97 --> JettonDefaultWallet__receive_internal_simple_2687_98 + JettonDefaultWallet__receive_internal_simple_2687_98 --> JettonDefaultWallet__receive_internal_simple_2687_99 + JettonDefaultWallet__receive_internal_simple_2687_99 --> JettonDefaultWallet__receive_internal_simple_2687_100 + JettonDefaultWallet__receive_internal_simple_2687_100 --> JettonDefaultWallet__receive_internal_simple_2687_101 + JettonDefaultWallet__receive_internal_simple_2687_101 --> JettonDefaultWallet__receive_internal_simple_2687_102 + JettonDefaultWallet__receive_internal_simple_2687_102 --> JettonDefaultWallet__receive_internal_simple_2687_103 + JettonDefaultWallet__receive_internal_simple_2687_103 --> JettonDefaultWallet__receive_internal_simple_2687_104 + JettonDefaultWallet__receive_internal_simple_2687_104 --> JettonDefaultWallet__receive_internal_simple_2687_105 + JettonDefaultWallet__receive_internal_simple_2687_105 --> JettonDefaultWallet__receive_internal_simple_2687_106 + JettonDefaultWallet__receive_internal_simple_2687_106 --> JettonDefaultWallet__receive_internal_simple_2687_107 + JettonDefaultWallet__receive_internal_simple_2687_107 --> JettonDefaultWallet__receive_internal_simple_2687_108 end subgraph JettonDefaultWallet__msgValue JettonDefaultWallet__msgValue_109["let tonBalanceBeforeMsg: Int = myBalance() - value"] @@ -97,31 +97,31 @@ subgraph JettonDefaultWallet__msgValue JettonDefaultWallet__msgValue_110 --> JettonDefaultWallet__msgValue_111 JettonDefaultWallet__msgValue_111 --> JettonDefaultWallet__msgValue_112 end -subgraph JettonDefaultWallet__receive_internal_simple_2830 - JettonDefaultWallet__receive_internal_simple_2830_113["let ctx: Context = context()"] - JettonDefaultWallet__receive_internal_simple_2830_114["require(ctx.sender == self.owner, 'Invalid sender')"] - JettonDefaultWallet__receive_internal_simple_2830_115["self.balance = self.balance - msg.amount"] - JettonDefaultWallet__receive_internal_simple_2830_116["require(self.balance >= 0, 'Invalid balance')"] - JettonDefaultWallet__receive_internal_simple_2830_117["let fwdFee: Int = ctx.readForwardFee()"] - JettonDefaultWallet__receive_internal_simple_2830_118["require(ctx.value > fwdFee + 2 * self.gasConsumption + self.minTonsForStorage, 'Invalid value - Burn')"] - JettonDefaultWallet__receive_internal_simple_2830_119["send(SendParameters{to: self.master, value: 0, mode: SendRemainingValue, bounce: true, body: TokenBurnNotification{queryId: msg.queryId, amount: msg.amount, owner: self.owner, response_destination: self.owner}.toCell()})"]:::exitNode - JettonDefaultWallet__receive_internal_simple_2830_113 --> JettonDefaultWallet__receive_internal_simple_2830_114 - JettonDefaultWallet__receive_internal_simple_2830_114 --> JettonDefaultWallet__receive_internal_simple_2830_115 - JettonDefaultWallet__receive_internal_simple_2830_115 --> JettonDefaultWallet__receive_internal_simple_2830_116 - JettonDefaultWallet__receive_internal_simple_2830_116 --> JettonDefaultWallet__receive_internal_simple_2830_117 - JettonDefaultWallet__receive_internal_simple_2830_117 --> JettonDefaultWallet__receive_internal_simple_2830_118 - JettonDefaultWallet__receive_internal_simple_2830_118 --> JettonDefaultWallet__receive_internal_simple_2830_119 +subgraph JettonDefaultWallet__receive_internal_simple_2832 + JettonDefaultWallet__receive_internal_simple_2832_113["let ctx: Context = context()"] + JettonDefaultWallet__receive_internal_simple_2832_114["require(ctx.sender == self.owner, 'Invalid sender')"] + JettonDefaultWallet__receive_internal_simple_2832_115["self.balance = self.balance - msg.amount"] + JettonDefaultWallet__receive_internal_simple_2832_116["require(self.balance >= 0, 'Invalid balance')"] + JettonDefaultWallet__receive_internal_simple_2832_117["let fwdFee: Int = ctx.readForwardFee()"] + JettonDefaultWallet__receive_internal_simple_2832_118["require(ctx.value > fwdFee + 2 * self.gasConsumption + self.minTonsForStorage, 'Invalid value - Burn')"] + JettonDefaultWallet__receive_internal_simple_2832_119["send(SendParameters{to: self.master, value: 0, mode: SendRemainingValue, bounce: true, body: TokenBurnNotification{queryId: msg.queryId, amount: msg.amount, owner: self.owner, response_destination: self.owner}.toCell()})"]:::exitNode + JettonDefaultWallet__receive_internal_simple_2832_113 --> JettonDefaultWallet__receive_internal_simple_2832_114 + JettonDefaultWallet__receive_internal_simple_2832_114 --> JettonDefaultWallet__receive_internal_simple_2832_115 + JettonDefaultWallet__receive_internal_simple_2832_115 --> JettonDefaultWallet__receive_internal_simple_2832_116 + JettonDefaultWallet__receive_internal_simple_2832_116 --> JettonDefaultWallet__receive_internal_simple_2832_117 + JettonDefaultWallet__receive_internal_simple_2832_117 --> JettonDefaultWallet__receive_internal_simple_2832_118 + JettonDefaultWallet__receive_internal_simple_2832_118 --> JettonDefaultWallet__receive_internal_simple_2832_119 end -subgraph JettonDefaultWallet__receive_bounce_2874 - JettonDefaultWallet__receive_bounce_2874_120["let op: Int = msg.loadUint(32)"] - JettonDefaultWallet__receive_bounce_2874_121["let queryId: Int = msg.loadUint(64)"] - JettonDefaultWallet__receive_bounce_2874_122["let jettonAmount: Int = msg.loadCoins()"] - JettonDefaultWallet__receive_bounce_2874_123["require(op == 0x178d4519 || op == 0x7bdd97de, 'Invalid bounced message')"] - JettonDefaultWallet__receive_bounce_2874_124["self.balance = self.balance + jettonAmount"]:::exitNode - JettonDefaultWallet__receive_bounce_2874_120 --> JettonDefaultWallet__receive_bounce_2874_121 - JettonDefaultWallet__receive_bounce_2874_121 --> JettonDefaultWallet__receive_bounce_2874_122 - JettonDefaultWallet__receive_bounce_2874_122 --> JettonDefaultWallet__receive_bounce_2874_123 - JettonDefaultWallet__receive_bounce_2874_123 --> JettonDefaultWallet__receive_bounce_2874_124 +subgraph JettonDefaultWallet__receive_bounce_2876 + JettonDefaultWallet__receive_bounce_2876_120["let op: Int = msg.loadUint(32)"] + JettonDefaultWallet__receive_bounce_2876_121["let queryId: Int = msg.loadUint(64)"] + JettonDefaultWallet__receive_bounce_2876_122["let jettonAmount: Int = msg.loadCoins()"] + JettonDefaultWallet__receive_bounce_2876_123["require(op == 0x178d4519 || op == 0x7bdd97de, 'Invalid bounced message')"] + JettonDefaultWallet__receive_bounce_2876_124["self.balance = self.balance + jettonAmount"]:::exitNode + JettonDefaultWallet__receive_bounce_2876_120 --> JettonDefaultWallet__receive_bounce_2876_121 + JettonDefaultWallet__receive_bounce_2876_121 --> JettonDefaultWallet__receive_bounce_2876_122 + JettonDefaultWallet__receive_bounce_2876_122 --> JettonDefaultWallet__receive_bounce_2876_123 + JettonDefaultWallet__receive_bounce_2876_123 --> JettonDefaultWallet__receive_bounce_2876_124 end subgraph JettonDefaultWallet__get_wallet_data JettonDefaultWallet__get_wallet_data_125["return JettonWalletData{balance: self.balance, owner: self.owner, master: self.master, walletCode: initOf JettonDefaultWallet(self.master, self.owner).code}"]:::exitNode diff --git a/test/all/sample-jetton.imports.dot b/test/all/sample-jetton.imports.dot deleted file mode 100644 index 98b958d7..00000000 --- a/test/all/sample-jetton.imports.dot +++ /dev/null @@ -1,4 +0,0 @@ -digraph "ImportGraph" { - node [shape=box]; - node_1 [label="sample-jetton",style=filled,fillcolor="#90EE90"]; -} diff --git a/test/all/sample-jetton.imports.json b/test/all/sample-jetton.imports.json deleted file mode 100644 index e0f64e51..00000000 --- a/test/all/sample-jetton.imports.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "nodes": [ - { - "idx": 1, - "name": "sample-jetton", - "origin": "user", - "importPath": "test/all/sample-jetton.tact", - "language": "tact", - "hasContract": true, - "inEdges": [], - "outEdges": [ - 1 - ] - } - ], - "edges": [] -} \ No newline at end of file diff --git a/test/all/sample-jetton.imports.mmd b/test/all/sample-jetton.imports.mmd deleted file mode 100644 index 29aedb59..00000000 --- a/test/all/sample-jetton.imports.mmd +++ /dev/null @@ -1,4 +0,0 @@ -graph TD - node_1["sample-jetton"]:::contractNode - classDef contractNode fill:#90EE90,stroke:#333,stroke-width:2px; - classDef stdlibNode fill:#FFFF80,stroke:#333,stroke-width:2px; diff --git a/test/all/syntax.cfg.dot b/test/all/syntax.cfg.dot deleted file mode 100644 index 26e8f1c1..00000000 --- a/test/all/syntax.cfg.dot +++ /dev/null @@ -1,63 +0,0 @@ -digraph "syntax" { - node [shape=box]; - subgraph "cluster_test_try" { - label="test_try"; - "test_try_68" [label="try"]; - "test_try_69" [label="a += 1"]; - "test_try_70" [label="try"]; - "test_try_71" [label="try ... catch (err)"]; - "test_try_72" [label="a = 19",style=filled,fillcolor="#66A7DB"]; - "test_try_73" [label="dump(err)",style=filled,fillcolor="#66A7DB"]; - "test_try_68" -> "test_try_69"; - "test_try_69" -> "test_try_70"; - "test_try_70" -> "test_try_71"; - "test_try_71" -> "test_try_72"; - "test_try_71" -> "test_try_73"; - } - subgraph "cluster_test_loops" { - label="test_loops"; - "test_loops_74" [label="let sum: Int = 0"]; - "test_loops_75" [label="let i: Int = 0"]; - "test_loops_76" [label="while (i < 10)"]; - "test_loops_77" [label="i = i + 1"]; - "test_loops_78" [label="sum = sum + i"]; - "test_loops_79" [label="until (i > 10)"]; - "test_loops_80" [label="i = i - 1"]; - "test_loops_81" [label="sum = sum + i"]; - "test_loops_82" [label="repeat (10)"]; - "test_loops_83" [label="i = i + 1"]; - "test_loops_84" [label="sum = sum + i"]; - "test_loops_85" [label="let m: map = emptyMap()"]; - "test_loops_86" [label="foreach ((k, v) of m)"]; - "test_loops_74" -> "test_loops_75"; - "test_loops_75" -> "test_loops_76"; - "test_loops_76" -> "test_loops_77"; - "test_loops_77" -> "test_loops_78"; - "test_loops_78" -> "test_loops_76"; - "test_loops_76" -> "test_loops_79"; - "test_loops_79" -> "test_loops_80"; - "test_loops_80" -> "test_loops_81"; - "test_loops_81" -> "test_loops_79"; - "test_loops_79" -> "test_loops_82"; - "test_loops_82" -> "test_loops_83"; - "test_loops_83" -> "test_loops_84"; - "test_loops_84" -> "test_loops_82"; - "test_loops_82" -> "test_loops_85"; - "test_loops_85" -> "test_loops_86"; - "test_loops_86" -> "test_loops_86"; - } - subgraph "cluster_TestContract__getter" { - label="TestContract__getter"; - "TestContract__getter_87" [label="return 0",style=filled,fillcolor="#66A7DB"]; - } - subgraph "cluster_TestContractF__test" { - label="TestContractF__test"; - } - subgraph "cluster_TestContractT__test" { - label="TestContractT__test"; - "TestContractT__test_88" [label="return self.getA()",style=filled,fillcolor="#66A7DB"]; - } - subgraph "cluster_TestContractT__receive_external_fallback_1722" { - label="TestContractT__receive_external_fallback_1722"; - } -} diff --git a/test/all/syntax.cfg.json b/test/all/syntax.cfg.json deleted file mode 100644 index b45bd0b2..00000000 --- a/test/all/syntax.cfg.json +++ /dev/null @@ -1,377 +0,0 @@ -{ - "projectName": "syntax", - "functions": [ - { - "name": "test_try", - "cfg": { - "nodes": [ - { - "id": 68, - "stmtID": 1732, - "srcEdges": [], - "dstEdges": [ - 57 - ] - }, - { - "id": 69, - "stmtID": 1731, - "srcEdges": [ - 57 - ], - "dstEdges": [ - 58 - ] - }, - { - "id": 70, - "stmtID": 1733, - "srcEdges": [ - 58 - ], - "dstEdges": [ - 59 - ] - }, - { - "id": 71, - "stmtID": 1742, - "srcEdges": [ - 59 - ], - "dstEdges": [ - 60, - 61 - ] - }, - { - "id": 72, - "stmtID": 1736, - "srcEdges": [ - 60 - ], - "dstEdges": [] - }, - { - "id": 73, - "stmtID": 1741, - "srcEdges": [ - 61 - ], - "dstEdges": [] - } - ], - "edges": [ - { - "id": 57, - "src": 68, - "dst": 69 - }, - { - "id": 58, - "src": 69, - "dst": 70 - }, - { - "id": 59, - "src": 70, - "dst": 71 - }, - { - "id": 60, - "src": 71, - "dst": 72 - }, - { - "id": 61, - "src": 71, - "dst": 73 - } - ] - } - }, - { - "name": "test_loops", - "cfg": { - "nodes": [ - { - "id": 74, - "stmtID": 1748, - "srcEdges": [], - "dstEdges": [ - 62 - ] - }, - { - "id": 75, - "stmtID": 1752, - "srcEdges": [ - 62 - ], - "dstEdges": [ - 63 - ] - }, - { - "id": 76, - "stmtID": 1766, - "srcEdges": [ - 63, - 66 - ], - "dstEdges": [ - 64, - 67 - ] - }, - { - "id": 77, - "stmtID": 1760, - "srcEdges": [ - 64 - ], - "dstEdges": [ - 65 - ] - }, - { - "id": 78, - "stmtID": 1765, - "srcEdges": [ - 65 - ], - "dstEdges": [ - 66 - ] - }, - { - "id": 79, - "stmtID": 1780, - "srcEdges": [ - 67, - 70 - ], - "dstEdges": [ - 68, - 71 - ] - }, - { - "id": 80, - "stmtID": 1774, - "srcEdges": [ - 68 - ], - "dstEdges": [ - 69 - ] - }, - { - "id": 81, - "stmtID": 1779, - "srcEdges": [ - 69 - ], - "dstEdges": [ - 70 - ] - }, - { - "id": 82, - "stmtID": 1792, - "srcEdges": [ - 71, - 74 - ], - "dstEdges": [ - 72, - 75 - ] - }, - { - "id": 83, - "stmtID": 1786, - "srcEdges": [ - 72 - ], - "dstEdges": [ - 73 - ] - }, - { - "id": 84, - "stmtID": 1791, - "srcEdges": [ - 73 - ], - "dstEdges": [ - 74 - ] - }, - { - "id": 85, - "stmtID": 1799, - "srcEdges": [ - 75 - ], - "dstEdges": [ - 76 - ] - }, - { - "id": 86, - "stmtID": 1803, - "srcEdges": [ - 76, - 77 - ], - "dstEdges": [ - 77 - ] - } - ], - "edges": [ - { - "id": 62, - "src": 74, - "dst": 75 - }, - { - "id": 63, - "src": 75, - "dst": 76 - }, - { - "id": 64, - "src": 76, - "dst": 77 - }, - { - "id": 65, - "src": 77, - "dst": 78 - }, - { - "id": 66, - "src": 78, - "dst": 76 - }, - { - "id": 67, - "src": 76, - "dst": 79 - }, - { - "id": 68, - "src": 79, - "dst": 80 - }, - { - "id": 69, - "src": 80, - "dst": 81 - }, - { - "id": 70, - "src": 81, - "dst": 79 - }, - { - "id": 71, - "src": 79, - "dst": 82 - }, - { - "id": 72, - "src": 82, - "dst": 83 - }, - { - "id": 73, - "src": 83, - "dst": 84 - }, - { - "id": 74, - "src": 84, - "dst": 82 - }, - { - "id": 75, - "src": 82, - "dst": 85 - }, - { - "id": 76, - "src": 85, - "dst": 86 - }, - { - "id": 77, - "src": 86, - "dst": 86 - } - ] - } - } - ], - "contracts": [ - { - "name": "TestContract", - "methods": [ - { - "name": "TestContract.getter", - "cfg": { - "nodes": [ - { - "id": 87, - "stmtID": 1662, - "srcEdges": [], - "dstEdges": [] - } - ], - "edges": [] - } - } - ] - }, - { - "name": "TestContractF", - "methods": [ - { - "name": "TestContractF.test", - "cfg": { - "nodes": [], - "edges": [] - } - } - ] - }, - { - "name": "TestContractT", - "methods": [ - { - "name": "TestContractT.test", - "cfg": { - "nodes": [ - { - "id": 88, - "stmtID": 1720, - "srcEdges": [], - "dstEdges": [] - } - ], - "edges": [] - } - }, - { - "name": "TestContractT.receive_external_fallback_1722", - "cfg": { - "nodes": [], - "edges": [] - } - } - ] - } - ] -} \ No newline at end of file diff --git a/test/all/syntax.cfg.mmd b/test/all/syntax.cfg.mmd deleted file mode 100644 index 34217d53..00000000 --- a/test/all/syntax.cfg.mmd +++ /dev/null @@ -1,55 +0,0 @@ -graph TD -subgraph test_try - test_try_68["try"] - test_try_69["a += 1"] - test_try_70["try"] - test_try_71["try ... catch (err)"] - test_try_72["a = 19"]:::exitNode - test_try_73["dump(err)"]:::exitNode - test_try_68 --> test_try_69 - test_try_69 --> test_try_70 - test_try_70 --> test_try_71 - test_try_71 --> test_try_72 - test_try_71 --> test_try_73 -end -subgraph test_loops - test_loops_74["let sum: Int = 0"] - test_loops_75["let i: Int = 0"] - test_loops_76["while (i < 10)"] - test_loops_77["i = i + 1"] - test_loops_78["sum = sum + i"] - test_loops_79["until (i > 10)"] - test_loops_80["i = i - 1"] - test_loops_81["sum = sum + i"] - test_loops_82["repeat (10)"] - test_loops_83["i = i + 1"] - test_loops_84["sum = sum + i"] - test_loops_85["let m: map<Int, Int> = emptyMap()"] - test_loops_86["foreach ((k, v) of m)"] - test_loops_74 --> test_loops_75 - test_loops_75 --> test_loops_76 - test_loops_76 --> test_loops_77 - test_loops_77 --> test_loops_78 - test_loops_78 --> test_loops_76 - test_loops_76 --> test_loops_79 - test_loops_79 --> test_loops_80 - test_loops_80 --> test_loops_81 - test_loops_81 --> test_loops_79 - test_loops_79 --> test_loops_82 - test_loops_82 --> test_loops_83 - test_loops_83 --> test_loops_84 - test_loops_84 --> test_loops_82 - test_loops_82 --> test_loops_85 - test_loops_85 --> test_loops_86 - test_loops_86 --> test_loops_86 -end -subgraph TestContract__getter - TestContract__getter_87["return 0"]:::exitNode -end -subgraph TestContractF__test -end -subgraph TestContractT__test - TestContractT__test_88["return self.getA()"]:::exitNode -end -subgraph TestContractT__receive_external_fallback_1722 -end diff --git a/test/all/syntax.imports.dot b/test/all/syntax.imports.dot deleted file mode 100644 index bbb78f62..00000000 --- a/test/all/syntax.imports.dot +++ /dev/null @@ -1,4 +0,0 @@ -digraph "ImportGraph" { - node [shape=box]; - node_1 [label="syntax",style=filled,fillcolor="#90EE90"]; -} diff --git a/test/all/syntax.imports.json b/test/all/syntax.imports.json deleted file mode 100644 index c0d8d8f6..00000000 --- a/test/all/syntax.imports.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "nodes": [ - { - "idx": 1, - "name": "syntax", - "origin": "user", - "importPath": "test/all/syntax.tact", - "language": "tact", - "hasContract": true, - "inEdges": [], - "outEdges": [] - } - ], - "edges": [] -} \ No newline at end of file diff --git a/test/all/syntax.imports.mmd b/test/all/syntax.imports.mmd deleted file mode 100644 index 8563a978..00000000 --- a/test/all/syntax.imports.mmd +++ /dev/null @@ -1,4 +0,0 @@ -graph TD - node_1["syntax"]:::contractNode - classDef contractNode fill:#90EE90,stroke:#333,stroke-width:2px; - classDef stdlibNode fill:#FFFF80,stroke:#333,stroke-width:2px; diff --git a/test/cli.spec.ts b/test/cli.spec.ts index 67c4e6b1..3d83879b 100644 --- a/test/cli.spec.ts +++ b/test/cli.spec.ts @@ -15,7 +15,7 @@ describe("CLI Argument Parsing", () => { }); await runMistiCommand(args); expect(driverMakeSpy).toHaveBeenCalledWith( - TACT_CONFIG_PATH, + [TACT_CONFIG_PATH], expect.objectContaining({ verbose: true, }), @@ -33,7 +33,7 @@ describe("CLI Argument Parsing", () => { }); await runMistiCommand(args); expect(driverMakeSpy).toHaveBeenCalledWith( - TACT_CONFIG_PATH, + [TACT_CONFIG_PATH], expect.objectContaining({ outputFormat: "json", }),