@0xsequence/catapult 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +29 -0
- package/.github/workflows/ci.yml +181 -0
- package/CONCEPT.md +24 -0
- package/README.md +772 -0
- package/contracts/checked-call.huff +65 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +16 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/common.d.ts +11 -0
- package/dist/commands/common.d.ts.map +1 -0
- package/dist/commands/common.js +73 -0
- package/dist/commands/common.js.map +1 -0
- package/dist/commands/dry.d.ts +3 -0
- package/dist/commands/dry.d.ts.map +1 -0
- package/dist/commands/dry.js +171 -0
- package/dist/commands/dry.js.map +1 -0
- package/dist/commands/etherscan.d.ts +3 -0
- package/dist/commands/etherscan.d.ts.map +1 -0
- package/dist/commands/etherscan.js +323 -0
- package/dist/commands/etherscan.js.map +1 -0
- package/dist/commands/index.d.ts +6 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +22 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/list.d.ts +3 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +259 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/run.d.ts +3 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +96 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/utils.d.ts +3 -0
- package/dist/commands/utils.d.ts.map +1 -0
- package/dist/commands/utils.js +46 -0
- package/dist/commands/utils.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/__tests__/deployer-events.spec.d.ts +2 -0
- package/dist/lib/__tests__/deployer-events.spec.d.ts.map +1 -0
- package/dist/lib/__tests__/deployer-events.spec.js +260 -0
- package/dist/lib/__tests__/deployer-events.spec.js.map +1 -0
- package/dist/lib/__tests__/deployer.spec.d.ts +2 -0
- package/dist/lib/__tests__/deployer.spec.d.ts.map +1 -0
- package/dist/lib/__tests__/deployer.spec.js +884 -0
- package/dist/lib/__tests__/deployer.spec.js.map +1 -0
- package/dist/lib/__tests__/network-utils.spec.d.ts +2 -0
- package/dist/lib/__tests__/network-utils.spec.d.ts.map +1 -0
- package/dist/lib/__tests__/network-utils.spec.js +140 -0
- package/dist/lib/__tests__/network-utils.spec.js.map +1 -0
- package/dist/lib/contracts/__tests__/repository.spec.d.ts +2 -0
- package/dist/lib/contracts/__tests__/repository.spec.d.ts.map +1 -0
- package/dist/lib/contracts/__tests__/repository.spec.js +321 -0
- package/dist/lib/contracts/__tests__/repository.spec.js.map +1 -0
- package/dist/lib/contracts/repository.d.ts +27 -0
- package/dist/lib/contracts/repository.d.ts.map +1 -0
- package/dist/lib/contracts/repository.js +241 -0
- package/dist/lib/contracts/repository.js.map +1 -0
- package/dist/lib/core/__tests__/engine.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/engine.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/engine.spec.js +1212 -0
- package/dist/lib/core/__tests__/engine.spec.js.map +1 -0
- package/dist/lib/core/__tests__/graph.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/graph.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/graph.spec.js +116 -0
- package/dist/lib/core/__tests__/graph.spec.js.map +1 -0
- package/dist/lib/core/__tests__/json-integration.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/json-integration.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/json-integration.spec.js +300 -0
- package/dist/lib/core/__tests__/json-integration.spec.js.map +1 -0
- package/dist/lib/core/__tests__/loader.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/loader.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/loader.spec.js +288 -0
- package/dist/lib/core/__tests__/loader.spec.js.map +1 -0
- package/dist/lib/core/__tests__/multi-platform-verification.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/multi-platform-verification.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/multi-platform-verification.spec.js +342 -0
- package/dist/lib/core/__tests__/multi-platform-verification.spec.js.map +1 -0
- package/dist/lib/core/__tests__/resolver.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/resolver.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/resolver.spec.js +1367 -0
- package/dist/lib/core/__tests__/resolver.spec.js.map +1 -0
- package/dist/lib/core/__tests__/static-action.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/static-action.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/static-action.spec.js +136 -0
- package/dist/lib/core/__tests__/static-action.spec.js.map +1 -0
- package/dist/lib/core/context.d.ts +29 -0
- package/dist/lib/core/context.d.ts.map +1 -0
- package/dist/lib/core/context.js +88 -0
- package/dist/lib/core/context.js.map +1 -0
- package/dist/lib/core/engine.d.ts +25 -0
- package/dist/lib/core/engine.d.ts.map +1 -0
- package/dist/lib/core/engine.js +1191 -0
- package/dist/lib/core/engine.js.map +1 -0
- package/dist/lib/core/graph.d.ts +18 -0
- package/dist/lib/core/graph.d.ts.map +1 -0
- package/dist/lib/core/graph.js +158 -0
- package/dist/lib/core/graph.js.map +1 -0
- package/dist/lib/core/loader.d.ts +25 -0
- package/dist/lib/core/loader.d.ts.map +1 -0
- package/dist/lib/core/loader.js +248 -0
- package/dist/lib/core/loader.js.map +1 -0
- package/dist/lib/core/resolver.d.ts +20 -0
- package/dist/lib/core/resolver.d.ts.map +1 -0
- package/dist/lib/core/resolver.js +307 -0
- package/dist/lib/core/resolver.js.map +1 -0
- package/dist/lib/deployer.d.ts +39 -0
- package/dist/lib/deployer.d.ts.map +1 -0
- package/dist/lib/deployer.js +533 -0
- package/dist/lib/deployer.js.map +1 -0
- package/dist/lib/events/__tests__/event-system.spec.d.ts +2 -0
- package/dist/lib/events/__tests__/event-system.spec.d.ts.map +1 -0
- package/dist/lib/events/__tests__/event-system.spec.js +256 -0
- package/dist/lib/events/__tests__/event-system.spec.js.map +1 -0
- package/dist/lib/events/cli-adapter.d.ts +13 -0
- package/dist/lib/events/cli-adapter.d.ts.map +1 -0
- package/dist/lib/events/cli-adapter.js +244 -0
- package/dist/lib/events/cli-adapter.js.map +1 -0
- package/dist/lib/events/emitter.d.ts +11 -0
- package/dist/lib/events/emitter.d.ts.map +1 -0
- package/dist/lib/events/emitter.js +29 -0
- package/dist/lib/events/emitter.js.map +1 -0
- package/dist/lib/events/index.d.ts +4 -0
- package/dist/lib/events/index.d.ts.map +1 -0
- package/dist/lib/events/index.js +20 -0
- package/dist/lib/events/index.js.map +1 -0
- package/dist/lib/events/types.d.ts +368 -0
- package/dist/lib/events/types.d.ts.map +1 -0
- package/dist/lib/events/types.js +3 -0
- package/dist/lib/events/types.js.map +1 -0
- package/dist/lib/index.d.ts +5 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +44 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/network-loader.d.ts +3 -0
- package/dist/lib/network-loader.d.ts.map +1 -0
- package/dist/lib/network-loader.js +80 -0
- package/dist/lib/network-loader.js.map +1 -0
- package/dist/lib/network-match.d.ts +3 -0
- package/dist/lib/network-match.d.ts.map +1 -0
- package/dist/lib/network-match.js +62 -0
- package/dist/lib/network-match.js.map +1 -0
- package/dist/lib/network-utils.d.ts +4 -0
- package/dist/lib/network-utils.d.ts.map +1 -0
- package/dist/lib/network-utils.js +39 -0
- package/dist/lib/network-utils.js.map +1 -0
- package/dist/lib/parsers/__tests__/buildinfo.spec.d.ts +2 -0
- package/dist/lib/parsers/__tests__/buildinfo.spec.d.ts.map +1 -0
- package/dist/lib/parsers/__tests__/buildinfo.spec.js +132 -0
- package/dist/lib/parsers/__tests__/buildinfo.spec.js.map +1 -0
- package/dist/lib/parsers/__tests__/job.spec.d.ts +2 -0
- package/dist/lib/parsers/__tests__/job.spec.d.ts.map +1 -0
- package/dist/lib/parsers/__tests__/job.spec.js +318 -0
- package/dist/lib/parsers/__tests__/job.spec.js.map +1 -0
- package/dist/lib/parsers/__tests__/template.spec.d.ts +2 -0
- package/dist/lib/parsers/__tests__/template.spec.d.ts.map +1 -0
- package/dist/lib/parsers/__tests__/template.spec.js +126 -0
- package/dist/lib/parsers/__tests__/template.spec.js.map +1 -0
- package/dist/lib/parsers/artifact/__tests__/artifact.spec.d.ts +2 -0
- package/dist/lib/parsers/artifact/__tests__/artifact.spec.d.ts.map +1 -0
- package/dist/lib/parsers/artifact/__tests__/artifact.spec.js +128 -0
- package/dist/lib/parsers/artifact/__tests__/artifact.spec.js.map +1 -0
- package/dist/lib/parsers/artifact/foundry-1.2.d.ts +3 -0
- package/dist/lib/parsers/artifact/foundry-1.2.d.ts.map +1 -0
- package/dist/lib/parsers/artifact/foundry-1.2.js +82 -0
- package/dist/lib/parsers/artifact/foundry-1.2.js.map +1 -0
- package/dist/lib/parsers/artifact/index.d.ts +3 -0
- package/dist/lib/parsers/artifact/index.d.ts.map +1 -0
- package/dist/lib/parsers/artifact/index.js +17 -0
- package/dist/lib/parsers/artifact/index.js.map +1 -0
- package/dist/lib/parsers/artifact/types.d.ts +3 -0
- package/dist/lib/parsers/artifact/types.d.ts.map +1 -0
- package/dist/lib/parsers/artifact/types.js +3 -0
- package/dist/lib/parsers/artifact/types.js.map +1 -0
- package/dist/lib/parsers/buildinfo.d.ts +5 -0
- package/dist/lib/parsers/buildinfo.d.ts.map +1 -0
- package/dist/lib/parsers/buildinfo.js +85 -0
- package/dist/lib/parsers/buildinfo.js.map +1 -0
- package/dist/lib/parsers/constants.d.ts +4 -0
- package/dist/lib/parsers/constants.d.ts.map +1 -0
- package/dist/lib/parsers/constants.js +45 -0
- package/dist/lib/parsers/constants.js.map +1 -0
- package/dist/lib/parsers/index.d.ts +5 -0
- package/dist/lib/parsers/index.d.ts.map +1 -0
- package/dist/lib/parsers/index.js +21 -0
- package/dist/lib/parsers/index.js.map +1 -0
- package/dist/lib/parsers/job.d.ts +3 -0
- package/dist/lib/parsers/job.d.ts.map +1 -0
- package/dist/lib/parsers/job.js +74 -0
- package/dist/lib/parsers/job.js.map +1 -0
- package/dist/lib/parsers/template.d.ts +3 -0
- package/dist/lib/parsers/template.d.ts.map +1 -0
- package/dist/lib/parsers/template.js +91 -0
- package/dist/lib/parsers/template.js.map +1 -0
- package/dist/lib/std/templates/assured-deployment.yaml +45 -0
- package/dist/lib/std/templates/erc-2470.yaml +67 -0
- package/dist/lib/std/templates/min-balance.yaml +32 -0
- package/dist/lib/std/templates/nano-universal-deployer.yaml +59 -0
- package/dist/lib/std/templates/raw-erc-2470.yaml +59 -0
- package/dist/lib/std/templates/raw-nano-universal-deployer.yaml +51 -0
- package/dist/lib/std/templates/raw-sequence-universal-deployer-2.yaml +48 -0
- package/dist/lib/std/templates/sequence-universal-deployer-2.yaml +57 -0
- package/dist/lib/types/__tests__/json-request-action.spec.d.ts +2 -0
- package/dist/lib/types/__tests__/json-request-action.spec.d.ts.map +1 -0
- package/dist/lib/types/__tests__/json-request-action.spec.js +219 -0
- package/dist/lib/types/__tests__/json-request-action.spec.js.map +1 -0
- package/dist/lib/types/__tests__/read-json-value.spec.d.ts +2 -0
- package/dist/lib/types/__tests__/read-json-value.spec.d.ts.map +1 -0
- package/dist/lib/types/__tests__/read-json-value.spec.js +233 -0
- package/dist/lib/types/__tests__/read-json-value.spec.js.map +1 -0
- package/dist/lib/types/actions.d.ts +74 -0
- package/dist/lib/types/actions.d.ts.map +1 -0
- package/dist/lib/types/actions.js +18 -0
- package/dist/lib/types/actions.js.map +1 -0
- package/dist/lib/types/artifacts.d.ts +15 -0
- package/dist/lib/types/artifacts.d.ts.map +1 -0
- package/dist/lib/types/artifacts.js +3 -0
- package/dist/lib/types/artifacts.js.map +1 -0
- package/dist/lib/types/buildinfo.d.ts +112 -0
- package/dist/lib/types/buildinfo.d.ts.map +1 -0
- package/dist/lib/types/buildinfo.js +3 -0
- package/dist/lib/types/buildinfo.js.map +1 -0
- package/dist/lib/types/conditions.d.ts +17 -0
- package/dist/lib/types/conditions.d.ts.map +1 -0
- package/dist/lib/types/conditions.js +21 -0
- package/dist/lib/types/conditions.js.map +1 -0
- package/dist/lib/types/contracts.d.ts +14 -0
- package/dist/lib/types/contracts.d.ts.map +1 -0
- package/dist/lib/types/contracts.js +3 -0
- package/dist/lib/types/contracts.js.map +1 -0
- package/dist/lib/types/definitions.d.ts +51 -0
- package/dist/lib/types/definitions.d.ts.map +1 -0
- package/dist/lib/types/definitions.js +3 -0
- package/dist/lib/types/definitions.js.map +1 -0
- package/dist/lib/types/index.d.ts +9 -0
- package/dist/lib/types/index.d.ts.map +1 -0
- package/dist/lib/types/index.js +25 -0
- package/dist/lib/types/index.js.map +1 -0
- package/dist/lib/types/network.d.ts +9 -0
- package/dist/lib/types/network.d.ts.map +1 -0
- package/dist/lib/types/network.js +3 -0
- package/dist/lib/types/network.js.map +1 -0
- package/dist/lib/types/project.d.ts +5 -0
- package/dist/lib/types/project.d.ts.map +1 -0
- package/dist/lib/types/project.js +3 -0
- package/dist/lib/types/project.js.map +1 -0
- package/dist/lib/types/task.d.ts +9 -0
- package/dist/lib/types/task.d.ts.map +1 -0
- package/dist/lib/types/task.js +3 -0
- package/dist/lib/types/task.js.map +1 -0
- package/dist/lib/types/values.d.ts +78 -0
- package/dist/lib/types/values.d.ts.map +1 -0
- package/dist/lib/types/values.js +3 -0
- package/dist/lib/types/values.js.map +1 -0
- package/dist/lib/utils/validation.d.ts +5 -0
- package/dist/lib/utils/validation.d.ts.map +1 -0
- package/dist/lib/utils/validation.js +77 -0
- package/dist/lib/utils/validation.js.map +1 -0
- package/dist/lib/validation/contract-references.d.ts +12 -0
- package/dist/lib/validation/contract-references.d.ts.map +1 -0
- package/dist/lib/validation/contract-references.js +112 -0
- package/dist/lib/validation/contract-references.js.map +1 -0
- package/dist/lib/validation/index.d.ts +1 -0
- package/dist/lib/validation/index.d.ts.map +1 -0
- package/dist/lib/validation/index.js +2 -0
- package/dist/lib/validation/index.js.map +1 -0
- package/dist/lib/verification/__tests__/etherscan.spec.d.ts +2 -0
- package/dist/lib/verification/__tests__/etherscan.spec.d.ts.map +1 -0
- package/dist/lib/verification/__tests__/etherscan.spec.js +565 -0
- package/dist/lib/verification/__tests__/etherscan.spec.js.map +1 -0
- package/dist/lib/verification/__tests__/sourcify.spec.d.ts +2 -0
- package/dist/lib/verification/__tests__/sourcify.spec.d.ts.map +1 -0
- package/dist/lib/verification/__tests__/sourcify.spec.js +212 -0
- package/dist/lib/verification/__tests__/sourcify.spec.js.map +1 -0
- package/dist/lib/verification/etherscan.d.ts +56 -0
- package/dist/lib/verification/etherscan.d.ts.map +1 -0
- package/dist/lib/verification/etherscan.js +340 -0
- package/dist/lib/verification/etherscan.js.map +1 -0
- package/dist/lib/verification/sourcify.d.ts +12 -0
- package/dist/lib/verification/sourcify.d.ts.map +1 -0
- package/dist/lib/verification/sourcify.js +227 -0
- package/dist/lib/verification/sourcify.js.map +1 -0
- package/eslint.config.js +48 -0
- package/examples/jobs/guards-v1.yaml +17 -0
- package/examples/jobs/sequence-seq-0001-patch.yaml +59 -0
- package/examples/jobs/sequence-v1.yaml +59 -0
- package/examples/templates/sequence-factory-v1.yaml +56 -0
- package/jest.config.js +25 -0
- package/package.json +68 -0
- package/src/cli.ts +17 -0
- package/src/commands/common.ts +61 -0
- package/src/commands/dry.ts +208 -0
- package/src/commands/etherscan.ts +360 -0
- package/src/commands/index.ts +5 -0
- package/src/commands/list.ts +249 -0
- package/src/commands/run.ts +136 -0
- package/src/commands/utils.ts +52 -0
- package/src/index.ts +67 -0
- package/src/lib/__tests__/deployer-events.spec.ts +338 -0
- package/src/lib/__tests__/deployer.spec.ts +1204 -0
- package/src/lib/__tests__/network-utils.spec.ts +181 -0
- package/src/lib/artifacts/__tests__/fixtures/contract1.json +19 -0
- package/src/lib/artifacts/__tests__/fixtures/contract2.json +19 -0
- package/src/lib/artifacts/__tests__/fixtures/duplicate-name.json +19 -0
- package/src/lib/artifacts/__tests__/fixtures/nested/nested-contract.json +18 -0
- package/src/lib/artifacts/__tests__/fixtures/not-an-artifact.json +8 -0
- package/src/lib/artifacts/__tests__/fixtures/readme.txt +2 -0
- package/src/lib/contracts/__tests__/repository.spec.ts +344 -0
- package/src/lib/contracts/repository.ts +313 -0
- package/src/lib/core/__tests__/engine.spec.ts +1514 -0
- package/src/lib/core/__tests__/graph.spec.ts +125 -0
- package/src/lib/core/__tests__/json-integration.spec.ts +360 -0
- package/src/lib/core/__tests__/loader.spec.ts +334 -0
- package/src/lib/core/__tests__/multi-platform-verification.spec.ts +406 -0
- package/src/lib/core/__tests__/resolver.spec.ts +1693 -0
- package/src/lib/core/__tests__/static-action.spec.ts +172 -0
- package/src/lib/core/context.ts +127 -0
- package/src/lib/core/engine.ts +1531 -0
- package/src/lib/core/graph.ts +252 -0
- package/src/lib/core/loader.ts +263 -0
- package/src/lib/core/resolver.ts +498 -0
- package/src/lib/deployer.ts +768 -0
- package/src/lib/events/__tests__/event-system.spec.ts +343 -0
- package/src/lib/events/cli-adapter.ts +325 -0
- package/src/lib/events/emitter.ts +62 -0
- package/src/lib/events/index.ts +3 -0
- package/src/lib/events/types.ts +469 -0
- package/src/lib/index.ts +14 -0
- package/src/lib/network-loader.ts +59 -0
- package/src/lib/network-utils.ts +64 -0
- package/src/lib/parsers/__tests__/buildinfo.spec.ts +122 -0
- package/src/lib/parsers/__tests__/fixtures/buildinfo/invalid-bytecode-buildinfo.json +62 -0
- package/src/lib/parsers/__tests__/fixtures/buildinfo/invalid-json.txt +2 -0
- package/src/lib/parsers/__tests__/fixtures/buildinfo/multi-contract-buildinfo.json +89 -0
- package/src/lib/parsers/__tests__/fixtures/buildinfo/no-contracts-buildinfo.json +17 -0
- package/src/lib/parsers/__tests__/fixtures/buildinfo/simple-buildinfo.json +63 -0
- package/src/lib/parsers/__tests__/fixtures/buildinfo/wrong-format.json +4 -0
- package/src/lib/parsers/__tests__/job.spec.ts +335 -0
- package/src/lib/parsers/__tests__/template.spec.ts +111 -0
- package/src/lib/parsers/artifact/__tests__/artifact.spec.ts +117 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/empty-bytecode.json +5 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/hardhat-artifact.json +67 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/invalid-bytecode.json +5 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/invalid-json.txt +11 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/minimal-artifact.json +5 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/missing-abi.json +4 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/missing-bytecode.json +11 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/missing-contract-name.json +11 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/simple-artifact.json +40 -0
- package/src/lib/parsers/artifact/__tests__/fixtures/wrong-types.json +7 -0
- package/src/lib/parsers/artifact/foundry-1.2.ts +72 -0
- package/src/lib/parsers/artifact/index.ts +27 -0
- package/src/lib/parsers/artifact/types.ts +9 -0
- package/src/lib/parsers/buildinfo.ts +127 -0
- package/src/lib/parsers/constants.ts +56 -0
- package/src/lib/parsers/index.ts +5 -0
- package/src/lib/parsers/job.ts +101 -0
- package/src/lib/parsers/template.ts +131 -0
- package/src/lib/std/templates/assured-deployment.yaml +45 -0
- package/src/lib/std/templates/erc-2470.yaml +67 -0
- package/src/lib/std/templates/min-balance.yaml +32 -0
- package/src/lib/std/templates/nano-universal-deployer.yaml +59 -0
- package/src/lib/std/templates/raw-erc-2470.yaml +59 -0
- package/src/lib/std/templates/raw-nano-universal-deployer.yaml +51 -0
- package/src/lib/std/templates/raw-sequence-universal-deployer-2.yaml +48 -0
- package/src/lib/std/templates/sequence-universal-deployer-2.yaml +57 -0
- package/src/lib/types/__tests__/json-request-action.spec.ts +243 -0
- package/src/lib/types/__tests__/read-json-value.spec.ts +264 -0
- package/src/lib/types/actions.ts +127 -0
- package/src/lib/types/artifacts.ts +21 -0
- package/src/lib/types/buildinfo.ts +116 -0
- package/src/lib/types/conditions.ts +50 -0
- package/src/lib/types/contracts.ts +23 -0
- package/src/lib/types/definitions.ts +68 -0
- package/src/lib/types/index.ts +8 -0
- package/src/lib/types/network.ts +22 -0
- package/src/lib/types/project.ts +9 -0
- package/src/lib/types/task.ts +9 -0
- package/src/lib/types/values.ts +116 -0
- package/src/lib/utils/validation.ts +116 -0
- package/src/lib/validation/contract-references.ts +210 -0
- package/src/lib/validation/index.ts +1 -0
- package/src/lib/verification/__tests__/etherscan.spec.ts +710 -0
- package/src/lib/verification/__tests__/sourcify.spec.ts +288 -0
- package/src/lib/verification/etherscan.ts +546 -0
- package/src/lib/verification/sourcify.ts +248 -0
- package/test_validation/artifacts/TestContract.json +9 -0
- package/test_validation/jobs/test-missing.yaml +16 -0
- package/test_validation/networks.yaml +3 -0
- package/tsconfig.json +36 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as fs from 'fs'
|
|
2
|
+
import * as path from 'path'
|
|
3
|
+
import { parseBuildInfo, isBuildInfoFile, extractedContractToArtifact } from '../buildinfo'
|
|
4
|
+
|
|
5
|
+
describe('Build-Info Parsing', () => {
|
|
6
|
+
const fixturesDir = path.join(__dirname, 'fixtures/buildinfo')
|
|
7
|
+
|
|
8
|
+
// Helper function to read fixture files
|
|
9
|
+
const readFixture = (filename: string): string => {
|
|
10
|
+
return fs.readFileSync(path.join(fixturesDir, filename), 'utf-8')
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
describe('isBuildInfoFile function', () => {
|
|
14
|
+
it('should identify build-info files correctly', () => {
|
|
15
|
+
expect(isBuildInfoFile('artifacts/build-info/abc123.json')).toBe(true)
|
|
16
|
+
expect(isBuildInfoFile('out/build-info/def456.json')).toBe(true)
|
|
17
|
+
expect(isBuildInfoFile('/path/to/artifacts/build-info/xyz789.json')).toBe(true)
|
|
18
|
+
|
|
19
|
+
expect(isBuildInfoFile('artifacts/Contract.json')).toBe(false)
|
|
20
|
+
expect(isBuildInfoFile('src/Contract.sol')).toBe(false)
|
|
21
|
+
expect(isBuildInfoFile('build-info.json')).toBe(false)
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
describe('parseBuildInfo function', () => {
|
|
26
|
+
it('should parse a simple build-info file with one contract', () => {
|
|
27
|
+
const content = readFixture('simple-buildinfo.json')
|
|
28
|
+
const result = parseBuildInfo(content, '/test/simple-buildinfo.json')
|
|
29
|
+
|
|
30
|
+
expect(result).not.toBeNull()
|
|
31
|
+
expect(result).toHaveLength(1)
|
|
32
|
+
|
|
33
|
+
const contract = result![0]
|
|
34
|
+
expect(contract.contractName).toBe('Counter')
|
|
35
|
+
expect(contract.sourceName).toBe('src/Counter.sol')
|
|
36
|
+
expect(contract.fullyQualifiedName).toBe('src/Counter.sol:Counter')
|
|
37
|
+
expect(contract.abi).toBeInstanceOf(Array)
|
|
38
|
+
expect(contract.abi.length).toBe(2)
|
|
39
|
+
expect(contract.bytecode).toMatch(/^0x[0-9a-fA-F]+$/)
|
|
40
|
+
expect(contract.deployedBytecode).toMatch(/^0x[0-9a-fA-F]+$/)
|
|
41
|
+
expect(contract.compiler.version).toBe('0.8.30+commit.8fe82020')
|
|
42
|
+
expect(contract.buildInfoId).toBe('901568e56d422b1e1e3f64004cb4dd6e')
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it('should parse a build-info file with multiple contracts', () => {
|
|
46
|
+
const content = readFixture('multi-contract-buildinfo.json')
|
|
47
|
+
const result = parseBuildInfo(content, '/test/multi-contract-buildinfo.json')
|
|
48
|
+
|
|
49
|
+
expect(result).not.toBeNull()
|
|
50
|
+
expect(result).toHaveLength(2)
|
|
51
|
+
|
|
52
|
+
const contracts = result!
|
|
53
|
+
expect(contracts.map(c => c.contractName)).toEqual(['Token', 'TokenFactory'])
|
|
54
|
+
expect(contracts.map(c => c.sourceName)).toEqual(['src/Token.sol', 'src/TokenFactory.sol'])
|
|
55
|
+
expect(contracts.map(c => c.fullyQualifiedName)).toEqual([
|
|
56
|
+
'src/Token.sol:Token',
|
|
57
|
+
'src/TokenFactory.sol:TokenFactory'
|
|
58
|
+
])
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
it('should return null for invalid JSON', () => {
|
|
62
|
+
const content = readFixture('invalid-json.txt')
|
|
63
|
+
const result = parseBuildInfo(content, '/test/invalid-json.txt')
|
|
64
|
+
|
|
65
|
+
expect(result).toBeNull()
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
it('should return null for JSON with wrong format', () => {
|
|
69
|
+
const content = readFixture('wrong-format.json')
|
|
70
|
+
const result = parseBuildInfo(content, '/test/wrong-format.json')
|
|
71
|
+
|
|
72
|
+
expect(result).toBeNull()
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it('should return null for build-info with no contracts', () => {
|
|
76
|
+
const content = readFixture('no-contracts-buildinfo.json')
|
|
77
|
+
const result = parseBuildInfo(content, '/test/no-contracts-buildinfo.json')
|
|
78
|
+
|
|
79
|
+
expect(result).toBeNull()
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('should skip contracts with invalid bytecode', () => {
|
|
83
|
+
const content = readFixture('invalid-bytecode-buildinfo.json')
|
|
84
|
+
const result = parseBuildInfo(content, '/test/invalid-bytecode-buildinfo.json')
|
|
85
|
+
|
|
86
|
+
expect(result).not.toBeNull()
|
|
87
|
+
expect(result).toHaveLength(1) // Only one valid contract should be extracted
|
|
88
|
+
expect(result![0].contractName).toBe('ValidContract')
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
it('should include source content when available', () => {
|
|
92
|
+
const content = readFixture('simple-buildinfo.json')
|
|
93
|
+
const result = parseBuildInfo(content, '/test/simple-buildinfo.json')
|
|
94
|
+
|
|
95
|
+
expect(result).not.toBeNull()
|
|
96
|
+
expect(result![0].source).toContain('contract Counter')
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
describe('extractedContractToArtifact function', () => {
|
|
101
|
+
it('should convert ExtractedContract to Artifact format', () => {
|
|
102
|
+
const content = readFixture('simple-buildinfo.json')
|
|
103
|
+
const contracts = parseBuildInfo(content, '/test/simple-buildinfo.json')
|
|
104
|
+
|
|
105
|
+
expect(contracts).not.toBeNull()
|
|
106
|
+
const extracted = contracts![0]
|
|
107
|
+
const artifact = extractedContractToArtifact(extracted)
|
|
108
|
+
|
|
109
|
+
expect(artifact.contractName).toBe(extracted.contractName)
|
|
110
|
+
expect(artifact.abi).toBe(extracted.abi)
|
|
111
|
+
expect(artifact.bytecode).toBe(extracted.bytecode)
|
|
112
|
+
expect(artifact.deployedBytecode).toBe(extracted.deployedBytecode)
|
|
113
|
+
expect(artifact.sourceName).toBe(extracted.sourceName)
|
|
114
|
+
expect(artifact.source).toBe(extracted.source)
|
|
115
|
+
expect(artifact.compiler).toBe(extracted.compiler)
|
|
116
|
+
|
|
117
|
+
// Should not have build-info specific fields
|
|
118
|
+
expect(artifact).not.toHaveProperty('buildInfoId')
|
|
119
|
+
expect(artifact).not.toHaveProperty('fullyQualifiedName')
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
})
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_format": "hh-sol-build-info-1",
|
|
3
|
+
"id": "invalid123456789012345678901234567890abcd",
|
|
4
|
+
"solcVersion": "0.8.30",
|
|
5
|
+
"solcLongVersion": "0.8.30+commit.8fe82020",
|
|
6
|
+
"input": {
|
|
7
|
+
"language": "Solidity",
|
|
8
|
+
"sources": {
|
|
9
|
+
"src/ValidContract.sol": {
|
|
10
|
+
"content": "pragma solidity 0.8.30; contract ValidContract {}"
|
|
11
|
+
},
|
|
12
|
+
"src/InvalidContract.sol": {
|
|
13
|
+
"content": "pragma solidity 0.8.30; contract InvalidContract {}"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"settings": {
|
|
17
|
+
"outputSelection": {
|
|
18
|
+
"*": {
|
|
19
|
+
"*": ["abi", "evm.bytecode", "evm.deployedBytecode"]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"output": {
|
|
25
|
+
"contracts": {
|
|
26
|
+
"src/ValidContract.sol": {
|
|
27
|
+
"ValidContract": {
|
|
28
|
+
"abi": [],
|
|
29
|
+
"evm": {
|
|
30
|
+
"bytecode": {
|
|
31
|
+
"object": "0x608060405234801561001057600080fd5b50005b"
|
|
32
|
+
},
|
|
33
|
+
"deployedBytecode": {
|
|
34
|
+
"object": "0x608060405234801561001057600080fd5b50005b"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"src/InvalidContract.sol": {
|
|
40
|
+
"InvalidContract": {
|
|
41
|
+
"abi": [],
|
|
42
|
+
"evm": {
|
|
43
|
+
"bytecode": {
|
|
44
|
+
"object": "invalid_bytecode_without_0x_prefix"
|
|
45
|
+
},
|
|
46
|
+
"deployedBytecode": {
|
|
47
|
+
"object": "0x608060405234801561001057600080fd5b50005b"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"sources": {
|
|
54
|
+
"src/ValidContract.sol": {
|
|
55
|
+
"id": 0
|
|
56
|
+
},
|
|
57
|
+
"src/InvalidContract.sol": {
|
|
58
|
+
"id": 1
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_format": "hh-sol-build-info-1",
|
|
3
|
+
"id": "abc123def456789012345678901234567890abcd",
|
|
4
|
+
"solcVersion": "0.8.30",
|
|
5
|
+
"solcLongVersion": "0.8.30+commit.8fe82020",
|
|
6
|
+
"input": {
|
|
7
|
+
"language": "Solidity",
|
|
8
|
+
"sources": {
|
|
9
|
+
"src/Token.sol": {
|
|
10
|
+
"content": "pragma solidity 0.8.30;\n\ncontract Token {\n string public name = \"TestToken\";\n uint256 public totalSupply = 1000;\n}"
|
|
11
|
+
},
|
|
12
|
+
"src/TokenFactory.sol": {
|
|
13
|
+
"content": "pragma solidity 0.8.30;\n\ncontract TokenFactory {\n function createToken() external returns (address) {\n // Factory logic here\n return address(0);\n }\n}"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"settings": {
|
|
17
|
+
"optimizer": {
|
|
18
|
+
"enabled": true,
|
|
19
|
+
"runs": 200
|
|
20
|
+
},
|
|
21
|
+
"outputSelection": {
|
|
22
|
+
"*": {
|
|
23
|
+
"*": ["abi", "evm.bytecode", "evm.deployedBytecode"]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"output": {
|
|
29
|
+
"contracts": {
|
|
30
|
+
"src/Token.sol": {
|
|
31
|
+
"Token": {
|
|
32
|
+
"abi": [
|
|
33
|
+
{
|
|
34
|
+
"type": "function",
|
|
35
|
+
"name": "name",
|
|
36
|
+
"inputs": [],
|
|
37
|
+
"outputs": [{"name": "", "type": "string", "internalType": "string"}],
|
|
38
|
+
"stateMutability": "view"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"type": "function",
|
|
42
|
+
"name": "totalSupply",
|
|
43
|
+
"inputs": [],
|
|
44
|
+
"outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}],
|
|
45
|
+
"stateMutability": "view"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"evm": {
|
|
49
|
+
"bytecode": {
|
|
50
|
+
"object": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806306fdde031461003b57806318160ddd14610059575b600080fd5b610043610077565b6040516100509190610100565b60405180910390f35b610061610115565b60405161006e9190610122565b60405180910390f35b60606040518060400160405280600981526020017f546573745f546f6b656e0000000000000000000000000000000000000000000081525090565b60006103e890505b90565b600081519050919050565b600082825260208201905092915050565b60005b8381101561015957808201518184015260208101905061013e565b83811115610168576000848401525b50505050565b6000601f19601f8301169050919050565b6000610186826101225b61019081610174565b9050919050565b60006020820190508181036000830152610197816101a0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806101d957607f821691505b602082108114156101ed576101ec6101a2565b5b5091905056fea2646970667358221220d4c6f7e4b8f9a5d8c2b1a0e9f8d7c6b5a4938271605948372819465730384756464736f6c634300081e0033"
|
|
51
|
+
},
|
|
52
|
+
"deployedBytecode": {
|
|
53
|
+
"object": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806306fdde031461003b57806318160ddd14610059575b600080fd5b610043610077565b6040516100509190610100565b60405180910390f35b610061610115565b60405161006e9190610122565b60405180910390f35b60606040518060400160405280600981526020017f546573745f546f6b656e0000000000000000000000000000000000000000000081525090565b60006103e890505b90565b600081519050919050565b600082825260208201905092915050565b60005b8381101561015957808201518184015260208101905061013e565b83811115610168576000848401525b50505050565b6000601f19601f8301169050919050565b6000610186826101225b61019081610174565b9050919050565b60006020820190508181036000830152610197816101a0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806101d957607f821691505b602082108114156101ed576101ec6101a2565b5b5091905056fea2646970667358221220e5d7f6e4b8f9a5d8c2b1a0e9f8d7c6b5a4938271605948372819465730384756464736f6c634300081e0033"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"src/TokenFactory.sol": {
|
|
59
|
+
"TokenFactory": {
|
|
60
|
+
"abi": [
|
|
61
|
+
{
|
|
62
|
+
"type": "function",
|
|
63
|
+
"name": "createToken",
|
|
64
|
+
"inputs": [],
|
|
65
|
+
"outputs": [{"name": "", "type": "address", "internalType": "address"}],
|
|
66
|
+
"stateMutability": "nonpayable"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"evm": {
|
|
70
|
+
"bytecode": {
|
|
71
|
+
"object": "0x608060405234801561001057600080fd5b50600436106100295760003560e01c8063c63a5b6d1461002e575b600080fd5b61003661004c565b60405161004391906100a1565b60405180910390f35b60006000905090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061007f82610054565b9050919050565b61008f81610074565b82525050565b60006020820190506100aa6000830184610086565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806100f857607f821691505b6020821081141561010c5761010b6100b1565b5b5091905056fea2646970667358221220e5d7f6e4b8f9a5d8c2b1a0e9f8d7c6b5a4938271605948372819465730384756464736f6c634300081e0033"
|
|
72
|
+
},
|
|
73
|
+
"deployedBytecode": {
|
|
74
|
+
"object": "0x608060405234801561001057600080fd5b50600436106100295760003560e01c8063c63a5b6d1461002e575b600080fd5b61003661004c565b60405161004391906100a1565b60405180910390f35b60006000905090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061007f82610054565b9050919050565b61008f81610074565b82525050565b60006020820190506100aa6000830184610086565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806100f857607f821691505b6020821081141561010c5761010b6100b1565b5b5091905056fea2646970667358221220e5d7f6e4b8f9a5d8c2b1a0e9f8d7c6b5a4938271605948372819465730384756464736f6c634300081e0033"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"sources": {
|
|
81
|
+
"src/Token.sol": {
|
|
82
|
+
"id": 0
|
|
83
|
+
},
|
|
84
|
+
"src/TokenFactory.sol": {
|
|
85
|
+
"id": 1
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_format": "hh-sol-build-info-1",
|
|
3
|
+
"id": "000000000000000000000000000000000000000000000000000000000000000",
|
|
4
|
+
"solcVersion": "0.8.30",
|
|
5
|
+
"solcLongVersion": "0.8.30+commit.8fe82020",
|
|
6
|
+
"input": {
|
|
7
|
+
"language": "Solidity",
|
|
8
|
+
"sources": {},
|
|
9
|
+
"settings": {
|
|
10
|
+
"outputSelection": {}
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"output": {
|
|
14
|
+
"contracts": {},
|
|
15
|
+
"sources": {}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_format": "hh-sol-build-info-1",
|
|
3
|
+
"id": "901568e56d422b1e1e3f64004cb4dd6e",
|
|
4
|
+
"solcVersion": "0.8.30",
|
|
5
|
+
"solcLongVersion": "0.8.30+commit.8fe82020",
|
|
6
|
+
"input": {
|
|
7
|
+
"language": "Solidity",
|
|
8
|
+
"sources": {
|
|
9
|
+
"src/Counter.sol": {
|
|
10
|
+
"content": "pragma solidity 0.8.30;\n\ncontract Counter {\n uint256 public count;\n \n function increment() external {\n count++;\n }\n \n function getCount() external view returns (uint256) {\n return count;\n }\n}"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"settings": {
|
|
14
|
+
"optimizer": {
|
|
15
|
+
"enabled": true,
|
|
16
|
+
"runs": 200
|
|
17
|
+
},
|
|
18
|
+
"outputSelection": {
|
|
19
|
+
"*": {
|
|
20
|
+
"*": ["abi", "evm.bytecode", "evm.deployedBytecode"]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"output": {
|
|
26
|
+
"contracts": {
|
|
27
|
+
"src/Counter.sol": {
|
|
28
|
+
"Counter": {
|
|
29
|
+
"abi": [
|
|
30
|
+
{
|
|
31
|
+
"type": "function",
|
|
32
|
+
"name": "increment",
|
|
33
|
+
"inputs": [],
|
|
34
|
+
"outputs": [],
|
|
35
|
+
"stateMutability": "nonpayable"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"type": "function",
|
|
39
|
+
"name": "getCount",
|
|
40
|
+
"inputs": [],
|
|
41
|
+
"outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}],
|
|
42
|
+
"stateMutability": "view"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"evm": {
|
|
46
|
+
"bytecode": {
|
|
47
|
+
"object": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063a87d942c1461003b578063d09de08a14610059575b600080fd5b610043610063565b6040516100509190610084565b60405180910390f35b610061610069565b005b60005481565b600160008082825461007b919061009f565b92505081905550565b60005b8381101561009e5780820151818401526020810190506100835b50505050565b60008201905061009c565b60008219050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600081905091905056fea2646970667358221220c4d6f7e4b8f9a5d8c2b1a0e9f8d7c6b5a4938271605948372819465730384756464736f6c634300081e0033",
|
|
48
|
+
"sourceMap": "25:194:0:-:0;;;67:1;44:24;;25:194;;;;;;"
|
|
49
|
+
},
|
|
50
|
+
"deployedBytecode": {
|
|
51
|
+
"object": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063a87d942c1461003b578063d09de08a14610059575b600080fd5b610043610063565b6040516100509190610084565b60405180910390f35b610061610069565b005b60005481565b600160008082825461007b919061009f565b92505081905550565b60005b8381101561009e5780820151818401526020810190506100835b50505050565b60008201905061009c565b60008219050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600081905091905056fea2646970667358221220c4d6f7e4b8f9a5d8c2b1a0e9f8d7c6b5a4938271605948372819465730384756464736f6c634300081e0033"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"sources": {
|
|
58
|
+
"src/Counter.sol": {
|
|
59
|
+
"id": 0
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|