{"version":3,"sources":["../src/index.ts","../src/utils/invariant.ts","../src/utils/resolvePromise.ts","../src/utils/formatPath.ts","../src/utils/isImportLocal.ts","../src/solc/resolveImportPath.ts","../src/solc/resolveImports.ts","../src/solc/moduleFactory.ts","../src/solc/solc.ts","../src/solc/compileContracts.ts","../src/solc/resolveArtifacts.ts","../src/solc/moduleFactorySync.ts","../src/solc/compileContractsSync.ts","../src/solc/resolveArtifactsSync.ts","../package.json","../src/utils/getEtherscanLinks.ts","../src/runtime/generateEvmtsBodyDts.ts","../src/runtime/generateEvmtsBody.ts","../src/runtime/generateRuntime.ts","../src/runtime/generateRuntimeSync.ts","../src/bundler.ts","../src/unplugin.ts"],"sourcesContent":["export * from './solc'\nexport * from './unplugin'\nexport * from './types'\nexport * from './bundler'\nexport * from './runtime'\n","export function invariant(condition: any, message: string): asserts condition {\n\tif (!condition) {\n\t\tthrow new Error(message)\n\t}\n}\n","import type { FileAccessObject, Logger } from '../types'\nimport resolve from 'resolve'\n\nexport const resolvePromise = (\n\tfilePath: string,\n\tbasedir: string,\n\tfao: FileAccessObject,\n\tlogger: Logger,\n): Promise<string> => {\n\treturn new Promise<string>((promiseResolve, promiseReject) => {\n\t\tresolve(\n\t\t\tfilePath,\n\t\t\t{\n\t\t\t\tbasedir,\n\t\t\t\treadFile: (file, cb) => {\n\t\t\t\t\tfao\n\t\t\t\t\t\t.readFile(file, 'utf8')\n\t\t\t\t\t\t.then((file) => {\n\t\t\t\t\t\t\tcb(null, file)\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch((e) => {\n\t\t\t\t\t\t\tlogger.error(e)\n\t\t\t\t\t\t\tlogger.error('Error reading file')\n\t\t\t\t\t\t\tcb(e)\n\t\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t\tisFile: (file, cb) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tcb(null, fao.existsSync(file))\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tcb(e as Error)\n\t\t\t\t\t\tlogger.error(e as any)\n\t\t\t\t\t\tlogger.error(`Error checking if isFile ${file}`)\n\t\t\t\t\t\tthrow e\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t\t(err, res) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tlogger.error(err as any)\n\t\t\t\t\tlogger.error(`there was an error resolving ${filePath}`)\n\t\t\t\t\tpromiseReject(err)\n\t\t\t\t} else {\n\t\t\t\t\tpromiseResolve(res as string)\n\t\t\t\t}\n\t\t\t},\n\t\t)\n\t})\n}\n","export const formatPath = (contractPath: string) => {\n\treturn contractPath.replace(/\\\\/g, '/')\n}\n","export const isImportLocal = (importPath: string) => {\n\treturn importPath.startsWith('.')\n}\n","import { formatPath } from '../utils/formatPath'\nimport { isImportLocal } from '../utils/isImportLocal'\nimport * as path from 'path'\nimport * as resolve from 'resolve'\n\n/**\n * Resolve import statement to absolute file path\n *\n * @param {string} importPath import statement in *.sol contract\n */\nexport const resolveImportPath = (\n\tabsolutePath: string,\n\timportPath: string,\n\tremappings: Record<string, string>,\n\tlibs: string[],\n) => {\n\t// Foundry remappings\n\tfor (const [key, value] of Object.entries(remappings)) {\n\t\tif (importPath.startsWith(key)) {\n\t\t\treturn formatPath(path.resolve(importPath.replace(key, value)))\n\t\t}\n\t}\n\t// Local import \"./LocalContract.sol\"\n\tif (isImportLocal(importPath)) {\n\t\treturn formatPath(path.resolve(path.dirname(absolutePath), importPath))\n\t} /*else if (project !== undefined && project !== null) {*/\n\t// try resolving with node resolution\n\ttry {\n\t\treturn resolve.sync(importPath, {\n\t\t\tbasedir: path.dirname(absolutePath),\n\t\t\tpaths: libs,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(\n\t\t\t`Could not resolve import ${importPath} from ${absolutePath}`,\n\t\t\te,\n\t\t)\n\t\treturn importPath\n\t}\n}\n","import { formatPath } from '../utils/formatPath'\nimport { isImportLocal } from '../utils/isImportLocal'\nimport * as path from 'path'\n\nexport const resolveImports = (\n\tabsolutePath: string,\n\tcode: string,\n): string[] => {\n\tconst imports: string[] = []\n\tconst importRegEx = /^\\s?import\\s+[^'\"]*['\"](.*)['\"]\\s*/gm\n\tlet foundImport = importRegEx.exec(code)\n\twhile (foundImport != null) {\n\t\tconst importPath = foundImport[1]\n\t\tif (!importPath) {\n\t\t\tthrow new Error('expected import path to exist')\n\t\t}\n\t\tif (isImportLocal(importPath)) {\n\t\t\tconst importFullPath = formatPath(\n\t\t\t\tpath.resolve(path.dirname(absolutePath), importPath),\n\t\t\t)\n\t\t\timports.push(importFullPath)\n\t\t} else {\n\t\t\timports.push(importPath)\n\t\t}\n\t\tfoundImport = importRegEx.exec(code)\n\t}\n\treturn imports\n}\n","import type { FileAccessObject, ModuleInfo } from '../types'\nimport { invariant } from '../utils/invariant'\nimport { resolveImportPath } from './resolveImportPath'\nimport { resolveImports } from './resolveImports'\n\n/**\n * Creates a module from the given module information.\n * This includes resolving all imports and creating a dependency graph.\n *\n * Currently it modifies the source code in place which causes the ast to not match the source code.\n * This complexity leaks to the typescript lsp which has to account for this\n * Ideally we refactor this to not need to modify source code in place\n * Doing this hurts our ability to control the import graph and make it use node resolution though\n * See foundry that is alergic to using npm\n * Doing it this way for now is easier but for sure a leaky abstraction\n */\nexport const moduleFactory = async (\n\tabsolutePath: string,\n\trawCode: string,\n\tremappings: Record<string, string>,\n\tlibs: string[],\n\tfao: FileAccessObject,\n): Promise<ModuleInfo> => {\n\tconst stack = [{ absolutePath, rawCode }]\n\tconst modules = new Map<string, ModuleInfo>()\n\n\twhile (stack.length) {\n\t\tconst nextItem = stack.pop()\n\t\tinvariant(nextItem, 'Module should exist')\n\t\tconst { absolutePath, rawCode } = nextItem\n\n\t\tif (modules.has(absolutePath)) continue\n\n\t\tconst importedIds = resolveImports(absolutePath, rawCode).map((paths) =>\n\t\t\tresolveImportPath(absolutePath, paths, remappings, libs),\n\t\t)\n\n\t\tconst importRegEx = /(^\\s?import\\s+[^'\"]*['\"])(.*)(['\"]\\s*)/gm\n\t\tconst code = importedIds.reduce((code, importedId) => {\n\t\t\tconst depImportAbsolutePath = resolveImportPath(\n\t\t\t\tabsolutePath,\n\t\t\t\timportedId,\n\t\t\t\tremappings,\n\t\t\t\tlibs,\n\t\t\t)\n\t\t\treturn code.replace(importRegEx, (match, p1, p2, p3) => {\n\t\t\t\tconst resolvedPath = resolveImportPath(\n\t\t\t\t\tabsolutePath,\n\t\t\t\t\tp2,\n\t\t\t\t\tremappings,\n\t\t\t\t\tlibs,\n\t\t\t\t)\n\t\t\t\tif (resolvedPath === importedId) {\n\t\t\t\t\treturn `${p1}${depImportAbsolutePath}${p3}`\n\t\t\t\t} else {\n\t\t\t\t\treturn match\n\t\t\t\t}\n\t\t\t})\n\t\t}, rawCode)\n\n\t\tmodules.set(absolutePath, {\n\t\t\tid: absolutePath,\n\t\t\trawCode,\n\t\t\tcode,\n\t\t\timportedIds,\n\t\t\tresolutions: [],\n\t\t})\n\n\t\tfor (const importedId of importedIds) {\n\t\t\tconst depImportAbsolutePath = resolveImportPath(\n\t\t\t\tabsolutePath,\n\t\t\t\timportedId,\n\t\t\t\tremappings,\n\t\t\t\tlibs,\n\t\t\t)\n\t\t\tconst depRawCode = await fao.readFile(depImportAbsolutePath, 'utf8')\n\n\t\t\tstack.push({ absolutePath: depImportAbsolutePath, rawCode: depRawCode })\n\t\t}\n\t}\n\n\tfor (const [_, m] of modules.entries()) {\n\t\tconst { importedIds } = m\n\t\tm.resolutions = []\n\t\timportedIds.forEach((importedId) => {\n\t\t\tconst resolution = modules.get(importedId)\n\t\t\tinvariant(resolution, `resolution for ${importedId} not found`)\n\t\t\tm.resolutions.push(resolution)\n\t\t})\n\t}\n\n\treturn modules.get(absolutePath) as ModuleInfo\n}\n","// generated from docs at https://docs.soliditylang.org/en/v0.8.20/using-the-compiler.html\nimport type { Abi } from 'abitype'\n// @ts-ignore\nimport solc from 'solc'\n\ntype HexNumber = `0x${string}`\n\ntype SolcAst = any\n\n// Required: Source code language. Currently supported are \"Solidity\", \"Yul\" and \"SolidityAST\" (experimental).\nexport type SolcLanguage = 'Solidity' | 'Yul' | 'SolidityAST'\n\n// The keys here are the \"global\" names of the source files,\n// imports can use other files via remappings (see below).\nexport type SolcInputSource = {\n\t// Optional: keccak256 hash of the source file\n\t// It is used to verify the retrieved content if imported via URLs.\n\tkeccak256?: HexNumber\n\t// If language is set to \"SolidityAST\", an AST needs to be supplied under the \"ast\" key.\n\t// Note that importing ASTs is experimental and in particular that:\n\t// - importing invalid ASTs can produce undefined results and\n\t// - no proper error reporting is available on invalid ASTs.\n\t// Furthermore, note that the AST import only consumes the fields of the AST as\n\t// produced by the compiler in \"stopAfter\": \"parsing\" mode and then re-performs\n\t// analysis, so any analysis-based annotations of the AST are ignored upon import.\n\t// formatted as the json ast requested with the ``ast`` output selection.\n\tast?: SolcAst\n} & (\n\t| {\n\t\t\t// Required (unless \"content\" is used, see below): URL(s) to the source file.\n\t\t\t// URL(s) should be imported in this order and the result checked against the\n\t\t\t// keccak256 hash (if available). If the hash doesn't match or none of the\n\t\t\t// URL(s) result in success, an error should be raised.\n\t\t\t// Using the commandline interface only filesystem paths are supported.\n\t\t\t// With the JavaScript interface the URL will be passed to the user-supplied\n\t\t\t// read callback, so any URL supported by the callback can be used.\n\t\t\t// @example\n\t\t\t// [\n\t\t\t//  \"bzzr://56ab...\",\n\t\t\t//  \"ipfs://Qma...\",\n\t\t\t//  \"/tmp/path/to/file.sol\"\n\t\t\t//  // If files are used, their directories should be added to the command line via\n\t\t\t//  // `--allow-paths <path>`.\n\t\t\t//]\n\t\t\turls: string[]\n\t  }\n\t| {\n\t\t\tcontent: string\n\t  }\n)\n\nexport type SolcRemapping = Array<`${string}=${string}`>\n\n// Tuning options for the Yul optimizer.\nexport type SolcYulDetails = {\n\t// Improve allocation of stack slots for variables, can free up stack slots early.\n\t// Activated by default if the Yul optimizer is activated.\n\tstackAllocation?: boolean\n\t// Select optimization steps to be applied. It is also possible to modify both the\n\t// optimization sequence and the clean-up sequence. Instructions for each sequence\n\t// are separated with the \":\" delimiter and the values are provided in the form of\n\t// optimization-sequence:clean-up-sequence. For more information see\n\t// \"The Optimizer > Selecting Optimizations\".\n\t// This field is optional, and if not provided, the default sequences for both\n\t// optimization and clean-up are used. If only one of the options is provivded\n\t// the other will not be run.\n\t// If only the delimiter \":\" is provided then neither the optimization nor the clean-up\n\t// sequence will be run.\n\t// If set to an empty value, only the default clean-up sequence is used and\n\t// no optimization steps are applied.\n\toptimizerSteps: string\n}\n\n// Switch optimizer components on or off in detail.\n// The \"enabled\" switch above provides two defaults which can be\n// tweaked here. If \"details\" is given, \"enabled\" can be omitted.\nexport type SolcOptimizerDetails = {\n\t// The peephole optimizer is always on if no details are given,\n\t// use details to switch it off.\n\tpeephole: boolean\n\t// The inliner is always on if no details are given,\n\t// use details to switch it off.\n\tinliner: boolean\n\t// The unused jumpdest remover is always on if no details are given,\n\t// use details to switch it off.\n\tjumpdestRemover: boolean\n\t// Sometimes re-orders literals in commutative operations.\n\torderLiterals: boolean\n\t// Removes duplicate code blocks\n\tdeduplicate: boolean\n\t// Common subexpression elimination, this is the most complicated step but\n\t// can also provide the largest gain.\n\tcse: boolean\n\t// Optimize representation of literal numbers and strings in code.\n\tconstantOptimizer: boolean\n\t// The new Yul optimizer. Mostly operates on the code of ABI coder v2\n\t// and inline assembly.\n\t// It is activated together with the global optimizer setting\n\t// and can be deactivated here.\n\t// Before Solidity 0.6.0 it had to be activated through this switch.\n\tyul: boolean\n\tyulDetails: SolcYulDetails\n}\n\n// Optional: Optimizer settings\nexport type SolcOptimizer = {\n\t// Disabled by default.\n\t// NOTE: enabled=false still leaves some optimizations on. See comments below.\n\t// WARNING: Before version 0.8.6 omitting the 'enabled' key was not equivalent to setting\n\t// it to false and would actually disable all the optimizations.\n\tenabled?: boolean\n\t// Optimize for how many times you intend to run the code.\n\t// Lower values will optimize more for initial deployment cost, higher\n\t// values will optimize more for high-frequency usage.\n\truns: number\n\tdetails: SolcOptimizerDetails\n}\n\nexport const fileLevelOption = '' as const\n\nexport type SolcOutputSelection = {\n\t[fileName: string]: {\n\t\t[fileLevelOption]?: Array<'ast'>\n\t} & {\n\t\t[contractName: Exclude<string, typeof fileLevelOption>]: Array<\n\t\t\t| 'abi'\n\t\t\t// TODO this option is only for fileLevelOptions, but it's not clear how to type that\n\t\t\t| 'ast'\n\t\t\t| 'devdoc'\n\t\t\t| 'evm.assembly'\n\t\t\t| 'evm.bytecode'\n\t\t\t| 'evm.bytecode.functionDebugData'\n\t\t\t| 'evm.bytecode.generatedSources'\n\t\t\t| 'evm.bytecode.linkReferences'\n\t\t\t| 'evm.bytecode.object'\n\t\t\t| 'evm.bytecode.opcodes'\n\t\t\t| 'evm.bytecode.sourceMap'\n\t\t\t| 'evm.deployedBytecode'\n\t\t\t| 'evm.deployedBytecode.immutableReferences'\n\t\t\t| 'evm.deployedBytecode.sourceMap'\n\t\t\t| 'evm.deployedBytecode.opcodes'\n\t\t\t| 'evm.deployedBytecode.object'\n\t\t\t| 'evm.gasEstimates'\n\t\t\t| 'evm.methodIdentifiers'\n\t\t\t| 'evm.legacyAssembly'\n\t\t\t| 'evm.methodIdentifiers'\n\t\t\t| 'evm.storageLayout'\n\t\t\t| 'ewasm.wasm'\n\t\t\t| 'ewasm.wast'\n\t\t\t| 'ir'\n\t\t\t| 'irOptimized'\n\t\t\t| 'metadata'\n\t\t\t| 'storageLayout'\n\t\t\t| 'userdoc'\n\t\t\t| '*'\n\t\t>\n\t}\n}\n\n// Chose which contracts should be analyzed as the deployed one.\nexport type SolcModelCheckerContracts = {\n\t[fileName: `${string}.sol`]: string[]\n}\n\nexport type SolcModelChecker = {\n\tcontracts: SolcModelCheckerContracts\n\t// Choose how division and modulo operations should be encoded.\n\t// When using `false` they are replaced by multiplication with slack\n\t// variables. This is the default.\n\t// Using `true` here is recommended if you are using the CHC engine\n\t// and not using Spacer as the Horn solver (using Eldarica, for example).\n\t// See the Formal Verification section for a more detailed explanation of this option.\n\tdivModNoSlacks?: boolean\n\t// Choose which model checker engine to use: all (default), bmc, chc, none.\n\tengine?: 'all' | 'bmc' | 'chc' | 'none'\n\t// Choose whether external calls should be considered trusted in case the\n\t// code of the called function is available at compile-time.\n\t// For details see the SMTChecker section.\n\textCalls: 'trusted' | 'untrusted'\n\t// Choose which types of invariants should be reported to the user: contract, reentrancy.\n\tinvariants: Array<'contract' | 'reentrancy'>\n\t// Choose whether to output all proved targets. The default is `false`.\n\tshowProved?: boolean\n\t// Choose whether to output all unproved targets. The default is `false`.\n\tshowUnproved?: boolean\n\t// Choose whether to output all unsupported language features. The default is `false`.\n\tshowUnsupported?: boolean\n\t// Choose which solvers should be used, if available.\n\t// See the Formal Verification section for the solvers description.\n\tsolvers: Array<'cvc4' | 'smtlib2' | 'z3'>\n\t// Choose which targets should be checked: constantCondition,\n\t// underflow, overflow, divByZero, balance, assert, popEmptyArray, outOfBounds.\n\t// If the option is not given all targets are checked by default,\n\t// except underflow/overflow for Solidity >=0.8.7.\n\t// See the Formal Verification section for the targets description.\n\ttargets?: Array<'underflow' | 'overflow' | 'assert'>\n\t// Timeout for each SMT query in milliseconds.\n\t// If this option is not given, the SMTChecker will use a deterministic\n\t// resource limit by default.\n\t// A given timeout of 0 means no resource/time restrictions for any query.\n\ttimeout?: boolean\n}\n\nexport type SolcDebugSettings = {\n\t// How to treat revert (and require) reason strings. Settings are\n\t// \"default\", \"strip\", \"debug\" and \"verboseDebug\".\n\t// \"default\" does not inject compiler-generated revert strings and keeps user-supplied ones.\n\t// \"strip\" removes all revert strings (if possible, i.e. if literals are used) keeping side-effects\n\t// \"debug\" injects strings for compiler-generated internal reverts, implemented for ABI encoders V1 and V2 for now.\n\t// \"verboseDebug\" even appends further information to user-supplied revert strings (not yet implemented)\n\trevertStrings?: 'default' | 'strip' | 'debug' | 'verboseDebug'\n\t// Optional: How much extra debug information to include in comments in the produced EVM\n\t// assembly and Yul code. Available components are:\n\t// - `location`: Annotations of the form `@src <index>:<start>:<end>` indicating the\n\t//    location of the corresponding element in the original Solidity file, where:\n\t//     - `<index>` is the file index matching the `@use-src` annotation,\n\t//     - `<start>` is the index of the first byte at that location,\n\t//     - `<end>` is the index of the first byte after that location.\n\t// - `snippet`: A single-line code snippet from the location indicated by `@src`.\n\t//     The snippet is quoted and follows the corresponding `@src` annotation.\n\t// - `*`: Wildcard value that can be used to request everything.\n\tdebugInfo?: Array<'location' | 'snippet' | '*'>\n}\n\nexport type SolcMetadataSettings = {\n\t// The CBOR metadata is appended at the end of the bytecode by default.\n\t// Setting this to false omits the metadata from the runtime and deploy time code.\n\tappendCBOR?: boolean\n\t// Use only literal content and not URLs (false by default)\n\tuseLiteralContent?: boolean\n\t// Use the given hash method for the metadata hash that is appended to the bytecode.\n\t// The metadata hash can be removed from the bytecode via option \"none\".\n\t// The other options are \"ipfs\" and \"bzzr1\".\n\t// If the option is omitted, \"ipfs\" is used by default.\n\tbytecodeHash?: 'ipfs' | 'bzzr1' | 'none'\n}\n\n// Optional: A list of remappings to apply to the source code.\nexport type SolcSettings = {\n\t// Optional: Stop compilation after the given stage. Currently only \"parsing\" is valid here\n\tstopAfter?: 'parsing'\n\t// Optional: Sorted list of remappings\n\tremappings?: SolcRemapping\n\toptimizer?: SolcOptimizer\n\t// Version of the EVM to compile for.\n\t// Affects type checking and code generation. Can be homestead,\n\t// tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg, istanbul, berlin, london or paris\n\tevmVersion?:\n\t\t| 'byzantium'\n\t\t| 'constantinople'\n\t\t| 'petersburg'\n\t\t| 'istanbul'\n\t\t| 'berlin'\n\t\t| 'london'\n\t\t| 'paris'\n\t// Optional: Change compilation pipeline to go through the Yul intermediate representation.\n\t// This is false by default.\n\tviaIR?: boolean\n\t// Optional: Debugging settings\n\tdebug?: SolcDebugSettings\n\t// Metadata settings (optional)\n\tmetadata?: SolcMetadataSettings\n\t// Addresses of the libraries. If not all libraries are given here,\n\t// it can result in unlinked objects whose output data is different.\n\t// The top level key is the the name of the source file where the library is used.\n\t// If remappings are used, this source file should match the global path\n\t// after remappings were applied.\n\t// If this key is an empty string, that refers to a global level.\n\tlibraries?: Record<string, Record<string, string>>\n\t// The following can be used to select desired outputs based\n\t// on file and contract names.\n\t// If this field is omitted, then the compiler loads and does type checking,\n\t// but will not generate any outputs apart from errors.\n\t// The first level key is the file name and the second level key is the contract name.\n\t// An empty contract name is used for outputs that are not tied to a contract\n\t// but to the whole source file like the AST.\n\t// A star as contract name refers to all contracts in the file.\n\t// Similarly, a star as a file name matches all files.\n\t// To select all outputs the compiler can possibly generate, use\n\t// \"outputSelection: { \"*\": { \"*\": [ \"*\" ], \"\": [ \"*\" ] } }\"\n\t// but note that this might slow down the compilation process needlessly.\n\t//\n\t// The available output types are as follows:\n\t//\n\t// File level (needs empty string as contract name):\n\t//   ast - AST of all source files\n\t//\n\t// Contract level (needs the contract name or \"*\"):\n\t//   abi - ABI\n\t//   devdoc - Developer documentation (natspec)\n\t//   userdoc - User documentation (natspec)\n\t//   metadata - Metadata\n\t//   ir - Yul intermediate representation of the code before optimization\n\t//   irOptimized - Intermediate representation after optimization\n\t//   storageLayout - Slots, offsets and types of the contract's state variables.\n\t//   evm.assembly - New assembly format\n\t//   evm.legacyAssembly - Old-style assembly format in JSON\n\t//   evm.bytecode.functionDebugData - Debugging information at function level\n\t//   evm.bytecode.object - Bytecode object\n\t//   evm.bytecode.opcodes - Opcodes list\n\t//   evm.bytecode.sourceMap - Source mapping (useful for debugging)\n\t//   evm.bytecode.linkReferences - Link references (if unlinked object)\n\t//   evm.bytecode.generatedSources - Sources generated by the compiler\n\t//   evm.deployedBytecode* - Deployed bytecode (has all the options that evm.bytecode has)\n\t//   evm.deployedBytecode.immutableReferences - Map from AST ids to bytecode ranges that reference immutables\n\t//   evm.methodIdentifiers - The list of function hashes\n\t//   evm.gasEstimates - Function gas estimates\n\t//   ewasm.wast - Ewasm in WebAssembly S-expressions format\n\t//   ewasm.wasm - Ewasm in WebAssembly binary format\n\t//\n\t// Note that using a using `evm`, `evm.bytecode`, `ewasm`, etc. will select every\n\t// target part of that output. Additionally, `*` can be used as a wildcard to request everything.\n\t//\n\toutputSelection: SolcOutputSelection\n\t// The modelChecker object is experimental and subject to changes.\n\tmodelChecker?: SolcModelChecker\n}\n\nexport type SolcInputSourcesDestructibleSettings = {\n\t// Optional: keccak256 hash of the source file\n\tkeccak256?: HexNumber\n\t// Required (unless \"urls\" is used): literal contents of the source file\n\tcontent: string\n}\n\nexport type SolcInputSources = {\n\t[globalName: string]: SolcInputSource & {\n\t\tdestructible?: SolcInputSourcesDestructibleSettings\n\t}\n}\n\nexport type SolcInputDescription = {\n\tlanguage: SolcLanguage\n\t// Required: A dictionary of source files. The key of each entry is either a file name or a global identifier followed by \":\" and a file name.\n\tsources: SolcInputSources\n\tsettings?: SolcSettings\n}\n\nexport type SolcOutput = {\n\t// Optional: not present if no errors/warnings/infos were encountered\n\terrors?: SolcErrorEntry[]\n\n\t// This contains the file-level outputs.\n\t// It can be limited/filtered by the outputSelection settings.\n\tsources: {\n\t\t[sourceFile: string]: SolcSourceEntry\n\t}\n\n\t// This contains the contract-level outputs.\n\t// It can be limited/filtered by the outputSelection settings.\n\tcontracts: {\n\t\t// rome-ignore lint/suspicious/noRedeclare: not sure why this is triggering\n\t\t[sourceFile: string]: {\n\t\t\t[contractName: string]: SolcContractOutput\n\t\t}\n\t}\n}\n\nexport type SolcErrorEntry = {\n\t// Optional: Location within the source file.\n\tsourceLocation?: SolcSourceLocation\n\n\t// Optional: Further locations (e.g. places of conflicting declarations)\n\tsecondarySourceLocations?: SolcSecondarySourceLocation[]\n\n\t// Mandatory: Error type, such as \"TypeError\", \"InternalCompilerError\", \"Exception\", etc.\n\ttype: string\n\n\t// Mandatory: Component where the error originated, such as \"general\", \"ewasm\", etc.\n\tcomponent: string\n\n\t// Mandatory (\"error\", \"warning\" or \"info\", but please note that this may be extended in the future)\n\tseverity: 'error' | 'warning' | 'info'\n\n\t// Optional: unique code for the cause of the error\n\terrorCode?: string\n\n\t// Mandatory\n\tmessage: string\n\n\t// Optional: the message formatted with source location\n\tformattedMessage?: string\n}\n\nexport type SolcSourceLocation = {\n\tfile: string\n\tstart: number\n\tend: number\n}\n\nexport type SolcSecondarySourceLocation = SolcSourceLocation & {\n\tmessage: string\n}\n\nexport type SolcSourceEntry = {\n\t// Identifier of the source (used in source maps)\n\tid: number\n\n\t// The AST object\n\tast: any\n}\n\nexport type SolcContractOutput = {\n\t// The Ethereum Contract ABI. If empty, it is represented as an empty array.\n\tabi: Abi\n\n\t// See the Metadata Output documentation (serialised JSON string)\n\tmetadata: string\n\n\t// User documentation (natspec)\n\tuserdoc: {\n\t\tmethods?: Record<string, { notice: string }>\n\t\tkind: 'user'\n\t\tnotice?: string\n\t\tversion: number\n\t}\n\n\t// Developer documentation (natspec)\n\tdevdoc: any\n\n\t// Intermediate representation (string)\n\tir: string\n\n\t// See the Storage Layout documentation.\n\tstorageLayout: {\n\t\tstorage: any[]\n\t\ttypes: any\n\t}\n\n\t// EVM-related outputs\n\tevm: SolcEVMOutput\n\n\t// Ewasm related outputs\n\tewasm: SolcEwasmOutput\n}\n\nexport type SolcEVMOutput = {\n\t// Assembly (string)\n\tassembly: string\n\n\t// Old-style assembly (object)\n\tlegacyAssembly: any\n\n\t// Bytecode and related details.\n\tbytecode: SolcBytecodeOutput\n\n\t// The list of function hashes\n\tmethodIdentifiers: {\n\t\t[functionSignature: string]: string\n\t}\n\n\t// Function gas estimates\n\tgasEstimates: SolcGasEstimates\n}\n\nexport type SolcBytecodeOutput = {\n\t// Debugging data at the level of functions.\n\tfunctionDebugData: {\n\t\t[functionName: string]: SolcFunctionDebugData\n\t}\n\t// The bytecode as a hex string.\n\tobject: string\n\n\t// Opcodes list (string)\n\topcodes: string\n\n\t// The source mapping as a string. See the source mapping definition.\n\tsourceMap: string\n\n\t// Array of sources generated by the compiler. Currently only\n\t// contains a single Yul file.\n\tgeneratedSources: SolcGeneratedSource[]\n\n\t// If given, this is an unlinked object.\n\tlinkReferences: {\n\t\t[fileName: string]: {\n\t\t\t[libraryName: string]: Array<{ start: number; length: number }>\n\t\t}\n\t}\n} & Omit<SolcDeployedBytecodeOutput, 'immutableReferences'>\n\nexport type SolcDeployedBytecodeOutput = {\n\t// ... Same as BytecodeOutput above ...\n\timmutableReferences: {\n\t\t[astID: string]: Array<{ start: number; length: number }>\n\t}\n}\n\nexport type SolcFunctionDebugData = {\n\tentryPoint?: number\n\tid?: number | null\n\tparameterSlots?: number\n\treturnSlots?: number\n}\n\nexport type SolcGeneratedSource = {\n\t// Yul AST\n\tast: any\n\n\t// Source file in its text form (may contain comments)\n\tcontents: string\n\n\t// Source file ID, used for source references, same \"namespace\" as the Solidity source files\n\tid: number\n\tlanguage: string\n\tname: string\n}\n\nexport type SolcGasEstimates = {\n\tcreation: {\n\t\tcodeDepositCost: string\n\t\texecutionCost: string\n\t\ttotalCost: string\n\t}\n\texternal: {\n\t\t[functionSignature: string]: string\n\t}\n\tinternal: {\n\t\t// rome-ignore lint/suspicious/noRedeclare: not sure why this is triggering\n\t\t[functionSignature: string]: string\n\t}\n}\n\nexport type SolcEwasmOutput = {\n\t// S-expressions format\n\twast: string\n\t// Binary format (hex string)\n\twasm: string\n}\n\n/**\n * Typesafe wrapper around solc.compile\n */\nexport const solcCompile = (input: SolcInputDescription): SolcOutput => {\n\tconst out: SolcOutput = JSON.parse(solc.compile(JSON.stringify(input)))\n\treturn out\n}\n","import type { FileAccessObject, Logger, ModuleInfo } from '../types'\nimport { invariant } from '../utils/invariant'\nimport { resolvePromise } from '../utils/resolvePromise'\nimport { moduleFactory } from './moduleFactory'\nimport { type SolcInputDescription, type SolcOutput, solcCompile } from './solc'\nimport type { ResolvedConfig } from '@evmts/config'\nimport type { Node } from 'solidity-ast/node'\n\n// Compile the Solidity contract and return its ABI\nexport const compileContract = async <TIncludeAsts = boolean>(\n\tfilePath: string,\n\tbasedir: string,\n\tconfig: ResolvedConfig['compiler'],\n\tincludeAst: TIncludeAsts,\n\tfao: FileAccessObject,\n\tlogger: Logger,\n): Promise<{\n\tartifacts: SolcOutput['contracts'][string] | undefined\n\tmodules: Record<'string', ModuleInfo>\n\tasts: TIncludeAsts extends true ? Record<string, Node> : undefined\n\tsolcInput: SolcInputDescription\n\tsolcOutput: SolcOutput\n}> => {\n\tconst entryModule = await moduleFactory(\n\t\tfilePath,\n\t\tawait fao\n\t\t\t.readFile(await resolvePromise(filePath, basedir, fao, logger), 'utf8')\n\t\t\t.then((code) => {\n\t\t\t\treturn code\n\t\t\t}),\n\t\tconfig.remappings,\n\t\tconfig.libs,\n\t\tfao,\n\t)\n\n\tconst modules: Record<string, ModuleInfo> = {}\n\n\tconst stack = [entryModule]\n\twhile (stack.length !== 0) {\n\t\tconst m = stack.pop()\n\t\tinvariant(m, 'Module should exist')\n\t\tif (m.id in modules) {\n\t\t\tcontinue\n\t\t}\n\t\tmodules[m.id] = m\n\t\tfor (const dep of m.resolutions) {\n\t\t\tstack.push(dep)\n\t\t}\n\t}\n\n\tconst sources = Object.fromEntries(\n\t\tObject.entries(modules).map(([id, module]) => {\n\t\t\treturn [id, { content: module.code as string }]\n\t\t}),\n\t)\n\n\tconst emptyString = ''\n\tconst input: SolcInputDescription = {\n\t\tlanguage: 'Solidity',\n\t\tsources,\n\t\tsettings: {\n\t\t\toutputSelection: {\n\t\t\t\t'*': {\n\t\t\t\t\t'*': ['abi', 'userdoc'],\n\t\t\t\t\t...(includeAst ? { [emptyString]: ['ast'] } : {}),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tconst output = solcCompile(input)\n\n\tconst warnings = output?.errors?.filter(({ type }) => type === 'Warning')\n\tconst isErrors = (output?.errors?.length ?? 0) > (warnings?.length ?? 0)\n\n\tif (isErrors) {\n\t\tlogger.error('Compilation errors:')\n\t\tlogger.error(output?.errors as any)\n\t\tthrow new Error('Compilation failed')\n\t}\n\tif (warnings?.length) {\n\t\tlogger.warn(warnings as any)\n\t\tlogger.warn('Compilation warnings:')\n\t}\n\tif (includeAst) {\n\t\tconst asts = Object.fromEntries(\n\t\t\tObject.entries(output.sources).map(([id, source]) => {\n\t\t\t\treturn [id, source.ast]\n\t\t\t}),\n\t\t)\n\t\treturn {\n\t\t\tartifacts: output.contracts[entryModule.id],\n\t\t\tmodules,\n\t\t\tasts: asts as any,\n\t\t\tsolcInput: input,\n\t\t\tsolcOutput: output,\n\t\t}\n\t}\n\treturn {\n\t\tartifacts: output.contracts[entryModule.id],\n\t\tmodules,\n\t\tasts: undefined as any,\n\t\tsolcInput: input,\n\t\tsolcOutput: output,\n\t}\n}\n","import type { FileAccessObject, Logger, ModuleInfo } from '../types'\nimport { compileContract } from './compileContracts'\nimport type {\n\tSolcContractOutput,\n\tSolcInputDescription,\n\tSolcOutput,\n} from './solc'\nimport type { ResolvedConfig } from '@evmts/config'\nimport type { Node } from 'solidity-ast/node'\n\ntype Artifacts = Record<string, Pick<SolcContractOutput, 'abi' | 'userdoc'>>\n/**\n * Currently unimplemented just uses resolveArtifactsSync\n */\nexport const resolveArtifacts = async (\n\tsolFile: string,\n\tbasedir: string,\n\tlogger: Logger,\n\tconfig: ResolvedConfig,\n\tincludeAst: boolean,\n\tfao: FileAccessObject,\n): Promise<{\n\tartifacts: Artifacts\n\tmodules: Record<'string', ModuleInfo>\n\tasts: Record<string, Node> | undefined\n\tsolcInput: SolcInputDescription\n\tsolcOutput: SolcOutput\n}> => {\n\tif (!solFile.endsWith('.sol')) {\n\t\tthrow new Error('Not a solidity file')\n\t}\n\tconst { artifacts, modules, asts, solcInput, solcOutput } =\n\t\tawait compileContract(\n\t\t\tsolFile,\n\t\t\tbasedir,\n\t\t\tconfig.compiler,\n\t\t\tincludeAst,\n\t\t\tfao,\n\t\t\tlogger,\n\t\t)\n\n\tif (!artifacts) {\n\t\tlogger.error(`Compilation failed for ${solFile}`)\n\t\tthrow new Error('Compilation failed')\n\t}\n\n\treturn {\n\t\tartifacts: Object.fromEntries(\n\t\t\tObject.entries(artifacts).map(([contractName, contract]) => {\n\t\t\t\treturn [\n\t\t\t\t\tcontractName,\n\t\t\t\t\t{ contractName, abi: contract.abi, userdoc: contract.userdoc },\n\t\t\t\t]\n\t\t\t}),\n\t\t),\n\t\tmodules,\n\t\tasts,\n\t\tsolcInput,\n\t\tsolcOutput,\n\t}\n}\n","import type { FileAccessObject, ModuleInfo } from '../types'\nimport { invariant } from '../utils/invariant'\nimport { resolveImportPath } from './resolveImportPath'\nimport { resolveImports } from './resolveImports'\n\n/**\n * Creates a module from the given module information.\n * This includes resolving all imports and creating a dependency graph.\n *\n * Currently it modifies the source code in place which causes the ast to not match the source code.\n * This complexity leaks to the typescript lsp which has to account for this\n * Ideally we refactor this to not need to modify source code in place\n * Doing this hurts our ability to control the import graph and make it use node resolution though\n * See foundry that is alergic to using npm\n * Doing it this way for now is easier but for sure a leaky abstraction\n */\nexport const moduleFactorySync = (\n\tabsolutePath: string,\n\trawCode: string,\n\tremappings: Record<string, string>,\n\tlibs: string[],\n\tfao: FileAccessObject,\n): ModuleInfo => {\n\tconst stack = [{ absolutePath, rawCode }]\n\tconst modules = new Map<string, ModuleInfo>()\n\n\twhile (stack.length) {\n\t\tconst nextItem = stack.pop()\n\t\tinvariant(nextItem, 'Module should exist')\n\t\tconst { absolutePath, rawCode } = nextItem\n\n\t\tif (modules.has(absolutePath)) continue\n\n\t\tconst importedIds = resolveImports(absolutePath, rawCode).map((paths) =>\n\t\t\tresolveImportPath(absolutePath, paths, remappings, libs),\n\t\t)\n\n\t\tconst importRegEx = /(^\\s?import\\s+[^'\"]*['\"])(.*)(['\"]\\s*)/gm\n\t\tconst code = importedIds.reduce((code, importedId) => {\n\t\t\tconst depImportAbsolutePath = resolveImportPath(\n\t\t\t\tabsolutePath,\n\t\t\t\timportedId,\n\t\t\t\tremappings,\n\t\t\t\tlibs,\n\t\t\t)\n\t\t\treturn code.replace(importRegEx, (match, p1, p2, p3) => {\n\t\t\t\tconst resolvedPath = resolveImportPath(\n\t\t\t\t\tabsolutePath,\n\t\t\t\t\tp2,\n\t\t\t\t\tremappings,\n\t\t\t\t\tlibs,\n\t\t\t\t)\n\t\t\t\tif (resolvedPath === importedId) {\n\t\t\t\t\treturn `${p1}${depImportAbsolutePath}${p3}`\n\t\t\t\t} else {\n\t\t\t\t\treturn match\n\t\t\t\t}\n\t\t\t})\n\t\t}, rawCode)\n\n\t\tmodules.set(absolutePath, {\n\t\t\tid: absolutePath,\n\t\t\trawCode,\n\t\t\tcode,\n\t\t\timportedIds,\n\t\t\tresolutions: [],\n\t\t})\n\n\t\timportedIds.forEach((importedId) => {\n\t\t\tconst depImportAbsolutePath = resolveImportPath(\n\t\t\t\tabsolutePath,\n\t\t\t\timportedId,\n\t\t\t\tremappings,\n\t\t\t\tlibs,\n\t\t\t)\n\t\t\tconst depRawCode = fao.readFileSync(depImportAbsolutePath, 'utf8')\n\n\t\t\tstack.push({ absolutePath: depImportAbsolutePath, rawCode: depRawCode })\n\t\t})\n\t}\n\n\tfor (const [_, m] of modules.entries()) {\n\t\tconst { importedIds } = m\n\t\tm.resolutions = []\n\t\timportedIds.forEach((importedId) => {\n\t\t\tconst resolution = modules.get(importedId)\n\t\t\tinvariant(resolution, `resolution for ${importedId} not found`)\n\t\t\tm.resolutions.push(resolution)\n\t\t})\n\t}\n\n\treturn modules.get(absolutePath) as ModuleInfo\n}\n","import type { FileAccessObject, ModuleInfo } from '../types'\nimport { invariant } from '../utils/invariant'\nimport { moduleFactorySync } from './moduleFactorySync'\nimport { type SolcInputDescription, type SolcOutput, solcCompile } from './solc'\nimport type { ResolvedConfig } from '@evmts/config'\nimport * as resolve from 'resolve'\nimport type { Node } from 'solidity-ast/node'\n\n// Compile the Solidity contract and return its ABI\nexport const compileContractSync = <TIncludeAsts = boolean>(\n\tfilePath: string,\n\tbasedir: string,\n\tconfig: ResolvedConfig['compiler'],\n\tincludeAst: TIncludeAsts,\n\tfao: FileAccessObject,\n): {\n\tartifacts: SolcOutput['contracts'][string] | undefined\n\tmodules: Record<'string', ModuleInfo>\n\tasts: TIncludeAsts extends true ? Record<string, Node> : undefined\n\tsolcInput: SolcInputDescription\n\tsolcOutput: SolcOutput\n} => {\n\tconst entryModule = moduleFactorySync(\n\t\tfilePath,\n\t\tfao.readFileSync(\n\t\t\tresolve.sync(filePath, {\n\t\t\t\tbasedir,\n\t\t\t\treadFileSync: (file) => fao.readFileSync(file, 'utf8'),\n\t\t\t\tisFile: fao.existsSync,\n\t\t\t}),\n\t\t\t'utf8',\n\t\t),\n\t\tconfig.remappings,\n\t\tconfig.libs,\n\t\tfao,\n\t)\n\n\tconst modules: Record<string, ModuleInfo> = {}\n\n\t// Get modules by recursively resolving dependencies\n\tconst stack = [entryModule]\n\twhile (stack.length !== 0) {\n\t\tconst m = stack.pop()\n\t\tinvariant(m, 'Module should exist')\n\t\tif (m.id in modules) {\n\t\t\tcontinue\n\t\t}\n\t\tmodules[m.id] = m\n\t\tfor (const dep of m.resolutions) {\n\t\t\tstack.push(dep)\n\t\t}\n\t}\n\n\tconst sources = Object.fromEntries(\n\t\tObject.entries(modules).map(([id, module]) => {\n\t\t\treturn [id, { content: module.code as string }]\n\t\t}),\n\t)\n\n\tconst emptyString = ''\n\tconst input: SolcInputDescription = {\n\t\tlanguage: 'Solidity',\n\t\tsources,\n\t\tsettings: {\n\t\t\toutputSelection: {\n\t\t\t\t'*': {\n\t\t\t\t\t'*': ['abi', 'userdoc'],\n\t\t\t\t\t...(includeAst ? { [emptyString]: ['ast'] } : {}),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tconst output = solcCompile(input)\n\n\tconst warnings = output?.errors?.filter(({ type }) => type === 'Warning')\n\tconst isErrors = (output?.errors?.length ?? 0) > (warnings?.length ?? 0)\n\n\tif (isErrors) {\n\t\tconsole.error('Compilation errors:', output?.errors)\n\t\tthrow new Error('Compilation failed')\n\t}\n\tif (warnings?.length) {\n\t\tconsole.warn('Compilation warnings:', output?.errors)\n\t}\n\tif (includeAst) {\n\t\tconst asts = Object.fromEntries(\n\t\t\tObject.entries(output.sources).map(([id, source]) => {\n\t\t\t\treturn [id, source.ast]\n\t\t\t}),\n\t\t)\n\t\treturn {\n\t\t\tartifacts: output.contracts[entryModule.id],\n\t\t\tmodules,\n\t\t\tasts: asts as any,\n\t\t\tsolcInput: input,\n\t\t\tsolcOutput: output,\n\t\t}\n\t}\n\treturn {\n\t\tartifacts: output.contracts[entryModule.id],\n\t\tmodules,\n\t\tasts: undefined as any,\n\t\tsolcInput: input,\n\t\tsolcOutput: output,\n\t}\n}\n","import type { FileAccessObject, Logger, ModuleInfo } from '../types'\nimport { compileContractSync } from './compileContractsSync'\nimport type {\n\tSolcContractOutput,\n\tSolcInputDescription,\n\tSolcOutput,\n} from './solc'\nimport type { ResolvedConfig } from '@evmts/config'\nimport type { Node } from 'solidity-ast/node'\n\nexport type Artifacts = Record<\n\tstring,\n\tPick<SolcContractOutput, 'abi' | 'userdoc'>\n>\n\nexport const resolveArtifactsSync = (\n\tsolFile: string,\n\tbasedir: string,\n\tlogger: Logger,\n\tconfig: ResolvedConfig,\n\tincludeAst: boolean,\n\tfao: FileAccessObject,\n): {\n\tartifacts: Artifacts\n\tmodules: Record<'string', ModuleInfo>\n\tasts: Record<string, Node> | undefined\n\tsolcInput: SolcInputDescription\n\tsolcOutput: SolcOutput\n} => {\n\tif (!solFile.endsWith('.sol')) {\n\t\tthrow new Error('Not a solidity file')\n\t}\n\tconst { artifacts, modules, asts, solcInput, solcOutput } =\n\t\tcompileContractSync(solFile, basedir, config.compiler, includeAst, fao)\n\n\tif (!artifacts) {\n\t\tlogger.error(`Compilation failed for ${solFile}`)\n\t\tthrow new Error('Compilation failed')\n\t}\n\n\treturn {\n\t\tartifacts: Object.fromEntries(\n\t\t\tObject.entries(artifacts).map(([contractName, contract]) => {\n\t\t\t\treturn [\n\t\t\t\t\tcontractName,\n\t\t\t\t\t{ contractName, abi: contract.abi, userdoc: contract.userdoc },\n\t\t\t\t]\n\t\t\t}),\n\t\t),\n\t\tmodules,\n\t\tasts,\n\t\tsolcInput,\n\t\tsolcOutput,\n\t}\n}\n","{\n  \"name\": \"@evmts/bundler\",\n  \"version\": \"0.11.2\",\n  \"private\": false,\n  \"description\": \"Internal bundler for Evmts\",\n  \"keywords\": [\n    \"solidity\",\n    \"forge\",\n    \"foundry\",\n    \"sol\",\n    \"typescript\",\n    \"web3\",\n    \"blockchain\"\n  ],\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/evmts/evmts-monorepo.git\",\n    \"directory\": \"bundlers/bundler\"\n  },\n  \"license\": \"MIT\",\n  \"contributors\": [\n    \"Will Cory <willcory10@gmail.com>\"\n  ],\n  \"type\": \"module\",\n  \"main\": \"dist/index.cjs\",\n  \"module\": \"dist/index.js\",\n  \"types\": \"types/src/index.d.ts\",\n  \"files\": [\n    \"dist\",\n    \"types\",\n    \"src\"\n  ],\n  \"scripts\": {\n    \"build\": \"nx run-many --targets=build:dist,build:types --projects=@evmts/bundler \",\n    \"build:dist\": \"tsup\",\n    \"build:types\": \"tsc --emitDeclarationOnly\",\n    \"clean\": \"rm -rf node_modules && rm -rf artifacts && rm -rf dist && rm -rf cache\",\n    \"format\": \"rome format . --write\",\n    \"format:check\": \"rome format .\",\n    \"lint\": \"rome check . --apply-unsafe\",\n    \"lint:check\": \"rome check . --verbose\",\n    \"package:up\": \"pnpm up --latest\",\n    \"test\": \"vitest --coverage\",\n    \"test:coverage\": \"vitest run --coverage\",\n    \"test:run\": \"vitest run\",\n    \"test:ui\": \"vitest --ui\"\n  },\n  \"dependencies\": {\n    \"@evmts/config\": \"workspace:^\",\n    \"@evmts/core\": \"workspace:^\",\n    \"@evmts/tsconfig\": \"workspace:^\",\n    \"@types/node\": \"^20.5.7\",\n    \"@types/resolve\": \"^1.20.2\",\n    \"glob\": \"^10.3.3\",\n    \"resolve\": \"^1.22.4\",\n    \"solidity-ast\": \"^0.4.52\",\n    \"unplugin\": \"^1.4.0\"\n  },\n  \"devDependencies\": {\n    \"@vitest/coverage-v8\": \"^0.34.3\",\n    \"@vitest/ui\": \"^0.34.3\",\n    \"abitype\": \"^0.9.8\",\n    \"rome\": \"^12.1.3\",\n    \"solc\": \"0.8.21\",\n    \"tsup\": \"^7.2.0\",\n    \"typescript\": \"^5.2.2\",\n    \"vitest\": \"^0.34.3\",\n    \"wagmi\": \"^1.3.10\",\n    \"zod\": \"^3.22.2\"\n  },\n  \"peerDependencies\": {\n    \"solc\": \">0.8.10\"\n  },\n  \"publishConfig\": {\n    \"access\": \"public\"\n  }\n}\n","export const getEtherscanLinks = (\n\taddresses: Record<number, `0x${string}` | undefined>,\n): [chainId: number, link: string][] => {\n\tconst etherscanBaseUris: Record<number, string> = {\n\t\t1: 'https://etherscan.io',\n\t\t5: 'https://goerli.etherscan.io',\n\t\t10: 'https://optimistic.etherscan.io',\n\t\t56: 'https://bscscan.com',\n\t\t137: 'https://polygonscan.com',\n\t\t250: 'https://ftmscan.com',\n\t\t280: 'https://zksync2-mainnet.zkscan.io',\n\t\t288: 'https://bobascan.com',\n\t\t324: 'https://zksync2-mainnet.zkscan.io',\n\t\t420: 'https://goerli-explorer.optimism.io',\n\t\t1284: 'https://moonscan.io',\n\t\t4002: 'https://testnet.ftmscan.com',\n\t\t43114: 'https://explorer.avax.network',\n\t\t42220: 'https://celoscan.io',\n\t\t42161: 'https://arbiscan.io',\n\t\t80001: 'https://mumbai.polygonscan.com',\n\t\t84531: 'https://goerli.basescan.org',\n\t\t421613: 'https://goerli-rollup-explorer.arbitrum.io',\n\t\t534353: 'https://blockscout.scroll.io',\n\t}\n\n\treturn Object.entries(addresses)\n\t\t.map(([networkId, address]) => {\n\t\t\tconst link =\n\t\t\t\tetherscanBaseUris[networkId as unknown as number] &&\n\t\t\t\t`${\n\t\t\t\t\tetherscanBaseUris[networkId as unknown as number]\n\t\t\t\t}/address/${address}`\n\t\t\treturn link && [networkId, link]\n\t\t})\n\t\t.filter(Boolean) as [number, string][]\n}\n","import type { Artifacts } from '../solc/resolveArtifactsSync'\nimport { getEtherscanLinks } from '../utils'\nimport type { ResolvedConfig } from '@evmts/config'\n\nexport const generateDtsBody = (\n\tartifacts: Artifacts,\n\tconfig: ResolvedConfig,\n) => {\n\treturn Object.entries(artifacts)\n\t\t.flatMap(([contractName, { abi, userdoc = {} }]) => {\n\t\t\tconst contract = {\n\t\t\t\tname: contractName,\n\t\t\t\tabi,\n\t\t\t\taddresses:\n\t\t\t\t\tconfig.localContracts.contracts?.find(\n\t\t\t\t\t\t(contractConfig) => contractConfig.name === contractName,\n\t\t\t\t\t)?.addresses ?? {},\n\t\t\t}\n\t\t\tconst etherscanLinks = getEtherscanLinks(contract.addresses ?? {})\n\t\t\tconst natspec = Object.entries(userdoc.methods ?? {}).map(\n\t\t\t\t([method, { notice }]) => ` * @property ${method} ${notice}`,\n\t\t\t)\n\t\t\tif (userdoc.notice) {\n\t\t\t\tnatspec.unshift(` * @notice ${userdoc.notice}`)\n\t\t\t}\n\t\t\treturn [\n\t\t\t\t`const _abi${contractName} = ${JSON.stringify(contract.abi)} as const;`,\n\t\t\t\t`const _chainAddressMap${contractName} = ${JSON.stringify(\n\t\t\t\t\tcontract.addresses ?? {},\n\t\t\t\t)} as const;`,\n\t\t\t\t`const _name${contractName} = ${JSON.stringify(\n\t\t\t\t\tcontractName,\n\t\t\t\t)} as const;`,\n\t\t\t\t'/**',\n\t\t\t\t` * ${contractName} EvmtsContract`,\n\t\t\t\t...natspec,\n\t\t\t\t...etherscanLinks.map(\n\t\t\t\t\t([chainId, etherscanLink]) =>\n\t\t\t\t\t\t` * @etherscan-${chainId} ${etherscanLink}`,\n\t\t\t\t),\n\t\t\t\t' */',\n\t\t\t\t`export const ${contractName}: EvmtsContract<typeof _name${contractName}, typeof _chainAddressMap${contractName}, typeof _abi${contractName}>;`,\n\t\t\t].filter(Boolean)\n\t\t})\n\t\t.join('\\n')\n}\n","import type { Artifacts } from '../solc/resolveArtifactsSync'\nimport { generateDtsBody } from './generateEvmtsBodyDts'\nimport type { ResolvedConfig } from '@evmts/config'\n\ntype ModuleType = 'cjs' | 'mjs' | 'ts' | 'dts'\n\nexport const generateEvmtsBody = (\n\tartifacts: Artifacts,\n\tconfig: ResolvedConfig,\n\tmoduleType: ModuleType,\n): string => {\n\tif (moduleType === 'dts') {\n\t\treturn generateDtsBody(artifacts, config)\n\t}\n\treturn Object.entries(artifacts)\n\t\t.flatMap(([contractName, { abi, userdoc = {} }]) => {\n\t\t\tconst contract = JSON.stringify({\n\t\t\t\tname: contractName,\n\t\t\t\tabi,\n\t\t\t\taddresses:\n\t\t\t\t\tconfig.localContracts.contracts?.find(\n\t\t\t\t\t\t(contractConfig) => contractConfig.name === contractName,\n\t\t\t\t\t)?.addresses ?? {},\n\t\t\t})\n\n\t\t\tconst natspec = Object.entries(userdoc.methods ?? {}).map(\n\t\t\t\t([method, { notice }]) => ` * @property ${method} ${notice}`,\n\t\t\t)\n\t\t\tif (userdoc.notice) {\n\t\t\t\tnatspec.unshift(` * ${userdoc.notice}`)\n\t\t\t}\n\t\t\tif (natspec.length) {\n\t\t\t\tnatspec.unshift('/**')\n\t\t\t\tnatspec.push(' */')\n\t\t\t}\n\t\t\tif (moduleType === 'cjs') {\n\t\t\t\treturn [\n\t\t\t\t\t`const _${contractName} = ${contract}`,\n\t\t\t\t\t...natspec,\n\t\t\t\t\t`module.exports.${contractName} = evmtsContractFactory(_${contractName})`,\n\t\t\t\t]\n\t\t\t}\n\n\t\t\tif (moduleType === 'ts') {\n\t\t\t\treturn [\n\t\t\t\t\t`const _${contractName} = ${contract} as const`,\n\t\t\t\t\t...natspec,\n\t\t\t\t\t`export const ${contractName} = evmtsContractFactory(_${contractName})`,\n\t\t\t\t]\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t`const _${contractName} = ${contract}`,\n\t\t\t\t...natspec,\n\t\t\t\t`export const ${contractName} = evmtsContractFactory(_${contractName})`,\n\t\t\t]\n\t\t})\n\t\t.join('\\n')\n}\n","import type { Artifacts } from '../solc/resolveArtifactsSync'\nimport type { Logger } from '../types'\nimport { generateEvmtsBody } from './generateEvmtsBody'\nimport type { ResolvedConfig } from '@evmts/config'\n\n// TODO make this actually async\nexport const generateRuntime = async (\n\tartifacts: Artifacts,\n\tconfig: ResolvedConfig,\n\tmoduleType: 'cjs' | 'mjs' | 'ts',\n\tlogger: Logger,\n): Promise<string> => {\n\tif (artifacts) {\n\t\tconst evmtsImports =\n\t\t\tmoduleType !== 'cjs'\n\t\t\t\t? `import { evmtsContractFactory } from '@evmts/core'`\n\t\t\t\t: `const { evmtsContractFactory } = require('@evmts/core')`\n\t\tconst evmtsBody = generateEvmtsBody(artifacts, config, moduleType)\n\t\treturn [evmtsImports, evmtsBody].join('\\n')\n\t}\n\tlogger.warn('No artifacts found, skipping runtime generation')\n\treturn ''\n}\n","import type { Artifacts } from '../solc/resolveArtifactsSync'\nimport type { Logger } from '../types'\nimport { generateEvmtsBody } from './generateEvmtsBody'\nimport type { ResolvedConfig } from '@evmts/config'\n\nexport const generateRuntimeSync = (\n\tartifacts: Artifacts,\n\tconfig: ResolvedConfig,\n\tmoduleType: 'cjs' | 'mjs' | 'ts' | 'dts',\n\tlogger: Logger,\n): string => {\n\tif (!artifacts || Object.keys(artifacts).length === 0) {\n\t\tlogger.warn('No artifacts found, skipping runtime generation')\n\t\treturn ''\n\t}\n\tlet evmtsImports: string\n\tif (moduleType === 'cjs') {\n\t\tevmtsImports = `const { evmtsContractFactory } = require('@evmts/core')`\n\t} else if (moduleType === 'dts') {\n\t\tevmtsImports = `import { EvmtsContract } from '@evmts/core'`\n\t} else if (moduleType === 'ts' || moduleType === 'mjs') {\n\t\tevmtsImports = `import { evmtsContractFactory } from '@evmts/core'`\n\t} else {\n\t\tthrow new Error(`Unknown module type: ${moduleType}`)\n\t}\n\tconst evmtsBody = generateEvmtsBody(artifacts, config, moduleType)\n\treturn [evmtsImports, evmtsBody].join('\\n')\n}\n","import { generateDtsBody } from './runtime/generateEvmtsBodyDts'\nimport { generateRuntime } from './runtime/generateRuntime'\nimport { generateRuntimeSync } from './runtime/generateRuntimeSync'\nimport { resolveArtifacts, resolveArtifactsSync } from './solc'\nimport type { Bundler } from './types'\n// TODO wrap this in a typesafe version\n// @ts-ignore\nimport solc from 'solc'\n\nexport const bundler: Bundler = (config, logger, fao) => {\n\treturn {\n\t\tname: bundler.name,\n\t\tconfig,\n\t\tresolveDts: async (modulePath, basedir, includeAst) => {\n\t\t\ttry {\n\t\t\t\tconst { solcInput, solcOutput, artifacts, modules, asts } =\n\t\t\t\t\tawait resolveArtifacts(\n\t\t\t\t\t\tmodulePath,\n\t\t\t\t\t\tbasedir,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tconfig,\n\t\t\t\t\t\tincludeAst,\n\t\t\t\t\t\tfao,\n\t\t\t\t\t)\n\t\t\t\tif (artifacts) {\n\t\t\t\t\tconst evmtsImports = `import { EvmtsContract } from '@evmts/core'`\n\t\t\t\t\tconst evmtsBody = generateDtsBody(artifacts, config)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsolcInput,\n\t\t\t\t\t\tsolcOutput,\n\t\t\t\t\t\tasts,\n\t\t\t\t\t\tcode: [evmtsImports, evmtsBody].join('\\n'),\n\t\t\t\t\t\tmodules,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn { solcInput, solcOutput, code: '', modules, asts }\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error(e as any)\n\t\t\t\tlogger.error('there was an error in evmts plugin generating .dts')\n\t\t\t\tthrow e\n\t\t\t}\n\t\t},\n\t\tresolveDtsSync: (modulePath, basedir, includeAst) => {\n\t\t\ttry {\n\t\t\t\tconst { artifacts, modules, asts, solcInput, solcOutput } =\n\t\t\t\t\tresolveArtifactsSync(\n\t\t\t\t\t\tmodulePath,\n\t\t\t\t\t\tbasedir,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tconfig,\n\t\t\t\t\t\tincludeAst,\n\t\t\t\t\t\tfao,\n\t\t\t\t\t)\n\t\t\t\tif (artifacts) {\n\t\t\t\t\tconst evmtsImports = `import { EvmtsContract } from '@evmts/core'`\n\t\t\t\t\tconst evmtsBody = generateDtsBody(artifacts, config)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsolcInput,\n\t\t\t\t\t\tsolcOutput,\n\t\t\t\t\t\tasts,\n\t\t\t\t\t\tmodules,\n\t\t\t\t\t\tcode: [evmtsImports, evmtsBody].join('\\n'),\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn { modules, code: '', asts, solcInput, solcOutput }\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error(e as any)\n\t\t\t\tlogger.error('there was an error in evmts plugin resolving .dts')\n\t\t\t\tthrow e\n\t\t\t}\n\t\t},\n\t\tresolveTsModuleSync: (modulePath, basedir, includeAst) => {\n\t\t\ttry {\n\t\t\t\tconst { solcInput, solcOutput, asts, artifacts, modules } =\n\t\t\t\t\tresolveArtifactsSync(\n\t\t\t\t\t\tmodulePath,\n\t\t\t\t\t\tbasedir,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tconfig,\n\t\t\t\t\t\tincludeAst,\n\t\t\t\t\t\tfao,\n\t\t\t\t\t)\n\t\t\t\tconst code = generateRuntimeSync(artifacts, config, 'ts', logger)\n\t\t\t\treturn { code, modules, solcInput, solcOutput, asts }\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error(e as any)\n\t\t\t\tlogger.error('there was an error in evmts plugin resolving .ts')\n\t\t\t\tthrow e\n\t\t\t}\n\t\t},\n\t\tresolveTsModule: async (modulePath, basedir, includeAst) => {\n\t\t\ttry {\n\t\t\t\tconst { solcInput, solcOutput, asts, artifacts, modules } =\n\t\t\t\t\tawait resolveArtifacts(\n\t\t\t\t\t\tmodulePath,\n\t\t\t\t\t\tbasedir,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tconfig,\n\t\t\t\t\t\tincludeAst,\n\t\t\t\t\t\tfao,\n\t\t\t\t\t)\n\t\t\t\tconst code = await generateRuntime(artifacts, config, 'ts', logger)\n\t\t\t\treturn { code, modules, solcInput, solcOutput, asts }\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error(e as any)\n\t\t\t\tlogger.error('there was an error in evmts plugin resolving .ts')\n\t\t\t\tthrow e\n\t\t\t}\n\t\t},\n\t\tresolveCjsModuleSync: (modulePath, basedir, includeAst) => {\n\t\t\ttry {\n\t\t\t\tconst { solcInput, solcOutput, asts, artifacts, modules } =\n\t\t\t\t\tresolveArtifactsSync(\n\t\t\t\t\t\tmodulePath,\n\t\t\t\t\t\tbasedir,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tconfig,\n\t\t\t\t\t\tincludeAst,\n\t\t\t\t\t\tfao,\n\t\t\t\t\t)\n\t\t\t\tconst code = generateRuntimeSync(artifacts, config, 'cjs', logger)\n\t\t\t\treturn { code, modules, solcInput, solcOutput, asts }\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error(e as any)\n\t\t\t\tlogger.error('there was an error in evmts plugin resolving .cjs')\n\t\t\t\tthrow e\n\t\t\t}\n\t\t},\n\t\tresolveCjsModule: async (modulePath, basedir, includeAst) => {\n\t\t\ttry {\n\t\t\t\tconst { solcInput, solcOutput, asts, artifacts, modules } =\n\t\t\t\t\tawait resolveArtifacts(\n\t\t\t\t\t\tmodulePath,\n\t\t\t\t\t\tbasedir,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tconfig,\n\t\t\t\t\t\tincludeAst,\n\t\t\t\t\t\tfao,\n\t\t\t\t\t)\n\t\t\t\tconst code = await generateRuntime(artifacts, config, 'cjs', logger)\n\t\t\t\treturn { code, modules, solcInput, solcOutput, asts }\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error(e as any)\n\t\t\t\tlogger.error('there was an error in evmts plugin resolving .cjs')\n\t\t\t\tthrow e\n\t\t\t}\n\t\t},\n\t\tresolveEsmModuleSync: (modulePath, basedir, includeAst) => {\n\t\t\ttry {\n\t\t\t\tconst { solcInput, solcOutput, asts, artifacts, modules } =\n\t\t\t\t\tresolveArtifactsSync(\n\t\t\t\t\t\tmodulePath,\n\t\t\t\t\t\tbasedir,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tconfig,\n\t\t\t\t\t\tincludeAst,\n\t\t\t\t\t\tfao,\n\t\t\t\t\t)\n\t\t\t\tconst code = generateRuntimeSync(artifacts, config, 'mjs', logger)\n\t\t\t\treturn { code, modules, solcInput, solcOutput, asts }\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error('there was an error in evmts plugin resolving .mjs')\n\t\t\t\tthrow e\n\t\t\t}\n\t\t},\n\t\tresolveEsmModule: async (modulePath, basedir, includeAst) => {\n\t\t\ttry {\n\t\t\t\tconst { solcInput, solcOutput, asts, artifacts, modules } =\n\t\t\t\t\tawait resolveArtifacts(\n\t\t\t\t\t\tmodulePath,\n\t\t\t\t\t\tbasedir,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tconfig,\n\t\t\t\t\t\tincludeAst,\n\t\t\t\t\t\tfao,\n\t\t\t\t\t)\n\t\t\t\tconst code = await generateRuntime(artifacts, config, 'mjs', logger)\n\t\t\t\treturn { code, modules, solcInput, solcOutput, asts }\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error(e as any)\n\t\t\t\tlogger.error('there was an error in evmts plugin resolving .mjs')\n\t\t\t\tthrow e\n\t\t\t}\n\t\t},\n\t}\n}\n","import * as packageJson from '../package.json'\nimport { bundler } from './bundler'\nimport type { FileAccessObject } from './types'\nimport { type ResolvedConfig, loadConfigAsync } from '@evmts/config'\nimport { existsSync, readFileSync } from 'fs'\nimport { readFile } from 'fs/promises'\nimport { createRequire } from 'module'\nimport { type UnpluginFactory, createUnplugin } from 'unplugin'\nimport { z } from 'zod'\n\nconst compilerOptionValidator = z\n\t.enum(['solc', 'foundry'])\n\t.default('solc')\n\t.describe('compiler to use.  Defaults to solc')\n\nexport type CompilerOption = z.infer<typeof compilerOptionValidator>\n\nconst bundlers = {\n\tsolc: bundler,\n}\n\n// make a function with this signature\nexport const unpluginFn: UnpluginFactory<\n\t{ compiler?: CompilerOption } | undefined,\n\tfalse\n> = (options = {}) => {\n\tlet config: ResolvedConfig\n\n\t// for current release we will hardcode this to solc\n\tconst parsedCompilerOption = compilerOptionValidator.safeParse(\n\t\toptions.compiler,\n\t)\n\tif (!parsedCompilerOption.success) {\n\t\tthrow new Error(\n\t\t\t`Invalid compiler option: ${options.compiler}.  Valid options are 'solc' and 'foundry'`,\n\t\t)\n\t}\n\tconst compilerOption = parsedCompilerOption.data\n\n\tif (compilerOption === 'foundry') {\n\t\tthrow new Error(\n\t\t\t'We have abandoned the foundry option despite supporting it in the past. Please use solc instead. Foundry will be added back as a compiler at a later time.',\n\t\t)\n\t}\n\tconst bundler = bundlers[compilerOption]\n\tlet moduleResolver: ReturnType<typeof bundler>\n\n\tconst fao: FileAccessObject = {\n\t\texistsSync,\n\t\treadFile,\n\t\treadFileSync,\n\t}\n\n\treturn {\n\t\tname: '@evmts/rollup-plugin',\n\t\tversion: packageJson.version,\n\t\tasync buildStart() {\n\t\t\tconfig = await loadConfigAsync(process.cwd())\n\t\t\tmoduleResolver = bundler(config, console, fao)\n\t\t\tthis.addWatchFile('./tsconfig.json')\n\t\t},\n\t\tasync resolveId(id, importer, options) {\n\t\t\t// to handle the case where the import is coming from a node_module or a different workspace\n\t\t\t// we need to always point @evmts/core to the local version\n\t\t\tif (\n\t\t\t\tid.startsWith('@evmts/core') &&\n\t\t\t\t!importer?.startsWith(process.cwd()) &&\n\t\t\t\t!importer?.includes('node_modules')\n\t\t\t) {\n\t\t\t\tconsole.log({ id, importer, options })\n\t\t\t\treturn createRequire(`${process.cwd()}/`).resolve('@evmts/core')\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\t\tasync load(id: string) {\n\t\t\tif (!id.endsWith('.sol')) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (existsSync(`${id}.ts`)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (existsSync(`${id}.d.ts`)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst { code, modules } = await moduleResolver.resolveEsmModule(\n\t\t\t\tid,\n\t\t\t\tprocess.cwd(),\n\t\t\t\tfalse,\n\t\t\t)\n\t\t\tObject.values(modules).forEach((module) => {\n\t\t\t\tif (module.id.includes('node_modules')) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.addWatchFile(module.id)\n\t\t\t})\n\t\t\treturn code\n\t\t},\n\t} as const\n}\n\nconst evmtsUnplugin = createUnplugin(unpluginFn)\n\n// Hacks to make types portable\n// we should manually type these at some point\n\nexport const vitePluginEvmts =\n\tevmtsUnplugin.vite as any as typeof evmtsUnplugin.rollup\nexport const rollupPluginEvmts = evmtsUnplugin.rollup\nexport const esbuildPluginEvmts = evmtsUnplugin.esbuild\nexport const webpackPluginEvmts =\n\tevmtsUnplugin.webpack as typeof evmtsUnplugin.rspack\n\nexport const rspackPluginEvmts = evmtsUnplugin.rspack\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,SAAS,UAAU,WAAgB,SAAoC;AAC7E,MAAI,CAAC,WAAW;AACf,UAAM,IAAI,MAAM,OAAO;AAAA,EACxB;AACD;;;ACHA,qBAAoB;AAEb,IAAM,iBAAiB,CAC7B,UACA,SACA,KACA,WACqB;AACrB,SAAO,IAAI,QAAgB,CAAC,gBAAgB,kBAAkB;AAC7D,uBAAAA;AAAA,MACC;AAAA,MACA;AAAA,QACC;AAAA,QACA,UAAU,CAAC,MAAM,OAAO;AACvB,cACE,SAAS,MAAM,MAAM,EACrB,KAAK,CAACC,UAAS;AACf,eAAG,MAAMA,KAAI;AAAA,UACd,CAAC,EACA,MAAM,CAAC,MAAM;AACb,mBAAO,MAAM,CAAC;AACd,mBAAO,MAAM,oBAAoB;AACjC,eAAG,CAAC;AAAA,UACL,CAAC;AAAA,QACH;AAAA,QACA,QAAQ,CAAC,MA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ChE;AACA,aAAO;AAAA,IACR;AAAA,IACA,MAAM,KAAK,IAAY;AACtB,UAAI,CAAC,GAAG,SAAS,MAAM,GAAG;AACzB;AAAA,MACD;AACA,cAAI,sBAAW,GAAG,EAAE,KAAK,GAAG;AAC3B;AAAA,MACD;AACA,cAAI,sBAAW,GAAG,EAAE,OAAO,GAAG;AAC7B;AAAA,MACD;AACA,YAAM,EAAE,MAAM,QAAQ,IAAI,MAAM,eAAe;AAAA,QAC9C;AAAA,QACA,QAAQ,IAAI;AAAA,QACZ;AAAA,MACD;AACA,aAAO,OAAO,OAAO,EAAE,QAAQ,CAACC,YAAW;AAC1C,YAAIA,QAAO,GAAG,SAAS,cAAc,GAAG;AACvC;AAAA,QACD;AACA,aAAK,aAAaA,QAAO,EAAE;AAAA,MAC5B,CAAC;AACD,aAAO;AAAA,IACR;AAAA,EACD;AACD;AAEA,IAAM,oBAAgB,gCAAe,UAAU;AAKxC,IAAM,kBACZ,cAAc;AACR,IAAM,oBAAoB,cAAc;AACxC,IAAM,qBAAqB,cAAc;AACzC,IAAM,qBACZ,cAAc;AAER,IAAM,oBAAoB,cAAc;","names":["resolve","file","resolve","path","absolutePath","rawCode","code","solc","module","absolutePath","rawCode","code","resolve","module","import_solc","bundler","options","module"]}