├── .nvmrc ├── services ├── 4byte │ ├── .prettierignore │ ├── .mocharc.json │ ├── .env.test │ ├── test │ │ ├── load-env.js │ │ └── docker-compose.yml │ ├── .env.example │ ├── src │ │ └── utils │ │ │ ├── database-util.ts │ │ │ └── signature-util.ts │ ├── tsconfig.json │ └── CHANGELOG.md ├── monitor │ ├── .prettierignore │ ├── .dockerignore │ ├── .mocharc.json │ ├── hardhat.config.js │ ├── tsconfig.json │ ├── chains-dev.json │ ├── .env.template │ ├── test │ │ ├── sources │ │ │ └── Storage │ │ │ │ └── 1_Storage.sol │ │ └── testLogger.ts │ └── src │ │ └── defaultConfig.js ├── server │ ├── .prettierignore │ ├── test │ │ ├── testcontracts │ │ │ ├── 1_Storage │ │ │ │ ├── address │ │ │ │ └── 1_Storage.sol │ │ │ ├── LibrariesSolidity075 │ │ │ │ └── Example.sol │ │ │ ├── Create2 │ │ │ │ └── Wallet.sol │ │ │ ├── WithImmutables │ │ │ │ └── sources │ │ │ │ │ └── WithImmutables.sol │ │ │ ├── Storage │ │ │ │ ├── Storage.sol │ │ │ │ └── StorageModified.sol │ │ │ ├── LibrariesLinkedManually │ │ │ │ └── 1_Storage.sol │ │ │ ├── FactoryImmutable │ │ │ │ └── FactoryTest.sol │ │ │ ├── ensure-metadata-storage │ │ │ │ └── EIP1967Admin.sol │ │ │ ├── FactoryImmutableWithMsgSender │ │ │ │ └── FactoryTest.sol │ │ │ ├── path-sanitization │ │ │ │ └── sources │ │ │ │ │ ├── IERC20Metadata.sol │ │ │ │ │ └── Context.sol │ │ │ └── FactoryImmutableWithoutConstrArg │ │ │ │ └── FactoryTest3.sol │ │ ├── sources │ │ │ ├── truffle │ │ │ │ └── truffle-example.zip │ │ │ ├── contracts │ │ │ │ ├── ParentContract.sol │ │ │ │ ├── ChildContract.sol │ │ │ │ ├── Simple.sol │ │ │ │ ├── Import.sol │ │ │ │ ├── Library.sol │ │ │ │ └── SimpleWithImport.sol │ │ │ ├── compiler.json │ │ │ ├── vyper │ │ │ │ ├── testcontract │ │ │ │ │ ├── test.vy │ │ │ │ │ └── artifact.json │ │ │ │ ├── testcontract2 │ │ │ │ │ ├── test.vy │ │ │ │ │ └── artifact.json │ │ │ │ └── testcontract3_fail │ │ │ │ │ ├── test.vy │ │ │ │ │ └── artifact.json │ │ │ └── all │ │ │ │ ├── Simple.sol │ │ │ │ ├── Import.sol │ │ │ │ └── SimpleWithImport.sol │ │ ├── chains │ │ │ └── sources │ │ │ │ ├── 1 │ │ │ │ └── airdrop.sol │ │ │ │ ├── 8 │ │ │ │ └── GameItem.sol │ │ │ │ ├── 25 │ │ │ │ └── storage.sol │ │ │ │ ├── 57 │ │ │ │ └── sources │ │ │ │ │ ├── project │ │ │ │ │ └── contracts │ │ │ │ │ │ └── Token.sol │ │ │ │ │ └── @openzeppelin │ │ │ │ │ └── contracts │ │ │ │ │ ├── token │ │ │ │ │ └── ERC20 │ │ │ │ │ │ └── extensions │ │ │ │ │ │ └── IERC20Metadata.sol │ │ │ │ │ └── utils │ │ │ │ │ └── Context.sol │ │ │ │ ├── 82 │ │ │ │ ├── Storage.sol │ │ │ │ └── Storage_meta.json │ │ │ │ ├── 100 │ │ │ │ ├── test.sol │ │ │ │ └── metadata.json │ │ │ │ ├── 106 │ │ │ │ └── ConvertLib.sol │ │ │ │ ├── 252 │ │ │ │ └── Storage.sol │ │ │ │ ├── 288 │ │ │ │ └── Storage.sol │ │ │ │ ├── 5700 │ │ │ │ └── Token.sol │ │ │ │ ├── 6119 │ │ │ │ └── sources │ │ │ │ │ ├── @openzeppelin │ │ │ │ │ └── contracts │ │ │ │ │ │ ├── interfaces │ │ │ │ │ │ ├── IERC721.sol │ │ │ │ │ │ ├── IERC165.sol │ │ │ │ │ │ └── IERC4906.sol │ │ │ │ │ │ ├── token │ │ │ │ │ │ └── ERC721 │ │ │ │ │ │ │ ├── extensions │ │ │ │ │ │ │ └── IERC721Metadata.sol │ │ │ │ │ │ │ └── IERC721Receiver.sol │ │ │ │ │ │ └── utils │ │ │ │ │ │ ├── Context.sol │ │ │ │ │ │ └── introspection │ │ │ │ │ │ └── IERC165.sol │ │ │ │ │ └── contracts │ │ │ │ │ ├── ERC4906.sol │ │ │ │ │ └── IUPTNAddressValidator.sol │ │ │ │ ├── 42161 │ │ │ │ ├── metadata.json │ │ │ │ └── BalanceFetcher.sol │ │ │ │ ├── 4216137055 │ │ │ │ └── SigmaToken.sol │ │ │ │ ├── incrementer │ │ │ │ └── Incrementer.sol │ │ │ │ └── shared │ │ │ │ └── 1_Storage.sol │ │ ├── load-env.js │ │ ├── docker-compose.yml │ │ ├── integration │ │ │ └── apiv2 │ │ │ │ ├── verification │ │ │ │ └── compiler-versions │ │ │ │ │ └── Storage.sol │ │ │ │ └── v2.common.spec.ts │ │ ├── mocks │ │ │ └── ipfs │ │ │ │ └── QmaFRC9ZtT7y3t9XNWCbDuMTEwKkyaQJzYFzw3NbeohSn5 │ │ ├── global-mocks.ts │ │ └── unit │ │ │ └── utils │ │ │ └── parsing-util.spec.ts │ ├── src │ │ ├── common │ │ │ ├── async-context.ts │ │ │ ├── errors │ │ │ │ ├── index.ts │ │ │ │ ├── BadGatewayError.ts │ │ │ │ ├── BadRequestError.ts │ │ │ │ ├── NotFoundError.ts │ │ │ │ ├── TooManyRequests.ts │ │ │ │ ├── PayloadTooLargeError.ts │ │ │ │ ├── InternalServerError.ts │ │ │ │ ├── ConflictError.ts │ │ │ │ └── ContractIsAlreadyBeingVerifiedError.ts │ │ │ └── interfaces.ts │ │ ├── server │ │ │ ├── apiv2 │ │ │ │ ├── jobs │ │ │ │ │ └── jobs.routes.ts │ │ │ │ ├── lookup │ │ │ │ │ └── lookup.routes.ts │ │ │ │ └── routes.ts │ │ │ ├── apiv1 │ │ │ │ ├── verification │ │ │ │ │ ├── private │ │ │ │ │ │ └── private.routes.ts │ │ │ │ │ ├── vyper │ │ │ │ │ │ ├── vyper.routes.ts │ │ │ │ │ │ └── stateless │ │ │ │ │ │ │ └── vyper.stateless.routes.ts │ │ │ │ │ ├── solc-json │ │ │ │ │ │ ├── session │ │ │ │ │ │ │ └── solc-json.session.routes.ts │ │ │ │ │ │ ├── solc-json.routes.ts │ │ │ │ │ │ └── stateless │ │ │ │ │ │ │ └── solc-json.stateless.routes.ts │ │ │ │ │ ├── etherscan │ │ │ │ │ │ ├── session │ │ │ │ │ │ │ └── etherscan.session.routes.ts │ │ │ │ │ │ ├── stateless │ │ │ │ │ │ │ └── etherscan.stateless.routes.ts │ │ │ │ │ │ └── etherscan.routes.ts │ │ │ │ │ ├── verify │ │ │ │ │ │ ├── verify.routes.ts │ │ │ │ │ │ ├── stateless │ │ │ │ │ │ │ └── verify.stateless.routes.ts │ │ │ │ │ │ └── session │ │ │ │ │ │ │ └── verify.session.routes.ts │ │ │ │ │ └── session-state │ │ │ │ │ │ ├── clear.session-state.paths.yaml │ │ │ │ │ │ └── session-state.routes.ts │ │ │ │ └── testartifacts │ │ │ │ │ └── testartifacts.routes.ts │ │ │ ├── services │ │ │ │ ├── workers │ │ │ │ │ └── workerWrapper.js │ │ │ │ ├── storageServices │ │ │ │ │ └── identifiers.ts │ │ │ │ ├── compiler │ │ │ │ │ └── local │ │ │ │ │ │ ├── VyperLocal.ts │ │ │ │ │ │ └── SolcLocal.ts │ │ │ │ └── services.ts │ │ │ └── session.ts │ │ ├── sourcify-chains-example.json │ │ ├── config │ │ │ ├── config-init.js │ │ │ ├── local-test.js │ │ │ └── migration.js │ │ └── extra-chains.json │ ├── tsconfig.lint.json │ ├── .mocharc.json │ ├── hardhat.config.js │ ├── .env.docker │ ├── tsconfig.json │ ├── .env.test │ └── Dockerfile.debug └── database │ ├── .gitignore │ ├── migrations │ ├── 20251009141621_add_external_verification.sql │ ├── 20251101120000_add_code_first_75_index.sql │ └── 20250922140427_optimize_signature_search.sql │ ├── dune │ └── index.ts │ ├── tsconfig.json │ ├── docker-compose.yml │ └── .env.template ├── .prettierrc ├── packages ├── compilers-types │ ├── .gitignore │ ├── src │ │ └── index.ts │ ├── tsconfig.module.json │ ├── CHANGELOG.md │ └── LICENSE ├── compilers │ ├── .gitignore │ ├── .mocharc.json │ ├── tsconfig.module.json │ ├── src │ │ ├── index.ts │ │ └── lib │ │ │ └── compilerWorker.ts │ ├── LICENSE │ └── README.md ├── bytecode-utils │ ├── src │ │ └── index.ts │ ├── .gitignore │ ├── .mocharc.json │ ├── tsconfig.module.json │ ├── test │ │ └── bytecodes │ │ │ ├── vyper-no-integrity.hex │ │ │ ├── vyper-cbor-no-array.hex │ │ │ ├── vyper-no-auxdata-length.hex │ │ │ ├── vyper-integrity.hex │ │ │ ├── without0x.hex │ │ │ └── experimental.hex │ └── LICENSE └── lib-sourcify │ ├── .gitignore │ ├── test │ ├── validationFiles │ │ └── files │ │ │ ├── truffle-example │ │ │ ├── .gitattributes │ │ │ ├── migrations │ │ │ │ ├── 1_initial_migration.js │ │ │ │ └── 2_deploy_contracts.js │ │ │ ├── contracts │ │ │ │ ├── ConvertLib.sol │ │ │ │ └── Migrations.sol │ │ │ ├── truffle-config.js │ │ │ └── test │ │ │ │ └── TestMetaCoin.sol │ │ │ ├── truffle-example-missing-source │ │ │ ├── .gitattributes │ │ │ ├── migrations │ │ │ │ ├── 1_initial_migration.js │ │ │ │ └── 2_deploy_contracts.js │ │ │ ├── contracts │ │ │ │ ├── ConvertLib.sol │ │ │ │ └── Migrations.sol │ │ │ ├── truffle-config.js │ │ │ └── test │ │ │ │ └── TestMetaCoin.sol │ │ │ ├── truffle-example.zip │ │ │ ├── truffle-example-with-macosx.zip │ │ │ ├── truffle-example-missing-source.zip │ │ │ ├── truffle-example-missing-source2.zip │ │ │ ├── single │ │ │ └── 1_Storage.sol │ │ │ ├── single-add-trailing-n │ │ │ └── 1_Storage.sol │ │ │ ├── single-replace-with-rn │ │ │ └── 1_Storage.sol │ │ │ ├── single-keep-original │ │ │ ├── 1_Storage.sol │ │ │ └── metadata.json │ │ │ ├── single-remove-trailing-n │ │ │ └── 1_Storage.sol │ │ │ ├── single-add-trailing-rn │ │ │ └── 1_Storage.sol │ │ │ ├── single-replace-with-n │ │ │ └── 1_Storage.sol │ │ │ ├── single-remove-trailing-rn │ │ │ └── 1_Storage.sol │ │ │ ├── single-altered │ │ │ ├── 1_Storage.sol │ │ │ └── metadata.json │ │ │ ├── single-altered-metadata │ │ │ ├── 1_Storage.sol │ │ │ └── metadata.json │ │ │ ├── multiple │ │ │ ├── Owned.sol │ │ │ └── Savings.sol │ │ │ └── multiple-altered │ │ │ ├── Owned.sol │ │ │ └── Savings.sol │ ├── sources │ │ ├── Nightly │ │ │ ├── sources │ │ │ │ └── C.sol │ │ │ ├── artifact.json │ │ │ └── metadata.json │ │ ├── WithImmutablesCreationBytecodeAttack │ │ │ ├── artifact.json │ │ │ └── sources │ │ │ │ └── WithImmutables.sol │ │ ├── ViaIRUnoptimizedMismatch │ │ │ ├── sources │ │ │ │ └── A │ │ │ └── metadata.json │ │ ├── AbstractCreationBytecodeAttack │ │ │ ├── sources │ │ │ │ └── FFF.sol │ │ │ └── metadata.json │ │ ├── MultipleEqualAuxdatas │ │ │ └── sources │ │ │ │ ├── src │ │ │ │ ├── common │ │ │ │ │ └── RandomCtx.sol │ │ │ │ ├── interfaces │ │ │ │ │ ├── TBABoilerplate │ │ │ │ │ │ ├── IAccountProxy.sol │ │ │ │ │ │ ├── IAccountImplementation.sol │ │ │ │ │ │ └── IRegistry.sol │ │ │ │ │ ├── IPeterStorage.sol │ │ │ │ │ └── ITraitStorage.sol │ │ │ │ └── TraitCategory.sol │ │ │ │ └── lib │ │ │ │ └── openzeppelin-contracts │ │ │ │ └── contracts │ │ │ │ ├── token │ │ │ │ └── ERC721 │ │ │ │ │ └── extensions │ │ │ │ │ └── IERC721Metadata.sol │ │ │ │ └── utils │ │ │ │ ├── Context.sol │ │ │ │ └── introspection │ │ │ │ └── IERC165.sol │ │ ├── CallProtectionForLibraries │ │ │ ├── sources │ │ │ │ └── Ballot.sol │ │ │ ├── artifact.json │ │ │ └── metadata.json │ │ ├── CallProtectionForLibrariesViaIR │ │ │ ├── sources │ │ │ │ └── Ballot.sol │ │ │ ├── artifact.json │ │ │ └── metadata.json │ │ ├── pre-0.4.11 │ │ │ └── Simple.sol │ │ ├── Constructor │ │ │ └── sources │ │ │ │ └── Constructor.sol │ │ ├── NoAuxdata │ │ │ └── sources │ │ │ │ └── NoAuxdata.sol │ │ ├── NoImmutableField │ │ │ └── sources │ │ │ │ └── NoImmutable.sol │ │ ├── ExtraFilesBytecodeMismatch │ │ │ ├── complete_sources │ │ │ │ └── contracts │ │ │ │ │ ├── deployments │ │ │ │ │ └── StringLib.sol │ │ │ │ │ ├── interfaces │ │ │ │ │ ├── IAaveIncentivesController.sol │ │ │ │ │ ├── IDelegationToken.sol │ │ │ │ │ ├── IERC20WithPermit.sol │ │ │ │ │ ├── IPriceOracleGetter.sol │ │ │ │ │ ├── IExchangeAdapter.sol │ │ │ │ │ ├── IChainlinkAggregator.sol │ │ │ │ │ ├── ILendingRateOracle.sol │ │ │ │ │ └── IUniswapV2Router02.sol │ │ │ │ │ ├── mocks │ │ │ │ │ ├── upgradeability │ │ │ │ │ │ ├── MockStableDebtToken.sol │ │ │ │ │ │ ├── MockVariableDebtToken.sol │ │ │ │ │ │ └── MockAToken.sol │ │ │ │ │ ├── tokens │ │ │ │ │ │ ├── MintableERC20.sol │ │ │ │ │ │ └── MintableDelegationERC20.sol │ │ │ │ │ └── oracle │ │ │ │ │ │ └── LendingRateOracle.sol │ │ │ │ │ ├── dependencies │ │ │ │ │ └── openzeppelin │ │ │ │ │ │ └── contracts │ │ │ │ │ │ ├── IERC20Detailed.sol │ │ │ │ │ │ └── Context.sol │ │ │ │ │ ├── misc │ │ │ │ │ └── interfaces │ │ │ │ │ │ ├── IWETH.sol │ │ │ │ │ │ └── IWETHGateway.sol │ │ │ │ │ ├── flashloan │ │ │ │ │ ├── interfaces │ │ │ │ │ │ └── IFlashLoanReceiver.sol │ │ │ │ │ └── base │ │ │ │ │ │ └── FlashLoanReceiverBase.sol │ │ │ │ │ └── protocol │ │ │ │ │ └── libraries │ │ │ │ │ └── aave-upgradeability │ │ │ │ │ └── InitializableImmutableAdminUpgradeabilityProxy.sol │ │ │ └── sources │ │ │ │ ├── IAaveIncentivesController.sol │ │ │ │ ├── IPriceOracleGetter.sol │ │ │ │ └── IFlashLoanReceiver.sol │ │ ├── ConstructorModified │ │ │ └── sources │ │ │ │ └── ConstructorModified.sol │ │ ├── UsingLibrary │ │ │ └── sources │ │ │ │ └── UsingLibrary.sol │ │ ├── WithMultipleAuxdatas │ │ │ └── sources │ │ │ │ ├── ERC20Token.sol │ │ │ │ ├── ERC721Token.sol │ │ │ │ └── Factory.sol │ │ ├── ContractWithVariatedSources │ │ │ └── sources │ │ │ │ └── TheGraphGreeter.sol │ │ ├── Vyper │ │ │ ├── withImmutables │ │ │ │ └── test.vy │ │ │ ├── testcontract │ │ │ │ ├── test.vy │ │ │ │ ├── artifact.json │ │ │ │ └── wrongAuxdata │ │ │ │ │ └── artifact.json │ │ │ └── testcontract2 │ │ │ │ ├── test.vy │ │ │ │ └── artifact.json │ │ ├── Create2 │ │ │ └── sources │ │ │ │ └── Wallet.sol │ │ ├── WithImmutables │ │ │ └── sources │ │ │ │ └── WithImmutables.sol │ │ ├── CBORInTheMiddleFactory │ │ │ └── sources │ │ │ │ └── @openzeppelin │ │ │ │ └── contracts │ │ │ │ ├── proxy │ │ │ │ └── beacon │ │ │ │ │ └── IBeacon.sol │ │ │ │ ├── utils │ │ │ │ └── introspection │ │ │ │ │ └── IERC165.sol │ │ │ │ ├── interfaces │ │ │ │ └── draft-IERC1822.sol │ │ │ │ └── token │ │ │ │ └── ERC721 │ │ │ │ └── IERC721Receiver.sol │ │ ├── Storage │ │ │ └── sources │ │ │ │ └── Storage.sol │ │ ├── StorageInliner │ │ │ └── sources │ │ │ │ └── Storage.sol │ │ ├── StorageViaIR │ │ │ └── sources │ │ │ │ └── Storage.sol │ │ ├── FactoryImmutable │ │ │ ├── Child │ │ │ │ └── sources │ │ │ │ │ └── FactoryTest.sol │ │ │ └── Factory │ │ │ │ └── sources │ │ │ │ └── FactoryTest.sol │ │ ├── StorageModified │ │ │ └── sources │ │ │ │ └── StorageModified.sol │ │ ├── WrongMetadata │ │ │ └── sources │ │ │ │ └── SimplyLog.sol │ │ ├── MetadataRewriting │ │ │ └── contract │ │ │ │ └── sources │ │ │ │ └── EIP1967Admin.sol │ │ ├── FactoryImmutableWithoutConstrArg │ │ │ ├── Child │ │ │ │ └── sources │ │ │ │ │ └── FactoryTest3.sol │ │ │ └── Factory │ │ │ │ └── sources │ │ │ │ └── FactoryTest3.sol │ │ └── CBORInTheMiddle │ │ │ └── metadata.json │ └── Validation │ │ └── processFiles.spec.ts │ ├── tsconfig.module.json │ ├── hardhat.config.js │ ├── src │ └── utils │ │ └── utils.ts │ └── LICENSE ├── .circleci └── ssh.config ├── .gitmodules ├── .eslintignore ├── codecov.yml ├── .dockerignore ├── FUNDING.json ├── tslint.json ├── scripts ├── updateChains.mjs ├── partial_matches_cleanup.sh ├── release │ └── logging_utils.sh ├── rename_repov2_sol_extension.sh └── .env.example ├── .nxignore ├── nx.json ├── lerna.json ├── .github ├── ISSUE_TEMPLATE │ └── self-hosted-instance.md ├── PULL_REQUEST_TEMPLATE │ └── release.md └── pull_request_template.md ├── .gitignore ├── .eslintrc.js ├── renovate.json ├── .vscode └── tasks.json └── LICENSE /.nvmrc: -------------------------------------------------------------------------------- 1 | 22.5.1 -------------------------------------------------------------------------------- /services/4byte/.prettierignore: -------------------------------------------------------------------------------- 1 | dist/ -------------------------------------------------------------------------------- /services/monitor/.prettierignore: -------------------------------------------------------------------------------- 1 | dist/ -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80 3 | } 4 | -------------------------------------------------------------------------------- /packages/compilers-types/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | node_modules/ -------------------------------------------------------------------------------- /.circleci/ssh.config: -------------------------------------------------------------------------------- 1 | Host * 2 | StrictHostKeyChecking no 3 | -------------------------------------------------------------------------------- /packages/compilers/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | node_modules/ 3 | coverage/ -------------------------------------------------------------------------------- /packages/bytecode-utils/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/bytecode'; 2 | -------------------------------------------------------------------------------- /packages/lib-sourcify/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | node_modules/ 3 | coverage/ -------------------------------------------------------------------------------- /services/monitor/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .git/ 3 | dist/ 4 | .env -------------------------------------------------------------------------------- /services/server/.prettierignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | chain-tests-report/ 3 | coverage/ 4 | node_modules/ -------------------------------------------------------------------------------- /services/server/test/testcontracts/1_Storage/address: -------------------------------------------------------------------------------- 1 | xdai,0x656d0062eC89c940213E3F3170EA8b2add1c0143 2 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example/.gitattributes: -------------------------------------------------------------------------------- 1 | *.sol linguist-language=Solidity 2 | -------------------------------------------------------------------------------- /packages/bytecode-utils/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/* 2 | build 3 | node_modules 4 | src/**.js 5 | coverage 6 | *.log 7 | yarn.lock 8 | .env -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example-missing-source/.gitattributes: -------------------------------------------------------------------------------- 1 | *.sol linguist-language=Solidity 2 | -------------------------------------------------------------------------------- /services/monitor/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extension": ["ts"], 3 | "require": ["ts-node/register"], 4 | "timeout": 30000 5 | } 6 | -------------------------------------------------------------------------------- /packages/bytecode-utils/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extension": ["ts"], 3 | "require": ["ts-node/register"], 4 | "timeout": 60000 5 | } 6 | -------------------------------------------------------------------------------- /packages/compilers/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extension": [".spec.ts"], 3 | "require": ["ts-node/register"], 4 | "timeout": 120000 5 | } 6 | -------------------------------------------------------------------------------- /services/database/.gitignore: -------------------------------------------------------------------------------- 1 | migrations-temp* 2 | massive-replace-script/CURRENT_VERIFIED_CONTRACT 3 | massive-replace-script/FAILED_CONTRACTS -------------------------------------------------------------------------------- /packages/compilers-types/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./CompilationTypes"; 2 | export * from "./VyperTypes"; 3 | export * from "./SolidityTypes"; 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "services/database/database-specs"] 2 | path = services/database/database-specs 3 | url = https://github.com/verifier-alliance/database-specs 4 | -------------------------------------------------------------------------------- /services/server/test/sources/truffle/truffle-example.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethereum/sourcify/HEAD/services/server/test/sources/truffle/truffle-example.zip -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | # don't ever lint node_modules 2 | node_modules 3 | # don't lint build output (make sure it's set to your correct build folder name) 4 | dist 5 | build 6 | -------------------------------------------------------------------------------- /services/4byte/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extension": [".spec.ts"], 3 | "require": ["ts-node/register", "./test/load-env.js"], 4 | "timeout": 30000, 5 | "exit": true 6 | } 7 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/Nightly/sources/C.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f2() public { 3 | bytes1[2] memory k; 4 | k[0] = bytes1(0); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/WithImmutablesCreationBytecodeAttack/artifact.json: -------------------------------------------------------------------------------- 1 | { 2 | "bytecode": "60a060405234801561001057600080fd5b506040516103ca", 3 | "abi": [] 4 | } 5 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethereum/sourcify/HEAD/packages/lib-sourcify/test/validationFiles/files/truffle-example.zip -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ViaIRUnoptimizedMismatch/sources/A: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f2() public { 3 | bytes1[2] memory k; 4 | k[0] = bytes1(0); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /services/server/src/common/async-context.ts: -------------------------------------------------------------------------------- 1 | import { AsyncLocalStorage } from "async_hooks"; 2 | 3 | export const asyncLocalStorage = new AsyncLocalStorage<{ 4 | traceId?: string; 5 | }>(); 6 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/AbstractCreationBytecodeAttack/sources/FFF.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.6.12; 2 | 3 | abstract contract FFF{ 4 | constructor (uint256 a) public payable { 5 | } 6 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/WithImmutablesCreationBytecodeAttack/sources/WithImmutables.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.7.0; 2 | 3 | contract WithImmutables{ 4 | constructor (uint256 a) { 5 | } 6 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example-with-macosx.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethereum/sourcify/HEAD/packages/lib-sourcify/test/validationFiles/files/truffle-example-with-macosx.zip -------------------------------------------------------------------------------- /services/server/tsconfig.lint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig", 3 | "compilerOptions": { 4 | "rootDir": ".", 5 | }, 6 | "include": ["src/**/*.ts", "src/**/*.js", "test/**/*.ts", "test/**/*.js"], 7 | } 8 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: auto 8 | threshold: 0.5% 9 | patch: 10 | default: 11 | target: 70% 12 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example-missing-source.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethereum/sourcify/HEAD/packages/lib-sourcify/test/validationFiles/files/truffle-example-missing-source.zip -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example-missing-source2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethereum/sourcify/HEAD/packages/lib-sourcify/test/validationFiles/files/truffle-example-missing-source2.zip -------------------------------------------------------------------------------- /services/server/.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extension": [".spec.ts"], 3 | "require": [ 4 | "ts-node/register", 5 | "./test/load-env.js", 6 | "./test/global-mocks.ts" 7 | ], 8 | "timeout": 120000 9 | } 10 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/MultipleEqualAuxdatas/sources/src/common/RandomCtx.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.17; 3 | 4 | struct RandomCtx { 5 | uint256 seed; 6 | uint256 counter; 7 | } 8 | -------------------------------------------------------------------------------- /services/server/src/common/errors/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./NotFoundError"; 2 | export * from "./InternalServerError"; 3 | export * from "./BadRequestError"; 4 | export * from "./PayloadTooLargeError"; 5 | export * from "./ConflictError"; 6 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/CallProtectionForLibraries/sources/Ballot.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.8.19; 2 | library Ballot { 3 | function giveRightToVote() public { 4 | uint8 tempnumber = 0; 5 | tempnumber += 1; 6 | } 7 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example/migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | const Migrations = artifacts.require("Migrations"); 2 | 3 | module.exports = function (deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/CallProtectionForLibrariesViaIR/sources/Ballot.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.8.19; 2 | library Ballot { 3 | function giveRightToVote() public { 4 | uint8 tempnumber = 0; 5 | tempnumber += 1; 6 | } 7 | } -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .circleci 2 | .vscode 3 | **/dist 4 | **/build 5 | **/node_modules 6 | **/.cache 7 | **/tmp 8 | **/Dockerfile* 9 | **/.DS_Store 10 | .nx 11 | **/.env 12 | **/.env-backup 13 | **/*.key 14 | 15 | # Config files 16 | **/config/local.js -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example-missing-source/migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | const Migrations = artifacts.require("Migrations"); 2 | 3 | module.exports = function (deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /services/database/migrations/20251009141621_add_external_verification.sql: -------------------------------------------------------------------------------- 1 | -- migrate:up 2 | 3 | ALTER TABLE verification_jobs ADD external_verification jsonb NULL; 4 | 5 | -- migrate:down 6 | 7 | ALTER TABLE verification_jobs DROP COLUMN external_verification; 8 | -------------------------------------------------------------------------------- /packages/compilers/tsconfig.module.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig", 3 | "compilerOptions": { 4 | "target": "esnext", 5 | "outDir": "build/module", 6 | "module": "esnext" 7 | }, 8 | "exclude": [ 9 | "node_modules/**" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/6119/sources/@openzeppelin/contracts/interfaces/IERC721.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../token/ERC721/IERC721.sol"; 7 | -------------------------------------------------------------------------------- /FUNDING.json: -------------------------------------------------------------------------------- 1 | { 2 | "drips": { 3 | "ethereum": { 4 | "ownedBy": "0x92347362ACc955A6f3Dc7F9D34945AAaC944FFBF" 5 | } 6 | }, 7 | "opRetro": { 8 | "projectId": "0x51cda5996ef1a2ccd8fcf4ee5792337695599454c83eb1218c3ad4388dcb5bf5" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/bytecode-utils/tsconfig.module.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig", 3 | "compilerOptions": { 4 | "target": "esnext", 5 | "outDir": "build/module", 6 | "module": "esnext" 7 | }, 8 | "exclude": [ 9 | "node_modules/**" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /packages/compilers-types/tsconfig.module.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig", 3 | "compilerOptions": { 4 | "target": "esnext", 5 | "outDir": "build/module", 6 | "module": "esnext" 7 | }, 8 | "exclude": [ 9 | "node_modules/**" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /packages/lib-sourcify/tsconfig.module.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig", 3 | "compilerOptions": { 4 | "target": "esnext", 5 | "outDir": "build/module", 6 | "module": "esnext" 7 | }, 8 | "exclude": [ 9 | "node_modules/**" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /services/server/hardhat.config.js: -------------------------------------------------------------------------------- 1 | /** @type import('hardhat/config').HardhatUserConfig */ 2 | module.exports = { 3 | // Needed for tests 4 | networks: { 5 | hardhat: { 6 | accounts: { 7 | count: 1, 8 | }, 9 | }, 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /packages/lib-sourcify/hardhat.config.js: -------------------------------------------------------------------------------- 1 | /** @type import('hardhat/config').HardhatUserConfig */ 2 | module.exports = { 3 | // Needed for tests 4 | networks: { 5 | hardhat: { 6 | accounts: { 7 | count: 1, 8 | }, 9 | }, 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/MultipleEqualAuxdatas/sources/src/interfaces/TBABoilerplate/IAccountProxy.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.17; 3 | 4 | interface IAccountProxy { 5 | function initialize(address _implementation) external; 6 | } 7 | -------------------------------------------------------------------------------- /services/server/.env.docker: -------------------------------------------------------------------------------- 1 | # Sourcify's database postgres connection 2 | SOURCIFY_POSTGRES_HOST="db" 3 | SOURCIFY_POSTGRES_DB="sourcify" 4 | SOURCIFY_POSTGRES_USER="sourcify" 5 | SOURCIFY_POSTGRES_PASSWORD="sourcify" 6 | SOURCIFY_POSTGRES_PORT=5432 7 | 8 | NODE_ENV=development 9 | -------------------------------------------------------------------------------- /services/server/src/server/apiv2/jobs/jobs.routes.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "express"; 2 | import { getJobEndpoint } from "./jobs.handler"; 3 | 4 | const router = Router(); 5 | 6 | router.route("/verify/:verificationId").get(getJobEndpoint); 7 | 8 | export default router; 9 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/6119/sources/@openzeppelin/contracts/interfaces/IERC165.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../utils/introspection/IERC165.sol"; 7 | -------------------------------------------------------------------------------- /services/server/test/sources/contracts/ParentContract.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | /** 6 | * Dummy contract; it would be great if it never gets published to IPFS 7 | */ 8 | contract ParentContract { 9 | 10 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/MultipleEqualAuxdatas/sources/src/interfaces/TBABoilerplate/IAccountImplementation.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.17; 3 | 4 | interface IAccountImplementation { 5 | function owner() external view returns (address); 6 | } 7 | -------------------------------------------------------------------------------- /services/4byte/.env.test: -------------------------------------------------------------------------------- 1 | # Test database configuration 2 | FOURBYTES_POSTGRES_HOST=fourbytes-db 3 | FOURBYTES_POSTGRES_PORT=5432 4 | FOURBYTES_POSTGRES_DB=fourbytes_test_db 5 | FOURBYTES_POSTGRES_USER=fourbytes 6 | FOURBYTES_POSTGRES_PASSWORD=fourbytes 7 | FOURBYTES_POSTGRES_SCHEMA=public 8 | PORT=4445 -------------------------------------------------------------------------------- /services/database/migrations/20251101120000_add_code_first_75_index.sql: -------------------------------------------------------------------------------- 1 | -- migrate:up 2 | 3 | CREATE INDEX IF NOT EXISTS idx_code_code_first_75 4 | ON code USING btree (substring(code FROM 1 FOR 75)); 5 | 6 | -- migrate:down 7 | 8 | DROP INDEX IF EXISTS idx_code_code_first_75; 9 | 10 | -------------------------------------------------------------------------------- /services/server/src/server/apiv1/verification/private/private.routes.ts: -------------------------------------------------------------------------------- 1 | import privateRoutes from "./stateless/private.stateless.routes"; 2 | 3 | import { Router } from "express"; 4 | 5 | const router = Router(); 6 | 7 | router.use("/", privateRoutes); 8 | 9 | export default router; 10 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/100/test.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public view returns (uint) { 3 | uint b = block.timestamp; 4 | uint a = b + 0; // Overflow not possible! 5 | return a; 6 | } 7 | } 8 | // ==== 9 | // SMTEngine: bmc 10 | // ---- 11 | -------------------------------------------------------------------------------- /services/server/src/server/apiv1/testartifacts/testartifacts.routes.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "express"; 2 | import { findLatestChainTest } from "./testartifacts.handlers"; 3 | 4 | const router: Router = Router(); 5 | 6 | router.route(["/"]).get(findLatestChainTest); 7 | 8 | export default router; 9 | -------------------------------------------------------------------------------- /services/server/src/server/services/workers/workerWrapper.js: -------------------------------------------------------------------------------- 1 | // Needed for using TypeScript for workers 2 | const { workerData } = require("worker_threads"); 3 | 4 | if (workerData.fullpath.endsWith(".ts")) { 5 | require("ts-node").register(); 6 | } 7 | module.exports = require(workerData.fullpath); 8 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/pre-0.4.11/Simple.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.0; 2 | 3 | contract Simple { 4 | uint public value; 5 | 6 | function Simple() { 7 | value = 42; 8 | } 9 | 10 | function setValue(uint _value) { 11 | value = _value; 12 | } 13 | } -------------------------------------------------------------------------------- /services/4byte/test/load-env.js: -------------------------------------------------------------------------------- 1 | const dotenv = require("dotenv"); 2 | const path = require("path"); 3 | 4 | // Simple way to load two .env files 5 | dotenv.config({ path: path.join(__dirname, "../.env.test") }); 6 | dotenv.config({ path: path.join(__dirname, "../.env") }); // does not override already set values -------------------------------------------------------------------------------- /services/server/src/server/apiv1/verification/vyper/vyper.routes.ts: -------------------------------------------------------------------------------- 1 | import verifyStatelessRoutes from "./stateless/vyper.stateless.routes"; 2 | 3 | import { Router } from "express"; 4 | 5 | const router = Router(); 6 | 7 | router.use("/", verifyStatelessRoutes); 8 | 9 | export default router; 10 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/106/ConvertLib.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.4.25 <0.9.0; 3 | 4 | library ConvertLib{ 5 | function convert(uint amount,uint conversionRate) public pure returns (uint convertedAmount) 6 | { 7 | return amount * conversionRate; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /services/server/test/load-env.js: -------------------------------------------------------------------------------- 1 | const dotenv = require("dotenv"); 2 | const path = require("path"); 3 | 4 | // Simple way to load two .env files 5 | dotenv.config({ path: path.join(__dirname, "../.env.test") }); 6 | dotenv.config({ path: path.join(__dirname, "../.env") }); // does not override already set values 7 | -------------------------------------------------------------------------------- /services/server/src/common/interfaces.ts: -------------------------------------------------------------------------------- 1 | import type { Router } from "express"; 2 | 3 | export interface IController { 4 | registerRoutes(): Router; 5 | } 6 | export interface IResponseError { 7 | statusCode: number; 8 | message: string; 9 | errors?: any[]; 10 | payload?: Record; 11 | } 12 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "typestrict", 3 | "rules": { 4 | "no-debugger": true, 5 | "mocha-avoid-only": true, 6 | "prefer-const": true, 7 | "no-var-keyword": true, 8 | "no-commented-code": { 9 | "severity": "warning" 10 | }, 11 | "no-use-before-declare": false 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /services/server/test/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.8" 2 | 3 | services: 4 | db-test: 5 | image: postgres:15-alpine 6 | environment: 7 | POSTGRES_DB: "sourcify" 8 | POSTGRES_USER: "sourcify" 9 | POSTGRES_PASSWORD: "sourcify" 10 | ports: 11 | - ${DOCKER_HOST_POSTGRES_TEST_PORT}:5432 12 | -------------------------------------------------------------------------------- /scripts/updateChains.mjs: -------------------------------------------------------------------------------- 1 | import { promises } from "fs"; 2 | 3 | const chainsUrl = "https://chainid.network/chains.json"; 4 | const chainsPath = "services/server/src/chains.json"; 5 | 6 | const result = await fetch(chainsUrl); 7 | const chainsList = await result.text(); 8 | 9 | await promises.writeFile(chainsPath, chainsList); 10 | -------------------------------------------------------------------------------- /services/server/test/sources/contracts/ChildContract.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | import "contracts/ParentContract.sol"; 6 | 7 | /** 8 | * Dummy contract; it would be great if it never gets published to IPFS 9 | */ 10 | contract ChildContract is ParentContract { 11 | 12 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/Constructor/sources/Constructor.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.8.0; 2 | 3 | contract StorageConstructor { 4 | uint256 number; 5 | 6 | constructor(uint256 a) { 7 | number = a; 8 | } 9 | 10 | function read() public view returns (uint256) { 11 | return number; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example/contracts/ConvertLib.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.4.25 <0.7.0; 3 | 4 | library ConvertLib{ 5 | function convert(uint amount,uint conversionRate) public pure returns (uint convertedAmount) 6 | { 7 | return amount * conversionRate; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /services/4byte/test/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.8" 2 | 3 | services: 4 | fourbytes-db: 5 | image: postgres:15-alpine 6 | environment: 7 | POSTGRES_DB: "fourbytes_test_db" 8 | POSTGRES_USER: "fourbytes" 9 | POSTGRES_PASSWORD: "fourbytes" 10 | ports: 11 | - ${DOCKER_HOST_POSTGRES_TEST_PORT:-5433}:5432 12 | -------------------------------------------------------------------------------- /services/server/src/server/apiv1/verification/solc-json/session/solc-json.session.routes.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "express"; 2 | import { addInputSolcJsonEndpoint } from "./solc-json.session.handlers"; 3 | 4 | const router: Router = Router(); 5 | 6 | router.route("/session/input-solc-json").post(addInputSolcJsonEndpoint); 7 | 8 | export default router; 9 | -------------------------------------------------------------------------------- /packages/compilers/src/index.ts: -------------------------------------------------------------------------------- 1 | import type { ILogger } from './logger'; 2 | import { setLogger, setLevel } from './logger'; 3 | export const setCompilersLogger = setLogger; 4 | export const setCompilersLoggerLevel = setLevel; 5 | export type ICompilersLogger = ILogger; 6 | 7 | export * from './lib/solidityCompiler'; 8 | export * from './lib/vyperCompiler'; 9 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/NoAuxdata/sources/NoAuxdata.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | contract NoAuxdata { 5 | uint256 public value; 6 | 7 | constructor() { 8 | value = 42; 9 | } 10 | 11 | function setValue(uint256 _value) public { 12 | value = _value; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/NoImmutableField/sources/NoImmutable.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.6.4; 2 | 3 | contract NoImmutable { 4 | uint256 number; 5 | 6 | function store(uint256 num) public { 7 | number = num; 8 | } 9 | 10 | function retrieve() public view returns (uint256) { 11 | return number; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /services/4byte/.env.example: -------------------------------------------------------------------------------- 1 | FOURBYTES_POSTGRES_HOST="localhost" 2 | FOURBYTES_POSTGRES_DB="sourcify" 3 | FOURBYTES_POSTGRES_USER="sourcify" 4 | FOURBYTES_POSTGRES_PASSWORD="sourcify" 5 | FOURBYTES_POSTGRES_PORT=5432 6 | FOURBYTES_POSTGRES_MAX_CONNECTIONS=20 7 | FOURBYTES_POSTGRES_SCHEMA="public" 8 | PORT=4444 9 | NODE_ENV=development # production for JSON logging -------------------------------------------------------------------------------- /services/monitor/hardhat.config.js: -------------------------------------------------------------------------------- 1 | /** @type import('hardhat/config').HardhatUserConfig */ 2 | module.exports = { 3 | // Needed for tests 4 | networks: { 5 | hardhat: { 6 | accounts: { 7 | count: 1, 8 | }, 9 | mining: { 10 | auto: false, 11 | interval: 3000 12 | } 13 | }, 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example-missing-source/contracts/ConvertLib.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.4.25 <0.7.0; 3 | 4 | library ConvertLib{ 5 | function convert(uint amount,uint conversionRate) public pure returns (uint convertedAmount) 6 | { 7 | return amount * conversionRate; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example/migrations/2_deploy_contracts.js: -------------------------------------------------------------------------------- 1 | const ConvertLib = artifacts.require("ConvertLib"); 2 | const MetaCoin = artifacts.require("MetaCoin"); 3 | 4 | module.exports = function (deployer) { 5 | deployer.deploy(ConvertLib); 6 | deployer.link(ConvertLib, MetaCoin); 7 | deployer.deploy(MetaCoin); 8 | }; 9 | -------------------------------------------------------------------------------- /services/server/src/server/apiv1/verification/etherscan/session/etherscan.session.routes.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "express"; 2 | import { sessionVerifyFromEtherscan } from "./etherscan.session.handlers"; 3 | 4 | const router: Router = Router(); 5 | 6 | router.route(["/session/verify/etherscan"]).post(sessionVerifyFromEtherscan); 7 | 8 | export default router; 9 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/deployments/StringLib.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | library StringLib { 5 | function concat(string memory a, string memory b) internal pure returns (string memory) { 6 | return string(abi.encodePacked(a, b)); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example-missing-source/migrations/2_deploy_contracts.js: -------------------------------------------------------------------------------- 1 | const ConvertLib = artifacts.require("ConvertLib"); 2 | const MetaCoin = artifacts.require("MetaCoin"); 3 | 4 | module.exports = function (deployer) { 5 | deployer.deploy(ConvertLib); 6 | deployer.link(ConvertLib, MetaCoin); 7 | deployer.deploy(MetaCoin); 8 | }; 9 | -------------------------------------------------------------------------------- /services/database/dune/index.ts: -------------------------------------------------------------------------------- 1 | import dotenv from "dotenv"; 2 | import { SourcifyDuneSyncClient } from "./SourcifyDuneSyncClient"; 3 | 4 | dotenv.config(); 5 | 6 | const main = async () => { 7 | const sourcifyDuneSyncClient = new SourcifyDuneSyncClient( 8 | process.env.DUNE_API_KEY!, 9 | ); 10 | await sourcifyDuneSyncClient.syncAll(); 11 | }; 12 | 13 | main(); 14 | -------------------------------------------------------------------------------- /services/database/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowJs": true, 4 | "target": "es2017", 5 | "esModuleInterop": true, 6 | "strict": true, 7 | "outDir": "dist", 8 | "resolveJsonModule": true, 9 | "module": "commonjs", 10 | "skipLibCheck": true 11 | }, 12 | "include": ["./**/*.ts"], 13 | "exclude": ["node_modules/**"] 14 | } 15 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ConstructorModified/sources/ConstructorModified.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.8.0; 2 | 3 | contract StorageConstructor { 4 | uint256 number; 5 | 6 | constructor(uint256 a) { 7 | number = a; 8 | } 9 | 10 | function read() public view returns (uint256) { 11 | return number; 12 | } 13 | } 14 | 15 | // Modifies the file 16 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/sources/IAaveIncentivesController.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | pragma experimental ABIEncoderV2; 4 | 5 | interface IAaveIncentivesController { 6 | function handleAction( 7 | address user, 8 | uint256 userBalance, 9 | uint256 totalSupply 10 | ) external; 11 | } 12 | -------------------------------------------------------------------------------- /.nxignore: -------------------------------------------------------------------------------- 1 | # Explicitly don't ignore local.js config file, even if it's ignored by git. 2 | # This should invalidate the cache for tasks if local.js is changed 3 | 4 | # For some reason this needs to be defined in the root and not under services/server. Otherwise the nx cache ignores this file and changes to this never trigger a re-build. More info: https://github.com/nrwl/nx/issues/6821 5 | !**/config/local.js -------------------------------------------------------------------------------- /nx.json: -------------------------------------------------------------------------------- 1 | { 2 | "tasksRunnerOptions": { 3 | "default": { 4 | "runner": "nx/tasks-runners/default", 5 | "options": { 6 | "cacheableOperations": [ 7 | "build", 8 | "test" 9 | ] 10 | } 11 | } 12 | }, 13 | "targetDefaults": { 14 | "build": { 15 | "dependsOn": [ 16 | "^build" 17 | ] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/bytecode-utils/test/bytecodes/vyper-no-integrity.hex: -------------------------------------------------------------------------------- 1 | 0x61008f61000f60003961008f6000f360003560e01c63c605f76c8118610084573461008a57602080608052600c6040527f48656c6c6f20576f726c6421000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506080f35b60006000fd5b600080fd84188f8000a16576797065728300030a0012 -------------------------------------------------------------------------------- /services/server/src/server/apiv1/verification/vyper/stateless/vyper.stateless.routes.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "express"; 2 | import { verifyVyper } from "./vyper.stateless.handlers"; 3 | import { checkPerfectMatch } from "../../../controllers.common"; 4 | 5 | const router: Router = Router(); 6 | 7 | router.route("/verify/vyper").post(checkPerfectMatch, verifyVyper); 8 | 9 | export default router; 10 | -------------------------------------------------------------------------------- /packages/bytecode-utils/test/bytecodes/vyper-cbor-no-array.hex: -------------------------------------------------------------------------------- 1 | 0x6100a361000f6000396100a36000f360003560e01c346100915763c605f76c811861008a57602080608052600c6040527f48656c6c6f20576f726c6421000000000000000000000000000000000000000060605260408160800181516020830160208301815181525050808252508051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506080f35b5060006000fd5b600080fda165767970657283000308000b -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/UsingLibrary/sources/UsingLibrary.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | library Lib { 6 | function foo() public pure returns (string memory) { 7 | return "hello from foo"; 8 | } 9 | } 10 | 11 | contract Con { 12 | function bar() public pure returns (string memory) { 13 | return Lib.foo(); 14 | } 15 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/WithMultipleAuxdatas/sources/ERC20Token.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.8.9; 3 | 4 | // test 5 | contract ERC20Token { 6 | constructor( 7 | string memory name, 8 | string memory symbol, 9 | uint8 decimals, 10 | uint256 initialSupply, 11 | address owner 12 | ) { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /services/server/test/testcontracts/LibrariesSolidity075/Example.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.7.4; 3 | 4 | library Lib { 5 | function sum(uint256 a, uint256 b) external returns (uint256) { 6 | return a + b; 7 | } 8 | } 9 | 10 | contract A { 11 | function sum(uint256 a, uint256 b) external returns (uint256) { 12 | return Lib.sum(a, b); 13 | } 14 | } -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "command": { 3 | "publish": { 4 | "message": "chore(release): publish", 5 | "registry": "https://npm.pkg.github.com" 6 | }, 7 | "bootstrap": { 8 | "npmClientArgs": ["--no-package-lock"] 9 | }, 10 | "version": { 11 | "allowBranch": "release-*" 12 | } 13 | }, 14 | "packages": ["services/*", "packages/*"], 15 | "version": "independent" 16 | } 17 | -------------------------------------------------------------------------------- /services/server/src/server/apiv1/verification/verify/verify.routes.ts: -------------------------------------------------------------------------------- 1 | import verifyStatelessRoutes from "./stateless/verify.stateless.routes"; 2 | import verifySessionRoutes from "./session/verify.session.routes"; 3 | 4 | import { Router } from "express"; 5 | 6 | const router = Router(); 7 | 8 | router.use("/", verifyStatelessRoutes); 9 | router.use("/", verifySessionRoutes); 10 | 11 | export default router; 12 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/interfaces/IAaveIncentivesController.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | pragma experimental ABIEncoderV2; 4 | 5 | interface IAaveIncentivesController { 6 | function handleAction( 7 | address user, 8 | uint256 userBalance, 9 | uint256 totalSupply 10 | ) external; 11 | } 12 | -------------------------------------------------------------------------------- /services/server/src/server/apiv1/verification/etherscan/stateless/etherscan.stateless.routes.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "express"; 2 | import { verifyFromEtherscan } from "./etherscan.stateless.handlers"; 3 | import { checkPerfectMatch } from "../../../controllers.common"; 4 | const router: Router = Router(); 5 | 6 | router.route("/verify/etherscan").post(checkPerfectMatch, verifyFromEtherscan); 7 | 8 | export default router; 9 | -------------------------------------------------------------------------------- /services/server/src/common/errors/BadGatewayError.ts: -------------------------------------------------------------------------------- 1 | import { StatusCodes } from "http-status-codes"; 2 | import type { IResponseError } from "../interfaces"; 3 | 4 | export class BadGatewayError implements IResponseError { 5 | statusCode: number; 6 | message: string; 7 | 8 | constructor(message?: string) { 9 | this.statusCode = StatusCodes.BAD_GATEWAY; 10 | this.message = message || "Bad gateway"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /services/server/src/common/errors/BadRequestError.ts: -------------------------------------------------------------------------------- 1 | import { StatusCodes } from "http-status-codes"; 2 | import type { IResponseError } from "../interfaces"; 3 | 4 | export class BadRequestError implements IResponseError { 5 | statusCode: number; 6 | message: string; 7 | 8 | constructor(message?: string) { 9 | this.statusCode = StatusCodes.BAD_REQUEST; 10 | this.message = message || "Bad request"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /services/server/src/common/errors/NotFoundError.ts: -------------------------------------------------------------------------------- 1 | import { StatusCodes } from "http-status-codes"; 2 | import type { IResponseError } from "../interfaces"; 3 | 4 | export class NotFoundError implements IResponseError { 5 | statusCode: number; 6 | message: string; 7 | 8 | constructor(message?: string) { 9 | this.statusCode = StatusCodes.NOT_FOUND; 10 | this.message = message || "Resouce not found"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /services/server/src/server/apiv1/verification/etherscan/etherscan.routes.ts: -------------------------------------------------------------------------------- 1 | import etherscanStatelessRoutes from "./stateless/etherscan.stateless.routes"; 2 | import etherscanSessionRoutes from "./session/etherscan.session.routes"; 3 | 4 | import { Router } from "express"; 5 | 6 | const router = Router(); 7 | 8 | router.use("/", etherscanStatelessRoutes); 9 | router.use("/", etherscanSessionRoutes); 10 | 11 | export default router; 12 | -------------------------------------------------------------------------------- /services/server/src/server/apiv1/verification/solc-json/solc-json.routes.ts: -------------------------------------------------------------------------------- 1 | import solcJsonStatelessRoutes from "./stateless/solc-json.stateless.routes"; 2 | import solcJsonSessionRoutes from "./session/solc-json.session.routes"; 3 | 4 | import { Router } from "express"; 5 | 6 | const router = Router(); 7 | 8 | router.use("/", solcJsonStatelessRoutes); 9 | router.use("/", solcJsonSessionRoutes); 10 | 11 | export default router; 12 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ContractWithVariatedSources/sources/TheGraphGreeter.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.23; 3 | 4 | contract TheGraphGreeter 5 | { 6 | string public greeting; 7 | event Greeted(string hello, address sender); 8 | 9 | function greet(string memory greeting_) public 10 | { 11 | greeting = greeting_; 12 | emit Greeted(greeting, msg.sender); 13 | } 14 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/interfaces/IDelegationToken.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | /** 5 | * @title IDelegationToken 6 | * @dev Implements an interface for tokens with delegation COMP/UNI compatible 7 | * @author Aave 8 | **/ 9 | interface IDelegationToken { 10 | function delegate(address delegatee) external; 11 | } 12 | -------------------------------------------------------------------------------- /services/server/src/common/errors/TooManyRequests.ts: -------------------------------------------------------------------------------- 1 | import { StatusCodes } from "http-status-codes"; 2 | import type { IResponseError } from "../interfaces"; 3 | 4 | export class TooManyRequests implements IResponseError { 5 | statusCode: number; 6 | message: string; 7 | 8 | constructor(message?: string) { 9 | this.statusCode = StatusCodes.TOO_MANY_REQUESTS; 10 | this.message = message || "Too Many Requests"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/bytecode-utils/test/bytecodes/vyper-no-auxdata-length.hex: -------------------------------------------------------------------------------- 1 | 0x6100b761000f6000396100b76000f36003361161000c576100a1565b60003560e01c346100a75763c605f76c811861009f57600436186100a757602080608052600c6040527f48656c6c6f20576f726c6421000000000000000000000000000000000000000060605260408160800181518082526020830160208301815181525050508051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506080f35b505b60006000fd5b600080fda165767970657283000304 -------------------------------------------------------------------------------- /services/server/src/common/errors/PayloadTooLargeError.ts: -------------------------------------------------------------------------------- 1 | import { StatusCodes } from "http-status-codes"; 2 | import type { IResponseError } from "../interfaces"; 3 | 4 | export class PayloadTooLargeError implements IResponseError { 5 | statusCode: number; 6 | message: string; 7 | 8 | constructor(message?: string) { 9 | this.statusCode = StatusCodes.REQUEST_TOO_LONG; 10 | this.message = message || "Payload too large"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /services/4byte/src/utils/database-util.ts: -------------------------------------------------------------------------------- 1 | export function bytesFromString(str: string): Buffer; 2 | export function bytesFromString(str: string | undefined): Buffer | undefined; 3 | 4 | export function bytesFromString(str: string | undefined): Buffer | undefined { 5 | if (str === undefined) { 6 | return undefined; 7 | } 8 | 9 | const normalized = str.startsWith("0x") ? str.slice(2) : str; 10 | return Buffer.from(normalized, "hex"); 11 | } 12 | -------------------------------------------------------------------------------- /services/server/src/server/apiv1/verification/solc-json/stateless/solc-json.stateless.routes.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "express"; 2 | import { verifySolcJsonEndpoint } from "./solc-json.stateless.handlers"; 3 | import { checkPerfectMatch } from "../../../controllers.common"; 4 | 5 | const router: Router = Router(); 6 | 7 | router 8 | .route("/verify/solc-json") 9 | .post(checkPerfectMatch, verifySolcJsonEndpoint); 10 | 11 | export default router; 12 | -------------------------------------------------------------------------------- /services/server/src/sourcify-chains-example.json: -------------------------------------------------------------------------------- 1 | { 2 | "1": { 3 | "sourcifyName": "Ethereum Mainnet", 4 | "supported": true, 5 | "fetchContractCreationTxUsing": { 6 | "blockscoutApi": { 7 | "url": "https://eth.blockscout.com/" 8 | }, 9 | "routescanApi": { 10 | "type": "mainnet" 11 | }, 12 | "avalancheApi": true 13 | }, 14 | "rpc": ["https://ethereum-rpc.publicnode.com"] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/CallProtectionForLibrariesViaIR/artifact.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [], 3 | "bytecode": "0x60808060405234601a57608d90816100208239308160240152f35b600080fdfe6004361015600c57600080fd5b6000803560e01c63fe073d1114602157600080fd5b307f0000000000000000000000000000000000000000000000000000000000000000146054578060031936011260545780f35b80fdfea26469706673582212201104b959cf92e8eead2cb6513fe1d88ee97c7b264a0dea0bd7ccaffd488db72764736f6c63430008130033" 4 | } 5 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/mocks/upgradeability/MockStableDebtToken.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | import {StableDebtToken} from '../../protocol/tokenization/StableDebtToken.sol'; 5 | 6 | contract MockStableDebtToken is StableDebtToken { 7 | function getRevision() internal pure override returns (uint256) { 8 | return 0x2; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /services/server/src/common/errors/InternalServerError.ts: -------------------------------------------------------------------------------- 1 | import { StatusCodes } from "http-status-codes"; 2 | import type { IResponseError } from "../interfaces"; 3 | 4 | export class InternalServerError implements IResponseError { 5 | statusCode: number; 6 | message: string; 7 | 8 | constructor(message?: string) { 9 | this.statusCode = StatusCodes.INTERNAL_SERVER_ERROR; 10 | this.message = message || "Something went wrong"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/bytecode-utils/test/bytecodes/vyper-integrity.hex: -------------------------------------------------------------------------------- 1 | 0x61008f61000f60003961008f6000f360003560e01c63c605f76c8118610084573461008a57602080608052600c6040527f48656c6c6f20576f726c6421000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506080f35b60006000fd5b600080fd85582005b754c58b2e540a14aba6f16717ab2c30edc74936c8985d77b152cd97887e07188f8000a1657679706572830004010034 -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/Vyper/withImmutables/test.vy: -------------------------------------------------------------------------------- 1 | # pragma version ^0.4.0 2 | 3 | OWNER: public(immutable(address)) 4 | MY_IMMUTABLE: public(immutable(uint256)) 5 | MY_IMMUTABLE_2: public(immutable(uint256)) 6 | 7 | @deploy 8 | def __init__(val: uint256): 9 | OWNER = msg.sender 10 | MY_IMMUTABLE = val 11 | MY_IMMUTABLE_2 = 66612412897398127 12 | 13 | 14 | @external 15 | @view 16 | def get_my_immutable() -> uint256: 17 | return MY_IMMUTABLE -------------------------------------------------------------------------------- /services/monitor/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowJs": true, 4 | "target": "es2017", 5 | "sourceMap": true, 6 | "esModuleInterop": true, 7 | "strict": true, 8 | "outDir": "dist", 9 | "rootDir": "src", 10 | "resolveJsonModule": true, 11 | "declaration": true, 12 | "declarationMap": true, 13 | "module": "commonjs", 14 | }, 15 | "include": ["src/**/*.ts"], 16 | "exclude": ["node_modules/**"], 17 | } 18 | -------------------------------------------------------------------------------- /services/server/test/testcontracts/Create2/Wallet.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.8.17; 2 | 3 | contract Wallet { 4 | address payable public owner; 5 | address public admin; 6 | 7 | constructor(address payable _owner, address _admin) { 8 | owner = _owner; 9 | admin = _admin; 10 | } 11 | 12 | function withdraw() public { 13 | require(msg.sender == owner || msg.sender == admin, "Not permitted"); 14 | owner.transfer(address(this).balance); 15 | } 16 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/mocks/upgradeability/MockVariableDebtToken.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | import {VariableDebtToken} from '../../protocol/tokenization/VariableDebtToken.sol'; 5 | 6 | contract MockVariableDebtToken is VariableDebtToken { 7 | function getRevision() internal pure override returns (uint256) { 8 | return 0x2; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/Create2/sources/Wallet.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.8.17; 2 | 3 | contract Wallet { 4 | address payable public owner; 5 | address public admin; 6 | 7 | constructor(address payable _owner, address _admin) { 8 | owner = _owner; 9 | admin = _admin; 10 | } 11 | 12 | function withdraw() public { 13 | require(msg.sender == owner || msg.sender == admin, "Not permitted"); 14 | owner.transfer(address(this).balance); 15 | } 16 | } -------------------------------------------------------------------------------- /services/4byte/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2019", 4 | "module": "commonjs", 5 | "outDir": "dist", 6 | "rootDir": "src", 7 | "strict": true, 8 | "esModuleInterop": true, 9 | "resolveJsonModule": true, 10 | "declaration": true, 11 | "declarationMap": true, 12 | "sourceMap": true, 13 | "skipLibCheck": true 14 | }, 15 | "include": ["src/**/*.ts"], 16 | "exclude": ["node_modules", "dist"] 17 | } 18 | -------------------------------------------------------------------------------- /services/monitor/chains-dev.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Ethereum Testnet Sepolia", 4 | "title": "Ethereum Testnet Sepolia", 5 | "chainId": 11155111, 6 | "rpc": ["https://rpc2.sepolia.org"] 7 | }, 8 | { 9 | "name": "Ganache Localhost", 10 | "chainId": 1337, 11 | "rpc": ["http://localhost:8545"] 12 | }, 13 | { 14 | "name": "Hardhat Network Localhost", 15 | "chainId": 31337, 16 | "rpc": ["http://localhost:8545"] 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /services/server/src/common/errors/ConflictError.ts: -------------------------------------------------------------------------------- 1 | import { StatusCodes } from "http-status-codes"; 2 | import type { IResponseError } from "../interfaces"; 3 | 4 | export class ConflictError implements IResponseError { 5 | statusCode: number; 6 | message: string; 7 | 8 | constructor(message?: string) { 9 | this.statusCode = StatusCodes.CONFLICT; 10 | this.message = 11 | message || "Conflict between the request body vs. the server state"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/incrementer/Incrementer.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | contract Incrementer { 6 | uint256 public number; 7 | 8 | constructor(uint256 _initialNumber) { 9 | number = _initialNumber; 10 | } 11 | 12 | function increment(uint256 _value) public { 13 | number = number + _value; 14 | } 15 | 16 | function reset() public { 17 | number = 0; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/WithImmutables/sources/WithImmutables.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.7.0; 2 | 3 | contract WithImmutables { 4 | uint256 public immutable _a; 5 | 6 | string _name; 7 | 8 | constructor (uint256 a) { 9 | _a = a; 10 | } 11 | 12 | function sign(string memory name) public { 13 | _name = name; 14 | } 15 | 16 | function read() public view returns(string memory) { 17 | return _name; 18 | } 19 | } -------------------------------------------------------------------------------- /services/server/test/sources/compiler.json: -------------------------------------------------------------------------------- 1 | { 2 | "contracts": "*", 3 | "contractsDir": "../networks/sources/shared", 4 | "solcVersion": "0.7.4+commit.3f05b770", 5 | "compilerSettings": { 6 | "optimizer": { "enabled": false }, 7 | "outputSelection": { 8 | "*": { 9 | "*": [ 10 | "abi", 11 | "metadata", 12 | "evm.deployedBytecode.object", 13 | "evm.bytecode.object" 14 | ] 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /services/server/test/testcontracts/WithImmutables/sources/WithImmutables.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.7.0; 2 | 3 | contract WithImmutables { 4 | uint256 public immutable _a; 5 | 6 | string _name; 7 | 8 | constructor (uint256 a) { 9 | _a = a; 10 | } 11 | 12 | function sign(string memory name) public { 13 | _name = name; 14 | } 15 | 16 | function read() public view returns(string memory) { 17 | return _name; 18 | } 19 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/WithMultipleAuxdatas/sources/ERC721Token.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.8.9; 3 | 4 | contract ERC721Token { 5 | 6 | event awardNewItem(uint256 indexed newItemId); 7 | 8 | constructor(string memory name, string memory symbol) 9 | 10 | {} 11 | 12 | function awardItem(address player, string memory tokenURI) 13 | public 14 | returns (uint256) 15 | { 16 | return 1; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /services/monitor/.env.template: -------------------------------------------------------------------------------- 1 | # If you use any private RPCS 2 | DRPC_API_KEY= 3 | ALCHEMY_API_KEY= 4 | 5 | # ethpandaops.io authentication 6 | CF_ACCESS_CLIENT_ID= 7 | CF_ACCESS_CLIENT_SECRET= 8 | 9 | # Overrides the log level. Normally, if NODE_ENV production set to "info", otherwise "debug". Values can be silly, debug, info, warn, error 10 | NODE_LOG_LEVEL= 11 | # Port of the HTTP server to change the log level dynamically while the monitor is running 12 | NODE_LOG_LEVEL_SERVER_PORT=3333 13 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | import {IERC20} from './IERC20.sol'; 5 | 6 | interface IERC20Detailed is IERC20 { 7 | function name() external view returns (string memory); 8 | 9 | function symbol() external view returns (string memory); 10 | 11 | function decimals() external view returns (uint8); 12 | } 13 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/4216137055/SigmaToken.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; 5 | import "@openzeppelin/contracts/access/Ownable.sol"; 6 | 7 | contract SigmaToken is ERC20, Ownable { 8 | constructor( 9 | string memory _name, 10 | string memory _symbol, 11 | uint256 _totalSupply 12 | ) ERC20(_name, _symbol) { 13 | _mint(_msgSender(), _totalSupply); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/misc/interfaces/IWETH.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | interface IWETH { 5 | function deposit() external payable; 6 | 7 | function withdraw(uint256) external; 8 | 9 | function approve(address guy, uint256 wad) external returns (bool); 10 | 11 | function transferFrom( 12 | address src, 13 | address dst, 14 | uint256 wad 15 | ) external returns (bool); 16 | } 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/self-hosted-instance.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Add Self-Hosted Instance to sourcify.dev 3 | about: Request to add a self-hosted Sourcify instance to the sourcify.dev website 4 | title: "Add Self-Hosted Instance: [Instance Name]" 5 | labels: ["self-hosted-instance"] 6 | assignees: "" 7 | --- 8 | 9 | Hi. We are hosting a public Sourcify instance and would like to be listed on the sourcify.dev website. 10 | 11 | **Name:** [Instance Name] 12 | 13 | **Server URL:** [Instance URL] 14 | 15 | **Logo:** (please add logo) 16 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/interfaces/IERC20WithPermit.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol'; 5 | 6 | interface IERC20WithPermit is IERC20 { 7 | function permit( 8 | address owner, 9 | address spender, 10 | uint256 value, 11 | uint256 deadline, 12 | uint8 v, 13 | bytes32 r, 14 | bytes32 s 15 | ) external; 16 | } 17 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/288/Storage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.6.9; 4 | 5 | contract Storage { 6 | uint256 number; 7 | 8 | /** 9 | * @dev Store value in variable 10 | * @param num value to store 11 | */ 12 | function store(uint256 num) public { 13 | number = num; 14 | } 15 | 16 | /** 17 | * @dev Return value 18 | * @return value of 'number' 19 | */ 20 | function retrieve() public view returns (uint256) { 21 | return number; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/82/Storage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.6.9; 4 | 5 | contract Storage { 6 | uint256 number; 7 | 8 | /** 9 | * @dev Store value in variable 10 | * @param num value to store 11 | */ 12 | function store(uint256 num) public { 13 | number = num; 14 | } 15 | 16 | /** 17 | * @dev Return value 18 | * @return value of 'number' 19 | */ 20 | function retrieve() public view returns (uint256) { 21 | return number; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /services/server/test/sources/vyper/testcontract/test.vy: -------------------------------------------------------------------------------- 1 | # @version >=0.3.2 2 | 3 | # @notice Simple greeting contract 4 | 5 | # @notice Returns the string "Hello World!" 6 | # @notice The @external decorator means this function can only be called by external parties ie. by other contracts or by a wallet making a transaction 7 | # @notice The @view decorator means that this function can read the contract state but not alter it. Cannot consume gas. 8 | @external 9 | @view 10 | def helloWorld() -> String[24]: 11 | return "Hello World!" -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/Vyper/testcontract/test.vy: -------------------------------------------------------------------------------- 1 | # @version >=0.3.2 2 | 3 | # @notice Simple greeting contract 4 | 5 | # @notice Returns the string "Hello World!" 6 | # @notice The @external decorator means this function can only be called by external parties ie. by other contracts or by a wallet making a transaction 7 | # @notice The @view decorator means that this function can read the contract state but not alter it. Cannot consume gas. 8 | @external 9 | @view 10 | def helloWorld() -> String[24]: 11 | return "Hello World!" -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example/contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.4.25 <0.7.0; 3 | 4 | contract Migrations { 5 | address public owner; 6 | uint public last_completed_migration; 7 | 8 | modifier restricted() { 9 | if (msg.sender == owner) _; 10 | } 11 | 12 | constructor() public { 13 | owner = msg.sender; 14 | } 15 | 16 | function setCompleted(uint completed) public restricted { 17 | last_completed_migration = completed; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /services/server/test/sources/vyper/testcontract2/test.vy: -------------------------------------------------------------------------------- 1 | # @version >=0.3.2 2 | 3 | # @notice Simple greeting contract 4 | 5 | # @notice Returns the string "Hello Vyper!" 6 | # @notice The @external decorator means this function can only be called by external parties ie. by other contracts or by a wallet making a transaction 7 | # @notice The @view decorator means that this function can read the contract state but not alter it. Cannot consume gas. 8 | @external 9 | @view 10 | def helloWorld() -> String[24]: 11 | return "Hello Vyper!" 12 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/Vyper/testcontract2/test.vy: -------------------------------------------------------------------------------- 1 | # @version >=0.3.2 2 | 3 | # @notice Simple greeting contract 4 | 5 | # @notice Returns the string "Hello Vyper!" 6 | # @notice The @external decorator means this function can only be called by external parties ie. by other contracts or by a wallet making a transaction 7 | # @notice The @view decorator means that this function can read the contract state but not alter it. Cannot consume gas. 8 | @external 9 | @view 10 | def helloWorld() -> String[24]: 11 | return "Hello Vyper!" 12 | -------------------------------------------------------------------------------- /services/server/src/common/errors/ContractIsAlreadyBeingVerifiedError.ts: -------------------------------------------------------------------------------- 1 | import { StatusCodes } from "http-status-codes"; 2 | import type { IResponseError } from "../interfaces"; 3 | 4 | export class ContractIsAlreadyBeingVerifiedError implements IResponseError { 5 | statusCode: number; 6 | message: string; 7 | 8 | constructor(chainId: string, address: string) { 9 | this.statusCode = StatusCodes.TOO_MANY_REQUESTS; 10 | this.message = `The contract ${address} on chainId ${chainId} is already being verified, please wait`; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example-missing-source/contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.4.25 <0.7.0; 3 | 4 | contract Migrations { 5 | address public owner; 6 | uint public last_completed_migration; 7 | 8 | modifier restricted() { 9 | if (msg.sender == owner) _; 10 | } 11 | 12 | constructor() public { 13 | owner = msg.sender; 14 | } 15 | 16 | function setCompleted(uint completed) public restricted { 17 | last_completed_migration = completed; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /services/server/src/server/apiv1/verification/verify/stateless/verify.stateless.routes.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "express"; 2 | import { legacyVerifyEndpoint } from "./verify.stateless.handlers"; 3 | import { checkPerfectMatch } from "../../../controllers.common"; 4 | 5 | const router: Router = Router(); 6 | 7 | router.route("/verify").post(checkPerfectMatch, legacyVerifyEndpoint); 8 | 9 | export const deprecatedRoutesVerifyStateless = { 10 | "/": { 11 | method: "post", 12 | path: "/verify", 13 | }, 14 | }; 15 | 16 | export default router; 17 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/sources/IPriceOracleGetter.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | /** 5 | * @title IPriceOracleGetter interface 6 | * @notice Interface for the Aave price oracle. 7 | **/ 8 | 9 | interface IPriceOracleGetter { 10 | /** 11 | * @dev returns the asset price in ETH 12 | * @param asset the address of the asset 13 | * @return the ETH price of the asset 14 | **/ 15 | function getAssetPrice(address asset) external view returns (uint256); 16 | } 17 | -------------------------------------------------------------------------------- /services/server/test/sources/vyper/testcontract3_fail/test.vy: -------------------------------------------------------------------------------- 1 | # @version >=0.3.2 2 | 3 | # @notice Simple greeting contract 4 | 5 | # @notice Returns the string "Hello Vyper!" 6 | # @notice The @external decorator means this function can only be called by external parties ie. by other contracts or by a wallet making a transaction 7 | # @notice The @view decorator means that this function can read the contract state but not alter it. Cannot consume gas. 8 | @external 9 | @view 10 | def helloWorld() -> String[24]: 11 | error_in_the_code! 12 | return "Hello Vyper!" 13 | -------------------------------------------------------------------------------- /services/server/test/sources/all/Simple.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.6.0; 2 | 3 | /// @title A simple contract 4 | /// @author Mary A. Botanist 5 | /// @notice You can add one to a value. 6 | /// @dev For testing source-verify 7 | contract Simple { 8 | 9 | /// @author Mary A. Botanist 10 | /// @notice This function will add 1 to `_value` 11 | /// @param _value A number 12 | /// @dev For testing source-verify 13 | /// @return The number plus one 14 | function plusOne(uint _value) public pure returns (uint) { 15 | return _value + 1; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/mocks/upgradeability/MockAToken.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | import {AToken} from '../../protocol/tokenization/AToken.sol'; 5 | import {ILendingPool} from '../../interfaces/ILendingPool.sol'; 6 | import {IAaveIncentivesController} from '../../interfaces/IAaveIncentivesController.sol'; 7 | 8 | contract MockAToken is AToken { 9 | function getRevision() internal pure override returns (uint256) { 10 | return 0x2; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /services/server/src/server/services/storageServices/identifiers.ts: -------------------------------------------------------------------------------- 1 | export enum RWStorageIdentifiers { 2 | SourcifyDatabase = "SourcifyDatabase", 3 | RepositoryV1 = "RepositoryV1", 4 | } 5 | 6 | export enum WStorageIdentifiers { 7 | AllianceDatabase = "VerifierAllianceDatabase", 8 | RepositoryV2 = "RepositoryV2", 9 | S3Repository = "S3Repository", 10 | EtherscanVerify = "EtherscanVerify", 11 | BlockscoutVerify = "BlockscoutVerify", 12 | RoutescanVerify = "RoutescanVerify", 13 | } 14 | 15 | export type StorageIdentifiers = RWStorageIdentifiers | WStorageIdentifiers; 16 | -------------------------------------------------------------------------------- /services/server/test/sources/contracts/Simple.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.6.0; 2 | 3 | /// @title A simple contract 4 | /// @author Mary A. Botanist 5 | /// @notice You can add one to a value. 6 | /// @dev For testing source-verify 7 | contract Simple { 8 | 9 | /// @author Mary A. Botanist 10 | /// @notice This function will add 1 to `_value` 11 | /// @param _value A number 12 | /// @dev For testing source-verify 13 | /// @return The number plus one 14 | function plusOne(uint _value) public pure returns (uint) { 15 | return _value + 1; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /services/server/test/integration/apiv2/verification/compiler-versions/Storage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.1.0; 2 | 3 | // SPDX-License-Identifier: GPL-3.0 4 | 5 | contract Storage { 6 | uint256 number; 7 | 8 | /** 9 | * @dev Store value in variable 10 | * @param num value to store 11 | */ 12 | function store(uint256 num) public { 13 | number = num; 14 | } 15 | 16 | /** 17 | * @dev Return value 18 | * @return value of 'number' 19 | */ 20 | function retrieve() public returns (uint256) { 21 | return number; 22 | } 23 | } -------------------------------------------------------------------------------- /services/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowJs": true, 4 | "target": "es2017", 5 | "sourceMap": true, 6 | "esModuleInterop": true, 7 | "strict": true, 8 | "outDir": "dist", 9 | "rootDir": "src", 10 | "resolveJsonModule": true, 11 | "declaration": true, 12 | "declarationMap": true, 13 | "module": "commonjs", 14 | "paths": { 15 | "ethers": ["./node_modules/ethers"] 16 | }, 17 | "skipLibCheck": true 18 | }, 19 | "include": ["src/**/*.ts", "src/**/*.js"], 20 | "exclude": ["node_modules/**"] 21 | } 22 | -------------------------------------------------------------------------------- /services/server/src/server/services/compiler/local/VyperLocal.ts: -------------------------------------------------------------------------------- 1 | import type { 2 | IVyperCompiler, 3 | VyperJsonInput, 4 | VyperOutput, 5 | } from "@ethereum-sourcify/lib-sourcify"; 6 | import { useVyperCompiler } from "@ethereum-sourcify/compilers"; 7 | 8 | export class VyperLocal implements IVyperCompiler { 9 | constructor(private vyperRepoPath: string) {} 10 | 11 | async compile( 12 | version: string, 13 | vyperJsonInput: VyperJsonInput, 14 | ): Promise { 15 | return await useVyperCompiler(this.vyperRepoPath, version, vyperJsonInput); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /services/server/test/sources/all/Import.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.6.0; 2 | 3 | /// @title A simple contract 4 | /// @author Mary A. Botanist 5 | /// @notice You can subtract one from a value. 6 | /// @dev For testing source-verify 7 | contract Import { 8 | 9 | /// @author Mary A. Botanist 10 | /// @notice This function will subtract 1 from `_value` 11 | /// @dev For testing source-verify 12 | /// @param _value A number 13 | /// @return The number minus one 14 | function minusOne(uint _value) public pure returns (uint) { 15 | return _value - 1; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .DS_Store 3 | db/ 4 | node_modules/ 5 | mockRepository* 6 | test-s3/ 7 | server.log 8 | source-verify.dab 9 | dist/ 10 | **/.env 11 | **/.env-backup 12 | **/*.key 13 | stats** 14 | tmp 15 | metacoin-source-verify/ 16 | **/synced 17 | **/sort.log 18 | **/.env.secrets 19 | logs 20 | **/too_big.txt 21 | chain-tests-report/ 22 | coverage 23 | workspace/ 24 | .nx/workspace-data 25 | .nx/cache 26 | .nx/installation 27 | 28 | # Ignore the server local config file. See .nxignore 29 | **/config/local.js 30 | 31 | # Sourcify release script temporary file 32 | .release_package_data.tmp 33 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/6119/sources/contracts/ERC4906.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: CC0-1.0 2 | pragma solidity ^0.8.9; 3 | 4 | import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; 5 | import "@openzeppelin/contracts/interfaces/IERC4906.sol"; 6 | 7 | abstract contract ERC4906 is ERC165, IERC4906{ 8 | /// @dev See {IERC165-supportsInterface}. 9 | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { 10 | return interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId); 11 | } 12 | } -------------------------------------------------------------------------------- /services/server/test/sources/contracts/Import.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.6.0; 2 | 3 | /// @title A simple contract 4 | /// @author Mary A. Botanist 5 | /// @notice You can subtract one from a value. 6 | /// @dev For testing source-verify 7 | contract Import { 8 | 9 | /// @author Mary A. Botanist 10 | /// @notice This function will subtract 1 from `_value` 11 | /// @dev For testing source-verify 12 | /// @param _value A number 13 | /// @return The number minus one 14 | function minusOne(uint _value) public pure returns (uint) { 15 | return _value - 1; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /services/server/test/sources/contracts/Library.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.6.0; 2 | 3 | /// @title A simple library 4 | /// @author Alexandra A. Alexandria 5 | /// @notice You can add ten to a value. 6 | /// @dev For testing source-verify 7 | library Library { 8 | 9 | /// @author Alexandra A. Alexandria 10 | /// @notice This function will add 10 to `_value` 11 | /// @dev For testing source-verify 12 | /// @param _value A number 13 | /// @return The number plus 10 14 | function plusTen(uint _value) public pure returns (uint) { 15 | return _value + 1; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/CallProtectionForLibraries/artifact.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [], 3 | "bytecode": "0x60bd610039600b82828239805160001a60731461002c57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c8063fe073d11146038575b600080fd5b818015604357600080fd5b50604a604c565b005b60006057600182605b565b5050565b60ff8181168382160190811115608157634e487b7160e01b600052601160045260246000fd5b9291505056fea264697066735822122026efb28b74c882aa2f1f86cbe51d40fba727849fa6113630f5c12c98c1a9eb9b64736f6c63430008130033" 4 | } 5 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/interfaces/IPriceOracleGetter.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | /** 5 | * @title IPriceOracleGetter interface 6 | * @notice Interface for the Aave price oracle. 7 | **/ 8 | 9 | interface IPriceOracleGetter { 10 | /** 11 | * @dev returns the asset price in ETH 12 | * @param asset the address of the asset 13 | * @return the ETH price of the asset 14 | **/ 15 | function getAssetPrice(address asset) external view returns (uint256); 16 | } 17 | -------------------------------------------------------------------------------- /services/server/src/config/config-init.js: -------------------------------------------------------------------------------- 1 | // Since all imports are hoisted in ES6 and later it is not possible to set the env var in server.js and then import config. 2 | // process.env["NODE_CONFIG_DIR"] = path.resolve(__dirname, "..", "config"); 3 | // import config from "config"; 4 | // Effectively the import will run before env var setting. 5 | // As a workaround we set the env var in a separate file that is imported before config import. 6 | // See https://github.com/node-config/node-config/issues/402 7 | import path from "path"; 8 | 9 | process.env["NODE_CONFIG_DIR"] = path.resolve(__dirname); 10 | -------------------------------------------------------------------------------- /services/database/migrations/20250922140427_optimize_signature_search.sql: -------------------------------------------------------------------------------- 1 | -- migrate:up 2 | 3 | -- Enable pg_trgm extension for trigram text search 4 | CREATE EXTENSION IF NOT EXISTS pg_trgm; 5 | 6 | -- Add trigram GIN index for fast LIKE pattern matching on signature column 7 | -- This handles both exact matches and wildcard searches efficiently 8 | -- Note: Using LIKE (case-sensitive) not ILIKE 9 | CREATE INDEX signatures_signature_trgm_idx 10 | ON signatures USING GIN (signature gin_trgm_ops); 11 | 12 | -- migrate:down 13 | 14 | -- Remove the indexes 15 | DROP INDEX IF EXISTS signatures_signature_trgm_idx; -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/CBORInTheMiddleFactory/sources/@openzeppelin/contracts/proxy/beacon/IBeacon.sol: -------------------------------------------------------------------------------- 1 | { 2 | "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {UpgradeableBeacon} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" 3 | } -------------------------------------------------------------------------------- /services/server/test/chains/sources/5700/Token.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.2; 3 | 4 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; 5 | import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; 6 | import "@openzeppelin/contracts/access/Ownable.sol"; 7 | 8 | contract TestToken is ERC20, ERC20Burnable, Ownable { 9 | constructor() ERC20("FirstTestToken", "TEST") { 10 | _mint(msg.sender, 200000 * 10 ** decimals()); 11 | } 12 | 13 | function mint(address to, uint256 amount) public onlyOwner { 14 | _mint(to, amount); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /services/server/.env.test: -------------------------------------------------------------------------------- 1 | ### Test config 2 | # The server loads the usual `.env` file by default, as soon as the server is imported. 3 | # However, any variable set here, won't be overriden by default. 4 | 5 | # allow to mutate node-config variables 6 | ALLOW_CONFIG_MUTATIONS=true 7 | NODE_CONFIG_ENV=test 8 | NODE_CONFIG_DIR=./src/config 9 | IPFS_GATEWAY=http://ipfs-mock/ipfs/ 10 | # instantiated http-gateway takes a little longer 11 | ALLIANCE_POSTGRES_HOST= 12 | 13 | SOURCIFY_POSTGRES_HOST="localhost" 14 | SOURCIFY_POSTGRES_DB="sourcify" 15 | SOURCIFY_POSTGRES_USER="sourcify" 16 | SOURCIFY_POSTGRES_PASSWORD="sourcify" 17 | -------------------------------------------------------------------------------- /services/server/test/testcontracts/1_Storage/1_Storage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.22 <0.7.0; 2 | 3 | /** 4 | * @title Storage 5 | * @dev Store & retreive value in a variable 6 | */ 7 | contract Storage { 8 | 9 | uint256 number; 10 | 11 | /** 12 | * @dev Store value in variable 13 | * @param num value to store 14 | */ 15 | function store(uint256 num) public { 16 | number = num; 17 | } 18 | 19 | /** 20 | * @dev Return value 21 | * @return value of 'number' 22 | */ 23 | function retreive() public view returns (uint256){ 24 | return number; 25 | } 26 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/single/1_Storage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.22 <0.7.0; 2 | 3 | /** 4 | * @title Storage 5 | * @dev Store & retreive value in a variable 6 | */ 7 | contract Storage { 8 | 9 | uint256 number; 10 | 11 | /** 12 | * @dev Store value in variable 13 | * @param num value to store 14 | */ 15 | function store(uint256 num) public { 16 | number = num; 17 | } 18 | 19 | /** 20 | * @dev Return value 21 | * @return value of 'number' 22 | */ 23 | function retreive() public view returns (uint256){ 24 | return number; 25 | } 26 | } -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/release.md: -------------------------------------------------------------------------------- 1 | # Release 2 | 3 | ## Changes 4 | 5 | 6 | 7 | - New supported chains: 8 | - X Chain (43) 9 | - Chainname (chainId) 10 | 11 | 12 | 13 | - Fix: ... 14 | - 15 | ... 16 | 17 | ## Checklist 18 | 19 | 20 | 21 | - [ ] I have bumped the versions of the packages under `packages/`, if necessary 22 | - [ ] `lib-sourcify` 23 | - [ ] `bytecode-utils` 24 | - [ ] All tests are passing 25 | -------------------------------------------------------------------------------- /services/server/src/server/apiv1/verification/verify/session/verify.session.routes.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "express"; 2 | import { verifyContractsInSessionEndpoint } from "./verify.session.handlers"; 3 | 4 | const router: Router = Router(); 5 | 6 | router.route("/session/verify-checked").post(verifyContractsInSessionEndpoint); 7 | 8 | export const deprecatedRoutesVerifySession = { 9 | "/session/verify-validated": { 10 | method: "post", 11 | path: "/session/verify-checked", 12 | }, 13 | "/verify-validated": { 14 | method: "post", 15 | path: "/session/verify-checked", 16 | }, 17 | }; 18 | 19 | export default router; 20 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/57/sources/project/contracts/Token.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.2; 3 | 4 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; 5 | import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; 6 | import "@openzeppelin/contracts/access/Ownable.sol"; 7 | 8 | contract TestToken is ERC20, ERC20Burnable, Ownable { 9 | constructor() ERC20("FirstTestToken", "TEST") { 10 | _mint(msg.sender, 200000 * 10 ** decimals()); 11 | } 12 | 13 | function mint(address to, uint256 amount) public onlyOwner { 14 | _mint(to, amount); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/single-add-trailing-n/1_Storage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.22 <0.7.0; 2 | 3 | /** 4 | * @title Storage 5 | * @dev Store & retreive value in a variable 6 | */ 7 | contract Storage { 8 | 9 | uint256 number; 10 | 11 | /** 12 | * @dev Store value in variable 13 | * @param num value to store 14 | */ 15 | function store(uint256 num) public { 16 | number = num; 17 | } 18 | 19 | /** 20 | * @dev Return value 21 | * @return value of 'number' 22 | */ 23 | function retreive() public view returns (uint256){ 24 | return number; 25 | } 26 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/single-replace-with-rn/1_Storage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.22 <0.7.0; 2 | 3 | /** 4 | * @title Storage 5 | * @dev Store & retreive value in a variable 6 | */ 7 | contract Storage { 8 | 9 | uint256 number; 10 | 11 | /** 12 | * @dev Store value in variable 13 | * @param num value to store 14 | */ 15 | function store(uint256 num) public { 16 | number = num; 17 | } 18 | 19 | /** 20 | * @dev Return value 21 | * @return value of 'number' 22 | */ 23 | function retreive() public view returns (uint256){ 24 | return number; 25 | } 26 | } -------------------------------------------------------------------------------- /services/server/src/extra-chains.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Tempo Testnet", 4 | "title": "Tempo Testnet (Andantino)", 5 | "chain": "USD", 6 | "rpc": ["https://rpc.testnet.tempo.xyz"], 7 | "faucets": [], 8 | "nativeCurrency": { "name": "Tempo USD", "symbol": "USD", "decimals": 18 }, 9 | "infoURL": "https://tempo.xyz/", 10 | "shortName": "tmp", 11 | "chainId": 42429, 12 | "networkId": 42429, 13 | "icon": "tempo", 14 | "explorers": [ 15 | { 16 | "name": "explorer-tempo", 17 | "url": "https://scout.tempo.xyz/", 18 | "standard": "EIP3091" 19 | } 20 | ] 21 | } 22 | ] 23 | -------------------------------------------------------------------------------- /services/server/test/sources/all/SimpleWithImport.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.6.0; 2 | 3 | import "./Import.sol"; 4 | 5 | /// @title A simple contract 6 | /// @author Mary A. Botanist 7 | /// @notice You can add one to a value, or subtract one. 8 | /// @dev For testing source-verify 9 | contract SimpleWithImport is Import { 10 | 11 | /// @author Mary A. Botanist 12 | /// @notice This function will add 1 to `_value` 13 | /// @dev For testing source-verify 14 | /// @param _value A number 15 | /// @return The number plus one 16 | function plusOne(uint _value) public pure returns (uint) { 17 | return _value + 1; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/single-keep-original/1_Storage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.22 <0.7.0; 2 | 3 | /** 4 | * @title Storage 5 | * @dev Store & retrieve value in a variable 6 | */ 7 | contract Storage { 8 | 9 | uint256 number; 10 | 11 | /** 12 | * @dev Store value in variable 13 | * @param num value to store 14 | */ 15 | function store(uint256 num) public { 16 | number = num; 17 | } 18 | 19 | /** 20 | * @dev Return value 21 | * @return value of 'number' 22 | */ 23 | function retrieve() public view returns (uint256){ 24 | return number; 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/single-remove-trailing-n/1_Storage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.22 <0.7.0; 2 | 3 | /** 4 | * @title Storage 5 | * @dev Store & retreive value in a variable 6 | */ 7 | contract Storage { 8 | 9 | uint256 number; 10 | 11 | /** 12 | * @dev Store value in variable 13 | * @param num value to store 14 | */ 15 | function store(uint256 num) public { 16 | number = num; 17 | } 18 | 19 | /** 20 | * @dev Return value 21 | * @return value of 'number' 22 | */ 23 | function retreive() public view returns (uint256){ 24 | return number; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/25/storage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | /** 6 | * @title Storage 7 | * @dev Store & retrieve value in a variable 8 | */ 9 | contract Storage { 10 | 11 | uint256 number; 12 | 13 | /** 14 | * @dev Store value in variable 15 | * @param num value to store 16 | */ 17 | function store(uint256 num) public { 18 | number = num; 19 | } 20 | 21 | /** 22 | * @dev Return value 23 | * @return value of 'number' 24 | */ 25 | function retrieve() public view returns (uint256){ 26 | return number; 27 | } 28 | } -------------------------------------------------------------------------------- /services/server/test/sources/contracts/SimpleWithImport.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.6.0; 2 | 3 | import "./Import.sol"; 4 | 5 | /// @title A simple contract 6 | /// @author Mary A. Botanist 7 | /// @notice You can add one to a value, or subtract one. 8 | /// @dev For testing source-verify 9 | contract SimpleWithImport is Import { 10 | 11 | /// @author Mary A. Botanist 12 | /// @notice This function will add 1 to `_value` 13 | /// @dev For testing source-verify 14 | /// @param _value A number 15 | /// @return The number plus one 16 | function plusOne(uint _value) public pure returns (uint) { 17 | return _value + 1; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/252/Storage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | /** 6 | * @title Storage 7 | * @dev Store & retrieve value in a variable 8 | */ 9 | contract Storage { 10 | uint256 number; 11 | 12 | /** 13 | * @dev Store value in variable 14 | * @param num value to store 15 | */ 16 | function store(uint256 num) public { 17 | number = num; 18 | } 19 | 20 | /** 21 | * @dev Return value 22 | * @return value of 'number' 23 | */ 24 | function retrieve() public view returns (uint256) { 25 | return number; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /services/server/test/sources/vyper/testcontract/artifact.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [ 3 | { 4 | "stateMutability": "view", 5 | "type": "function", 6 | "name": "helloWorld", 7 | "inputs": [], 8 | "outputs": [{ "name": "", "type": "string" }] 9 | } 10 | ], 11 | "bytecode": "0x61008f61000f60003961008f6000f360003560e01c63c605f76c8118610084573461008a57602080608052600c6040527f48656c6c6f20576f726c6421000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506080f35b60006000fd5b600080fd84188f8000a16576797065728300030a0012" 12 | } 13 | -------------------------------------------------------------------------------- /services/server/test/sources/vyper/testcontract2/artifact.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [ 3 | { 4 | "stateMutability": "view", 5 | "type": "function", 6 | "name": "helloWorld", 7 | "inputs": [], 8 | "outputs": [{ "name": "", "type": "string" }] 9 | } 10 | ], 11 | "bytecode": "0x61008f61000f60003961008f6000f360003560e01c63c605f76c8118610084573461008a57602080608052600c6040527f48656c6c6f20567970657221000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506080f35b60006000fd5b600080fd84188f8000a16576797065728300030a0012" 12 | } 13 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/Vyper/testcontract/artifact.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [ 3 | { 4 | "stateMutability": "view", 5 | "type": "function", 6 | "name": "helloWorld", 7 | "inputs": [], 8 | "outputs": [{ "name": "", "type": "string" }] 9 | } 10 | ], 11 | "bytecode": "0x61008f61000f60003961008f6000f360003560e01c63c605f76c8118610084573461008a57602080608052600c6040527f48656c6c6f20576f726c6421000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506080f35b60006000fd5b600080fd84188f8000a16576797065728300030a0012" 12 | } 13 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/Vyper/testcontract2/artifact.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [ 3 | { 4 | "stateMutability": "view", 5 | "type": "function", 6 | "name": "helloWorld", 7 | "inputs": [], 8 | "outputs": [{ "name": "", "type": "string" }] 9 | } 10 | ], 11 | "bytecode": "0x61008f61000f60003961008f6000f360003560e01c63c605f76c8118610084573461008a57602080608052600c6040527f48656c6c6f20567970657221000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506080f35b60006000fd5b600080fd84188f8000a16576797065728300030a0012" 12 | } 13 | -------------------------------------------------------------------------------- /services/monitor/test/sources/Storage/1_Storage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | /** 6 | * @title Storage 7 | * @dev Store & retrieve value in a variable 8 | */ 9 | contract Storage { 10 | 11 | uint256 number; 12 | 13 | /** 14 | * @dev Store value in variable 15 | * @param num value to store 16 | */ 17 | function store(uint256 num) public { 18 | number = num; 19 | } 20 | 21 | /** 22 | * @dev Return value 23 | * @return value of 'number' 24 | */ 25 | function retrieve() public view returns (uint256){ 26 | return number; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /services/server/test/sources/vyper/testcontract3_fail/artifact.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [ 3 | { 4 | "stateMutability": "view", 5 | "type": "function", 6 | "name": "helloWorld", 7 | "inputs": [], 8 | "outputs": [{ "name": "", "type": "string" }] 9 | } 10 | ], 11 | "bytecode": "0x61008f61000f60003961008f6000f360003560e01c63c605f76c8118610084573461008a57602080608052600c6040527f48656c6c6f20567970657221000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506080f35b60006000fd5b600080fd84188f8000a16576797065728300030a0012" 12 | } 13 | -------------------------------------------------------------------------------- /services/server/test/testcontracts/Storage/Storage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | /** 6 | * @title Storage 7 | * @dev Store & retrieve value in a variable 8 | */ 9 | contract Storage { 10 | 11 | uint256 number; 12 | 13 | /** 14 | * @dev Store value in variable 15 | * @param num value to store 16 | */ 17 | function store(uint256 num) public { 18 | number = num; 19 | } 20 | 21 | /** 22 | * @dev Return value 23 | * @return value of 'number' 24 | */ 25 | function retrieve() public view returns (uint256){ 26 | return number; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: "@typescript-eslint/parser", 4 | plugins: ["@typescript-eslint"], 5 | extends: [ 6 | "eslint:recommended", 7 | "plugin:@typescript-eslint/recommended", 8 | "prettier", 9 | ], 10 | ignorePatterns: ["**/node_modules/", "**/build/", "**/dist/"], 11 | rules: { 12 | "@typescript-eslint/ban-types": "off", 13 | "@typescript-eslint/no-explicit-any": "off", 14 | "@typescript-eslint/no-unused-vars": ["warn"], 15 | "@typescript-eslint/ban-ts-comment": "off", 16 | "@typescript-eslint/consistent-type-imports": "error", 17 | }, 18 | env: { 19 | node: true, 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/single-add-trailing-rn/1_Storage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.22 <0.7.0; 2 | 3 | /** 4 | * @title Storage 5 | * @dev Store & retreive value in a variable 6 | */ 7 | contract Storage { 8 | 9 | uint256 number; 10 | 11 | /** 12 | * @dev Store value in variable 13 | * @param num value to store 14 | */ 15 | function store(uint256 num) public { 16 | number = num; 17 | } 18 | 19 | /** 20 | * @dev Return value 21 | * @return value of 'number' 22 | */ 23 | function retreive() public view returns (uint256){ 24 | return number; 25 | } 26 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/single-replace-with-n/1_Storage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.22 <0.7.0; 2 | 3 | /** 4 | * @title Storage 5 | * @dev Store & retreive value in a variable 6 | */ 7 | contract Storage { 8 | 9 | uint256 number; 10 | 11 | /** 12 | * @dev Store value in variable 13 | * @param num value to store 14 | */ 15 | function store(uint256 num) public { 16 | number = num; 17 | } 18 | 19 | /** 20 | * @dev Return value 21 | * @return value of 'number' 22 | */ 23 | function retreive() public view returns (uint256){ 24 | return number; 25 | } 26 | } -------------------------------------------------------------------------------- /services/server/test/chains/sources/shared/1_Storage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | /** 6 | * @title Storage 7 | * @dev Store & retrieve value in a variable 8 | */ 9 | contract Storage { 10 | 11 | uint256 number; 12 | 13 | /** 14 | * @dev Store value in variable 15 | * @param num value to store 16 | */ 17 | function store(uint256 num) public { 18 | number = num; 19 | } 20 | 21 | /** 22 | * @dev Return value 23 | * @return value of 'number' 24 | */ 25 | function retrieve() public view returns (uint256){ 26 | return number; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/Storage/sources/Storage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | /** 6 | * @title Storage 7 | * @dev Store & retrieve value in a variable 8 | */ 9 | contract Storage { 10 | 11 | uint256 number; 12 | 13 | /** 14 | * @dev Store value in variable 15 | * @param num value to store 16 | */ 17 | function store(uint256 num) public { 18 | number = num; 19 | } 20 | 21 | /** 22 | * @dev Return value 23 | * @return value of 'number' 24 | */ 25 | function retrieve() public view returns (uint256){ 26 | return number; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/Vyper/testcontract/wrongAuxdata/artifact.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [ 3 | { 4 | "stateMutability": "view", 5 | "type": "function", 6 | "name": "helloWorld", 7 | "inputs": [], 8 | "outputs": [{ "name": "", "type": "string" }] 9 | } 10 | ], 11 | "bytecode": "0x61008f61000f60003961008f6000f360003560e01c63c605f76c8118610084573461008a57602080608052600c6040527f48656c6c6f20576f726c6421000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506080f35b60006000fd5b600080fd84188f8000a1657679706572830003090012" 12 | } 13 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/StorageInliner/sources/Storage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | /** 6 | * @title Storage 7 | * @dev Store & retrieve value in a variable 8 | */ 9 | contract Storage { 10 | 11 | uint256 number; 12 | 13 | /** 14 | * @dev Store value in variable 15 | * @param num value to store 16 | */ 17 | function store(uint256 num) public { 18 | number = num; 19 | } 20 | 21 | /** 22 | * @dev Return value 23 | * @return value of 'number' 24 | */ 25 | function retrieve() public view returns (uint256){ 26 | return number; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/StorageViaIR/sources/Storage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | /** 6 | * @title Storage 7 | * @dev Store & retrieve value in a variable 8 | */ 9 | contract Storage { 10 | 11 | uint256 number; 12 | 13 | /** 14 | * @dev Store value in variable 15 | * @param num value to store 16 | */ 17 | function store(uint256 num) public { 18 | number = num; 19 | } 20 | 21 | /** 22 | * @dev Return value 23 | * @return value of 'number' 24 | */ 25 | function retrieve() public view returns (uint256){ 26 | return number; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/single-remove-trailing-rn/1_Storage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.22 <0.7.0; 2 | 3 | /** 4 | * @title Storage 5 | * @dev Store & retreive value in a variable 6 | */ 7 | contract Storage { 8 | 9 | uint256 number; 10 | 11 | /** 12 | * @dev Store value in variable 13 | * @param num value to store 14 | */ 15 | function store(uint256 num) public { 16 | number = num; 17 | } 18 | 19 | /** 20 | * @dev Return value 21 | * @return value of 'number' 22 | */ 23 | function retreive() public view returns (uint256){ 24 | return number; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example/truffle-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // Uncommenting the defaults below 3 | // provides for an easier quick-start with Ganache. 4 | // You can also follow this format for other networks; 5 | // see 6 | // for more details on how to specify configuration options! 7 | // 8 | //networks: { 9 | // development: { 10 | // host: "127.0.0.1", 11 | // port: 7545, 12 | // network_id: "*" 13 | // }, 14 | // test: { 15 | // host: "127.0.0.1", 16 | // port: 7545, 17 | // network_id: "*" 18 | // } 19 | //} 20 | // 21 | }; 22 | -------------------------------------------------------------------------------- /services/server/test/mocks/ipfs/QmaFRC9ZtT7y3t9XNWCbDuMTEwKkyaQJzYFzw3NbeohSn5: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | /** 6 | * @title Storage 7 | * @dev Store & retrieve value in a variable 8 | */ 9 | contract Storage { 10 | 11 | uint256 number; 12 | 13 | /** 14 | * @dev Store value in variable 15 | * @param num value to store 16 | */ 17 | function store(uint256 num) public { 18 | number = num; 19 | } 20 | 21 | /** 22 | * @dev Return value 23 | * @return value of 'number' 24 | */ 25 | function retrieve() public view returns (uint256){ 26 | return number; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /services/server/Dockerfile.debug: -------------------------------------------------------------------------------- 1 | # Runs the server in a linux/amd64 container with debug port exposed 2 | # Used in debugging solidity linux-amd64 binary executables on MacOS 3 | 4 | # From project root: docker build --platform=linux/amd64 --file ./services/server/Dockerfile.debug -t sourcify-server-debug ./services/server 5 | # Assuming server is running on port 5555 6 | # Run with: docker run -it -p 9229:9229 -p 5555:5555 --volume /path/to/local/sourcify/git/repo:/home/app sourcify-server-debug 7 | # Finally run "Docker: Attach to Server" in VSCode debugger 8 | FROM node:22.5.1-bookworm 9 | WORKDIR /home/app/services/server 10 | 11 | CMD ["node", "--inspect=0.0.0.0:9229", "./dist/server/cli.js"] 12 | -------------------------------------------------------------------------------- /packages/compilers/src/lib/compilerWorker.ts: -------------------------------------------------------------------------------- 1 | import { workerData, parentPort } from 'worker_threads'; 2 | import { getSolcJs } from './solidityCompiler'; 3 | 4 | async function runUseCompiler( 5 | solJsonRepoPath: string, 6 | version: string, 7 | inputStringified: string, 8 | ) { 9 | const solJson = await getSolcJs(solJsonRepoPath, version); 10 | const result = solJson.compile(inputStringified); 11 | if (parentPort === null) { 12 | throw new Error('Parent port is null; cannot send compilation result'); 13 | } 14 | parentPort.postMessage(result); 15 | } 16 | 17 | runUseCompiler( 18 | workerData.solJsonRepoPath, 19 | workerData.version, 20 | workerData.inputStringified, 21 | ); 22 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example-missing-source/truffle-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // Uncommenting the defaults below 3 | // provides for an easier quick-start with Ganache. 4 | // You can also follow this format for other networks; 5 | // see 6 | // for more details on how to specify configuration options! 7 | // 8 | //networks: { 9 | // development: { 10 | // host: "127.0.0.1", 11 | // port: 7545, 12 | // network_id: "*" 13 | // }, 14 | // test: { 15 | // host: "127.0.0.1", 16 | // port: 7545, 17 | // network_id: "*" 18 | // } 19 | //} 20 | // 21 | }; 22 | -------------------------------------------------------------------------------- /services/server/test/global-mocks.ts: -------------------------------------------------------------------------------- 1 | import { S3Client } from "@aws-sdk/client-s3"; 2 | import S3ClientMock, { testS3Bucket, testS3Path } from "./helpers/S3ClientMock"; 3 | import sinon from "sinon"; 4 | import fs from "fs"; 5 | import path from "path"; 6 | 7 | // Stub the S3Client class 8 | const s3Clientstub = sinon.stub(S3Client); 9 | s3Clientstub.prototype.send = function (command) { 10 | return new S3ClientMock(testS3Path, testS3Bucket).send(command); 11 | }; 12 | 13 | // Create test S3 directory if it doesn't exist 14 | try { 15 | fs.accessSync(path.join(testS3Path, testS3Bucket)); 16 | } catch { 17 | fs.mkdirSync(path.join(testS3Path, testS3Bucket), { 18 | recursive: true, 19 | }); 20 | } 21 | -------------------------------------------------------------------------------- /services/monitor/test/testLogger.ts: -------------------------------------------------------------------------------- 1 | import { createLogger, transports, format } from "winston"; 2 | 3 | export const logger = createLogger(); 4 | 5 | // Define the ANSI code for magenta text 6 | const magenta = "\x1b[35m"; 7 | 8 | // Reset color 9 | const reset = "\x1b[0m"; 10 | 11 | const myFormat = format.printf((info) => { 12 | return `${info.timestamp} ${magenta}[TEST]${reset} ${info.level}: ${ 13 | info.prefix ? `[${info.prefix}] -` : "" 14 | } ${info.message}`; 15 | }); 16 | 17 | logger.add( 18 | new transports.Console({ 19 | format: format.combine( 20 | format.colorize(), 21 | format.timestamp(), 22 | format.errors({ stack: true }), 23 | myFormat, 24 | ), 25 | }), 26 | ); 27 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/single-altered/1_Storage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.22 <0.7.0; 2 | 3 | /** 4 | * @title Storage 5 | * @dev Store & retreive value in a variable 6 | */ 7 | contract Storage { 8 | 9 | uint256 number; 10 | 11 | /** 12 | * @dev Store value in variable 13 | * @param num value to store 14 | */ 15 | function store(uint256 num) public { 16 | // SOME EVIL PREPROCESSING THAT WILL EFFECTIVELY ALTER THE OFFICIAL HASH VALUE 17 | number = num; 18 | } 19 | 20 | /** 21 | * @dev Return value 22 | * @return value of 'number' 23 | */ 24 | function retreive() public view returns (uint256){ 25 | return number; 26 | } 27 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/single-altered-metadata/1_Storage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.22 <0.7.0; 2 | 3 | /** 4 | * @title Storage 5 | * @dev Store & retreive value in a variable 6 | */ 7 | contract Storage { 8 | 9 | uint256 number; 10 | 11 | /** 12 | * @dev Store value in variable 13 | * @param num value to store 14 | */ 15 | function store(uint256 num) public { 16 | // SOME EVIL PREPROCESSING THAT WILL EFFECTIVELY ALTER THE OFFICIAL HASH VALUE 17 | number = num; 18 | } 19 | 20 | /** 21 | * @dev Return value 22 | * @return value of 'number' 23 | */ 24 | function retreive() public view returns (uint256){ 25 | return number; 26 | } 27 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/interfaces/IExchangeAdapter.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol'; 5 | 6 | interface IExchangeAdapter { 7 | event Exchange( 8 | address indexed from, 9 | address indexed to, 10 | address indexed platform, 11 | uint256 fromAmount, 12 | uint256 toAmount 13 | ); 14 | 15 | function approveExchange(IERC20[] calldata tokens) external; 16 | 17 | function exchange( 18 | address from, 19 | address to, 20 | uint256 amount, 21 | uint256 maxSlippage 22 | ) external returns (uint256); 23 | } 24 | -------------------------------------------------------------------------------- /services/monitor/src/defaultConfig.js: -------------------------------------------------------------------------------- 1 | const defaultConfig = { 2 | decentralizedStorages: { 3 | ipfs: { 4 | enabled: true, 5 | gateways: ["https://ipfs.io/ipfs/"], 6 | timeout: 30000, 7 | interval: 5000, 8 | retries: 5, 9 | }, 10 | }, 11 | sourcifyServerURLs: ["https://sourcify.dev/server/"], 12 | sourcifyRequestOptions: { 13 | maxRetries: 3, 14 | retryDelay: 30000, 15 | }, 16 | defaultChainConfig: { 17 | startBlock: undefined, 18 | blockInterval: 10000, 19 | blockIntervalFactor: 1.1, 20 | blockIntervalUpperLimit: 300000, 21 | blockIntervalLowerLimit: 25, 22 | bytecodeInterval: 5000, 23 | bytecodeNumberOfTries: 5, 24 | }, 25 | }; 26 | 27 | export default defaultConfig; 28 | -------------------------------------------------------------------------------- /scripts/partial_matches_cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script is used to remove partial matches for contracts that have been fully verified 4 | 5 | REPO_PATH="repository/contracts" 6 | 7 | chains_to_check=( `ls ${REPO_PATH}/partial_match` ) 8 | 9 | for chain in "${chains_to_check[@]}" 10 | do 11 | echo "Checking partial matches for chainID: ${chain}" 12 | contracts_to_check=( `ls ${REPO_PATH}/partial_match/${chain}` ) 13 | for contract in "${contracts_to_check[@]}" 14 | do 15 | if [ -d "${REPO_PATH}/full_match/${chain}/${contract}" ]; then 16 | echo "Removing partial match for ${contract} on chainID ${chain}" 17 | rm -rf "${REPO_PATH}/partial_match/${chain}/${contract}" 18 | fi 19 | done 20 | done 21 | -------------------------------------------------------------------------------- /services/server/test/testcontracts/LibrariesLinkedManually/1_Storage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | library Journal { 6 | function record(mapping(uint256 => uint256) storage journal, uint256 num) public { 7 | journal[block.number] = num; 8 | } 9 | } 10 | 11 | /** 12 | * @title Storage 13 | * @dev Store & retrieve value in a variable 14 | */ 15 | contract Storage { 16 | uint256 public number; 17 | 18 | mapping(uint256 => uint256) public journal; 19 | 20 | /** 21 | * @dev Store value in variable 22 | * @param num value to store 23 | */ 24 | function store(uint256 num) public { 25 | number = num; 26 | Journal.record(journal, num); 27 | } 28 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ViaIRUnoptimizedMismatch/metadata.json: -------------------------------------------------------------------------------- 1 | {"compiler":{"version":"0.8.20+commit.a1b79de6"},"language":"Solidity","output":{"abi":[{"inputs":[],"name":"f2","outputs":[],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"A":"C"},"evmVersion":"shanghai","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[],"viaIR":true},"sources":{"A":{"keccak256":"0xd679cd539599ca78bc3821e0db8a70e100f0b7f7dcdb3c99b428c49a1d6ebe69","urls":["bzz-raw://36a9f5a039c61d73850e994d18cf204b6c292f415cfe6c69962f9aeb2078de05","dweb:/ipfs/QmXTHUdb47N3kh41uEVYvinz19oH4n8CKVhwduWviyJF7T"]}},"version":1} -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "configMigration": true, 4 | "extends": ["config:recommended", "schedule:daily"], 5 | "packageRules": [ 6 | { 7 | "matchUpdateTypes": [ 8 | "minor", 9 | "patch", 10 | "pin", 11 | "digest", 12 | "lockFileMaintenance", 13 | "rollback", 14 | "bump" 15 | ], 16 | "groupName": "all patch and minor dependencies", 17 | "groupSlug": "all-patch-and-minor" 18 | } 19 | ], 20 | "ignoreDeps": ["node", "cimg/node"], 21 | "major": { 22 | "dependencyDashboardApproval": true 23 | }, 24 | "rangeStrategy": "pin", 25 | "timezone": "Europe/Berlin", 26 | "schedule": ["before 6am on tuesday"] 27 | } 28 | -------------------------------------------------------------------------------- /services/server/src/config/local-test.js: -------------------------------------------------------------------------------- 1 | const { 2 | WStorageIdentifiers, 3 | RWStorageIdentifiers, 4 | } = require("../server/services/storageServices/identifiers"); 5 | 6 | module.exports = { 7 | verifyDeprecated: true, 8 | repositoryV1: { 9 | path: "/tmp/repositoryV1-test/", 10 | }, 11 | repositoryV2: { 12 | path: "/tmp/repositoryV2-test/", 13 | }, 14 | session: { 15 | storeType: "database", 16 | }, 17 | storage: { 18 | read: RWStorageIdentifiers.SourcifyDatabase, 19 | writeOrWarn: [ 20 | RWStorageIdentifiers.RepositoryV1, 21 | WStorageIdentifiers.S3Repository, 22 | ], 23 | writeOrErr: [ 24 | WStorageIdentifiers.RepositoryV2, 25 | RWStorageIdentifiers.SourcifyDatabase, 26 | ], 27 | }, 28 | }; 29 | -------------------------------------------------------------------------------- /services/server/test/testcontracts/FactoryImmutable/FactoryTest.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity 0.8.17; 3 | 4 | contract Factory { 5 | address[] public childAddresses; 6 | event Deployment(address contractAddress); 7 | 8 | function deploy( 9 | uint _foo 10 | ) public { 11 | address deployedAddress = address(new TestContract(_foo)); 12 | emit Deployment(deployedAddress); 13 | childAddresses.push(deployedAddress); 14 | } 15 | } 16 | 17 | contract TestContract { 18 | uint public immutable foo; 19 | 20 | constructor(uint _foo) payable { 21 | foo = _foo; 22 | } 23 | 24 | function getFoo() public view returns (uint) { 25 | return foo; 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /services/server/test/testcontracts/Storage/StorageModified.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | // This line + changed contrract name will cause a partial match to the deployed contract. 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | /** 6 | * @title Storage 7 | * @dev Store & retrieve value in a variable 8 | */ 9 | contract StorageModified { 10 | 11 | uint256 number; 12 | 13 | /** 14 | * @dev Store value in variable 15 | * @param num value to store 16 | */ 17 | function store(uint256 num) public { 18 | number = num; 19 | } 20 | 21 | /** 22 | * @dev Return value 23 | * @return value of 'number' 24 | */ 25 | function retrieve() public view returns (uint256){ 26 | return number; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/interfaces/IChainlinkAggregator.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | interface IChainlinkAggregator { 5 | function latestAnswer() external view returns (int256); 6 | 7 | function latestTimestamp() external view returns (uint256); 8 | 9 | function latestRound() external view returns (uint256); 10 | 11 | function getAnswer(uint256 roundId) external view returns (int256); 12 | 13 | function getTimestamp(uint256 roundId) external view returns (uint256); 14 | 15 | event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp); 16 | event NewRound(uint256 indexed roundId, address indexed startedBy); 17 | } 18 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/FactoryImmutable/Child/sources/FactoryTest.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity 0.8.17; 3 | 4 | contract Factory { 5 | address[] public childAddresses; 6 | event Deployment(address contractAddress); 7 | 8 | function deploy( 9 | uint _foo 10 | ) public { 11 | address deployedAddress = address(new TestContract(_foo)); 12 | emit Deployment(deployedAddress); 13 | childAddresses.push(deployedAddress); 14 | } 15 | } 16 | 17 | contract TestContract { 18 | uint public immutable foo; 19 | 20 | constructor(uint _foo) payable { 21 | foo = _foo; 22 | } 23 | 24 | function getFoo() public view returns (uint) { 25 | return foo; 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/FactoryImmutable/Factory/sources/FactoryTest.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity 0.8.17; 3 | 4 | contract Factory { 5 | address[] public childAddresses; 6 | event Deployment(address contractAddress); 7 | 8 | function deploy( 9 | uint _foo 10 | ) public { 11 | address deployedAddress = address(new TestContract(_foo)); 12 | emit Deployment(deployedAddress); 13 | childAddresses.push(deployedAddress); 14 | } 15 | } 16 | 17 | contract TestContract { 18 | uint public immutable foo; 19 | 20 | constructor(uint _foo) payable { 21 | foo = _foo; 22 | } 23 | 24 | function getFoo() public view returns (uint) { 25 | return foo; 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/StorageModified/sources/StorageModified.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | // This line + changed contract name will cause a partial match to the deployed contract. 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | /** 6 | * @title Storage 7 | * @dev Store & retrieve value in a variable 8 | */ 9 | contract StorageModified { 10 | 11 | uint256 number; 12 | 13 | /** 14 | * @dev Store value in variable 15 | * @param num value to store 16 | */ 17 | function store(uint256 num) public { 18 | number = num; 19 | } 20 | 21 | /** 22 | * @dev Return value 23 | * @return value of 'number' 24 | */ 25 | function retrieve() public view returns (uint256){ 26 | return number; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/100/metadata.json: -------------------------------------------------------------------------------- 1 | {"compiler":{"version":"0.8.7+commit.e28d00a7"},"language":"Solidity","output":{"abi":[{"inputs":[],"name":"f","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"test.sol":"C"},"evmVersion":"london","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"sources":{"test.sol":{"keccak256":"0x612403789cfea8f3656f8d5307f027fdd53ced9ee71556d72a183dcf3e2e5c8e","urls":["bzz-raw://cc0f21b95bcc8742e4d0758d3b50e20f279a115559c68aa4060c687506de7be5","dweb:/ipfs/QmQwPrSgUfSEfJM1wYHeNEe25M7rLPD6KVWPGxwjr2nCpe"]}},"version":1} -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/interfaces/ILendingRateOracle.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | /** 5 | * @title ILendingRateOracle interface 6 | * @notice Interface for the Aave borrow rate oracle. Provides the average market borrow rate to be used as a base for the stable borrow rate calculations 7 | **/ 8 | 9 | interface ILendingRateOracle { 10 | /** 11 | @dev returns the market borrow rate in ray 12 | **/ 13 | function getMarketBorrowRate(address asset) external view returns (uint256); 14 | 15 | /** 16 | @dev sets the market borrow rate. Rate value must be in ray 17 | **/ 18 | function setMarketBorrowRate(address asset, uint256 rate) external; 19 | } 20 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/Nightly/artifact.json: -------------------------------------------------------------------------------- 1 | { 2 | "abi": [], 3 | "bytecode": "0x608060405234801561000f575f80fd5b5061014a8061001d5f395ff3fe6080604052348015600e575f80fd5b50600436106026575f3560e01c80639942ec6f14602a575b5f80fd5b60306032565b005b6038609e565b5f60f81b815f60028110604c57604b60c0565b5b60200201907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152505050565b6040518060400160405280600290602082028036833780820191505090505090565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffdfea2646970667358221220b4bc127c726fe25266489b8267e10350878936b0e673c1a52e18c07970fa8eca64736f6c637829302e382e32322d6e696768746c792e323032332e31302e32322b636f6d6d69742e6231383764303635005a" 4 | } 5 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/Nightly/metadata.json: -------------------------------------------------------------------------------- 1 | {"compiler":{"version":"0.8.22-nightly.2023.10.22+commit.b187d065"},"language":"Solidity","output":{"abi":[{"inputs":[],"name":"f2","outputs":[],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"contracts/nightly.sol":"C"},"evmVersion":"shanghai","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"contracts/nightly.sol":{"keccak256":"0x870027719cb0319e0b82023e754de6716dbcf96eb39f15f9dc90ad8aff4059de","urls":["bzz-raw://2947775672a16c694d3490e3e3037f7a6af9ed49cc2f5091dd62f3b0759cc6bf","dweb:/ipfs/QmPqWCtFyose2B9CwRC3ecdXaYLvDWxWNy59AawXb9D4yv"]}},"version":1} -------------------------------------------------------------------------------- /services/server/src/server/services/compiler/local/SolcLocal.ts: -------------------------------------------------------------------------------- 1 | import type { 2 | SolidityOutput, 3 | ISolidityCompiler, 4 | SolidityJsonInput, 5 | } from "@ethereum-sourcify/lib-sourcify"; 6 | import { useSolidityCompiler } from "@ethereum-sourcify/compilers"; 7 | 8 | export class SolcLocal implements ISolidityCompiler { 9 | constructor( 10 | private solcRepoPath: string, 11 | private solJsonRepoPath: string, 12 | ) {} 13 | 14 | async compile( 15 | version: string, 16 | solcJsonInput: SolidityJsonInput, 17 | forceEmscripten: boolean = false, 18 | ): Promise { 19 | return await useSolidityCompiler( 20 | this.solcRepoPath, 21 | this.solJsonRepoPath, 22 | version, 23 | solcJsonInput, 24 | forceEmscripten, 25 | ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/8/GameItem.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; 5 | import "@openzeppelin/contracts/utils/Counters.sol"; 6 | 7 | contract GameItem is ERC721URIStorage { 8 | using Counters for Counters.Counter; 9 | Counters.Counter private _tokenIds; 10 | 11 | constructor() ERC721("GameItem", "ITM") {} 12 | 13 | function awardItem(address player, string memory tokenURI) 14 | public 15 | returns (uint256) 16 | { 17 | _tokenIds.increment(); 18 | 19 | uint256 newItemId = _tokenIds.current(); 20 | _mint(player, newItemId); 21 | _setTokenURI(newItemId, tokenURI); 22 | 23 | return newItemId; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /services/server/src/server/apiv2/lookup/lookup.routes.ts: -------------------------------------------------------------------------------- 1 | import { 2 | validateAddress, 3 | validateChainId, 4 | validateFieldsAndOmit, 5 | } from "../middlewares"; 6 | import { 7 | getContractAllChainsEndpoint, 8 | getContractEndpoint, 9 | listContractsEndpoint, 10 | } from "./lookup.handlers"; 11 | 12 | import { Router } from "express"; 13 | 14 | const router = Router(); 15 | 16 | router 17 | .route("/contract/all-chains/:address") 18 | .get(validateAddress, getContractAllChainsEndpoint); 19 | 20 | router.route("/contracts/:chainId").get(validateChainId, listContractsEndpoint); 21 | 22 | router 23 | .route("/contract/:chainId/:address") 24 | .get( 25 | validateChainId, 26 | validateAddress, 27 | validateFieldsAndOmit, 28 | getContractEndpoint, 29 | ); 30 | 31 | export default router; 32 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/WrongMetadata/sources/SimplyLog.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.19; 4 | 5 | /** 6 | * @notice Simply logs strings 7 | */ 8 | contract SimplyLog { 9 | /** 10 | * @notice The ID of the next message to be logged 11 | */ 12 | uint256 public nextMessageId = 0; 13 | event Log(uint256 indexed messageId, string message); 14 | 15 | /** 16 | * @notice Log a message. 17 | * @param message Message to log 18 | * @return message id that was logged 19 | */ 20 | function log(string calldata message) public returns (uint256) { 21 | uint256 messageId = nextMessageId; 22 | emit Log(messageId, message); 23 | nextMessageId += 1; 24 | return messageId; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/57/sources/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../IERC20.sol"; 6 | 7 | /** 8 | * @dev Interface for the optional metadata functions from the ERC20 standard. 9 | * 10 | * _Available since v4.1._ 11 | */ 12 | interface IERC20Metadata is IERC20 { 13 | /** 14 | * @dev Returns the name of the token. 15 | */ 16 | function name() external view returns (string memory); 17 | 18 | /** 19 | * @dev Returns the symbol of the token. 20 | */ 21 | function symbol() external view returns (string memory); 22 | 23 | /** 24 | * @dev Returns the decimals places of the token. 25 | */ 26 | function decimals() external view returns (uint8); 27 | } 28 | -------------------------------------------------------------------------------- /services/server/test/testcontracts/ensure-metadata-storage/EIP1967Admin.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: CC0-1.0 2 | 3 | pragma solidity 0.8.15; 4 | 5 | /** 6 | * @title EIP1967Admin 7 | * @dev Upgradeable proxy pattern implementation according to minimalistic EIP1967. 8 | */ 9 | contract EIP1967Admin { 10 | // EIP 1967 11 | // bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1) 12 | uint256 internal constant EIP1967_ADMIN_STORAGE = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; 13 | 14 | modifier onlyAdmin() { 15 | require(msg.sender == _admin(), "EIP1967Admin: not an admin"); 16 | _; 17 | } 18 | 19 | function _admin() internal view returns (address res) { 20 | assembly { 21 | res := sload(EIP1967_ADMIN_STORAGE) 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example/test/TestMetaCoin.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.25 <0.7.0; 2 | 3 | import "truffle/Assert.sol"; 4 | import "truffle/DeployedAddresses.sol"; 5 | import "../contracts/MetaCoin.sol"; 6 | 7 | contract TestMetaCoin { 8 | 9 | function testInitialBalanceUsingDeployedContract() public { 10 | MetaCoin meta = MetaCoin(DeployedAddresses.MetaCoin()); 11 | 12 | uint expected = 10000; 13 | 14 | Assert.equal(meta.getBalance(tx.origin), expected, "Owner should have 10000 MetaCoin initially"); 15 | } 16 | 17 | function testInitialBalanceWithNewMetaCoin() public { 18 | MetaCoin meta = new MetaCoin(); 19 | 20 | uint expected = 10000; 21 | 22 | Assert.equal(meta.getBalance(tx.origin), expected, "Owner should have 10000 MetaCoin initially"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/MetadataRewriting/contract/sources/EIP1967Admin.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: CC0-1.0 2 | 3 | pragma solidity 0.8.15; 4 | 5 | /** 6 | * @title EIP1967Admin 7 | * @dev Upgradeable proxy pattern implementation according to minimalistic EIP1967. 8 | */ 9 | contract EIP1967Admin { 10 | // EIP 1967 11 | // bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1) 12 | uint256 internal constant EIP1967_ADMIN_STORAGE = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; 13 | 14 | modifier onlyAdmin() { 15 | require(msg.sender == _admin(), "EIP1967Admin: not an admin"); 16 | _; 17 | } 18 | 19 | function _admin() internal view returns (address res) { 20 | assembly { 21 | res := sload(EIP1967_ADMIN_STORAGE) 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/MultipleEqualAuxdatas/sources/src/interfaces/TBABoilerplate/IRegistry.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.17; 3 | 4 | interface IRegistry { 5 | 6 | // function symbolScheme(uint256 index) external view returns (uint8); 7 | 8 | // function tokenURI(uint256 index) external view returns (string memory); 9 | 10 | function createAccount( 11 | address implementation, 12 | bytes32 salt, 13 | uint256 chainId, 14 | address tokenContract, 15 | uint256 tokenId 16 | ) external returns (address); 17 | 18 | function account( 19 | address implementation, 20 | bytes32 salt, 21 | uint256 chainId, 22 | address tokenContract, 23 | uint256 tokenId 24 | ) external view returns (address); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/truffle-example-missing-source/test/TestMetaCoin.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.25 <0.7.0; 2 | 3 | import "truffle/Assert.sol"; 4 | import "truffle/DeployedAddresses.sol"; 5 | import "../contracts/MetaCoin.sol"; 6 | 7 | contract TestMetaCoin { 8 | 9 | function testInitialBalanceUsingDeployedContract() public { 10 | MetaCoin meta = MetaCoin(DeployedAddresses.MetaCoin()); 11 | 12 | uint expected = 10000; 13 | 14 | Assert.equal(meta.getBalance(tx.origin), expected, "Owner should have 10000 MetaCoin initially"); 15 | } 16 | 17 | function testInitialBalanceWithNewMetaCoin() public { 18 | MetaCoin meta = new MetaCoin(); 19 | 20 | uint expected = 10000; 21 | 22 | Assert.equal(meta.getBalance(tx.origin), expected, "Owner should have 10000 MetaCoin initially"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /services/server/src/server/session.ts: -------------------------------------------------------------------------------- 1 | import session from "express-session"; 2 | import logger from "../common/logger"; 3 | import type { NextFunction, Request, Response } from "express"; 4 | 5 | export default function getSessionMiddleware( 6 | sessionOptions: session.SessionOptions, 7 | ) { 8 | const sessionMiddleware = session(sessionOptions); 9 | // We need to wrap the sessionMiddleware in a middleware to prevent it from returning all the postgresql errors in the 500 request 10 | return (req: Request, res: Response, next: NextFunction) => { 11 | sessionMiddleware(req, res, (error) => { 12 | if (error) { 13 | logger.error("Cannot store session", { 14 | error, 15 | }); 16 | res.status(500).send("Cannot store session"); 17 | } else { 18 | next(); 19 | } 20 | }); 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/misc/interfaces/IWETHGateway.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | interface IWETHGateway { 5 | function depositETH( 6 | address lendingPool, 7 | address onBehalfOf, 8 | uint16 referralCode 9 | ) external payable; 10 | 11 | function withdrawETH( 12 | address lendingPool, 13 | uint256 amount, 14 | address onBehalfOf 15 | ) external; 16 | 17 | function repayETH( 18 | address lendingPool, 19 | uint256 amount, 20 | uint256 rateMode, 21 | address onBehalfOf 22 | ) external payable; 23 | 24 | function borrowETH( 25 | address lendingPool, 26 | uint256 amount, 27 | uint256 interesRateMode, 28 | uint16 referralCode 29 | ) external; 30 | } 31 | -------------------------------------------------------------------------------- /scripts/release/logging_utils.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Define color codes 4 | RED='\033[0;31m' 5 | NC='\033[0m' # No Color 6 | YELLOW='\033[0;33m' 7 | 8 | # Function to print error message and exit 9 | error_exit() { 10 | echo "" 11 | echo -e "${RED}$1${NC}" 12 | exit 1 13 | } 14 | 15 | warn() { 16 | echo "" 17 | echo -e "${YELLOW}$1${NC}" 18 | } 19 | 20 | prompt_execute_or_skip() { 21 | local operation=$1 22 | local function_to_execute=$2 23 | 24 | echo "" 25 | echo "Next: $operation. Continue (default: Y), or skip (N)?" 26 | read user_input 27 | if [[ $user_input == [nN] || $user_input == [nN][oO] ]]; then 28 | echo "Skipping $operation as per user request." 29 | else 30 | "$function_to_execute" "${@:3}" # Pass all additional arguments to the function 31 | echo "Success: $operation" 32 | echo "" 33 | fi 34 | } 35 | -------------------------------------------------------------------------------- /services/server/test/testcontracts/FactoryImmutableWithMsgSender/FactoryTest.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity 0.8.17; 3 | 4 | contract Factory { 5 | address[] public childAddresses; 6 | event Deployment(address contractAddress); 7 | 8 | function deploy( 9 | uint _foo 10 | ) public { 11 | address deployedAddress = address(new TestContract(_foo)); 12 | emit Deployment(deployedAddress); 13 | childAddresses.push(deployedAddress); 14 | } 15 | } 16 | 17 | contract TestContract { 18 | uint public immutable foo; 19 | address public immutable _owner; 20 | 21 | constructor(uint _foo) payable { 22 | foo = _foo; 23 | _owner = msg.sender; 24 | } 25 | 26 | function getFoo() public view returns (uint) { 27 | return foo; 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/multiple/Owned.sol: -------------------------------------------------------------------------------- 1 | // "SPDX-License-Identifier: UNLICENSED " 2 | pragma solidity ^0.6.0; 3 | // ---------------------------------------------------------------------------- 4 | // Owned contract 5 | // ---------------------------------------------------------------------------- 6 | contract Owned { 7 | address payable public owner; 8 | 9 | event OwnershipTransferred(address indexed _from, address indexed _to); 10 | 11 | constructor() public { 12 | owner = msg.sender; 13 | } 14 | 15 | modifier onlyOwner { 16 | require(msg.sender == owner); 17 | _; 18 | } 19 | 20 | function transferOwnership(address payable _newOwner) public onlyOwner { 21 | owner = _newOwner; 22 | emit OwnershipTransferred(msg.sender, _newOwner); 23 | } 24 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/multiple-altered/Owned.sol: -------------------------------------------------------------------------------- 1 | // "SPDX-License-Identifier: UNLICENSED " 2 | pragma solidity ^0.6.0; 3 | // ---------------------------------------------------------------------------- 4 | // Owned contract 5 | // ---------------------------------------------------------------------------- 6 | contract Owned { 7 | address payable public owner; 8 | 9 | event OwnershipTransferred(address indexed _from, address indexed _to); 10 | 11 | constructor() public { 12 | owner = msg.sender; 13 | } 14 | 15 | modifier onlyOwner { 16 | require(msg.sender == owner); 17 | _; 18 | } 19 | 20 | function transferOwnership(address payable _newOwner) public onlyOwner { 21 | owner = _newOwner; 22 | emit OwnershipTransferred(msg.sender, _newOwner); 23 | } 24 | } -------------------------------------------------------------------------------- /services/server/src/server/apiv1/verification/session-state/clear.session-state.paths.yaml: -------------------------------------------------------------------------------- 1 | openapi: "3.0.0" 2 | 3 | paths: 4 | /session/clear: 5 | post: 6 | deprecated: true 7 | summary: Clear session data 8 | tags: 9 | - (Deprecated) Session Verification 10 | responses: 11 | "200": 12 | description: OK 13 | content: 14 | text/plain: 15 | schema: 16 | type: string 17 | example: "Session successfully cleared" 18 | "500": 19 | description: Internal Server Error 20 | content: 21 | application/json: 22 | schema: 23 | type: object 24 | properties: 25 | error: 26 | type: string 27 | example: "Error in clearing session" 28 | -------------------------------------------------------------------------------- /services/server/test/testcontracts/path-sanitization/sources/IERC20Metadata.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../IERC20.sol"; 7 | 8 | /** 9 | * @dev Interface for the optional metadata functions from the ERC20 standard. 10 | * 11 | * _Available since v4.1._ 12 | */ 13 | interface IERC20Metadata is IERC20 { 14 | /** 15 | * @dev Returns the name of the token. 16 | */ 17 | function name() external view returns (string memory); 18 | 19 | /** 20 | * @dev Returns the symbol of the token. 21 | */ 22 | function symbol() external view returns (string memory); 23 | 24 | /** 25 | * @dev Returns the decimals places of the token. 26 | */ 27 | function decimals() external view returns (uint8); 28 | } 29 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/Validation/processFiles.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { extractHardhatMetadataAndSources } from '../../src'; 3 | import fs from 'fs'; 4 | import path from 'path'; 5 | 6 | describe('processFiles', () => { 7 | it('Should extractHardhatMetadataAndSources', async function () { 8 | const hardhatOutputPath = path.join( 9 | __dirname, 10 | '../validationFiles/files/hardhat-output/output.json', 11 | ); 12 | const hardhatOutput = await fs.promises.readFile(hardhatOutputPath, 'utf8'); 13 | const pathContent = { 14 | path: hardhatOutputPath, 15 | content: hardhatOutput, 16 | }; 17 | const { hardhatMetadataFiles, hardhatSourceFiles } = 18 | extractHardhatMetadataAndSources(pathContent); 19 | expect(hardhatMetadataFiles).lengthOf(6); 20 | expect(hardhatSourceFiles).lengthOf(6); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /services/database/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.8" 2 | 3 | services: 4 | db: 5 | build: 6 | context: . 7 | dockerfile_inline: | 8 | FROM postgres:15-bookworm 9 | RUN apt-get update && \ 10 | apt-get -y install postgresql-15-cron && \ 11 | apt-get clean && \ 12 | rm -rf /var/lib/apt/lists/* 13 | volumes: 14 | - postgres_data:/var/lib/postgresql/data 15 | environment: 16 | POSTGRES_DB: ${POSTGRES_DB} 17 | POSTGRES_USER: ${POSTGRES_USER} 18 | POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} 19 | ports: 20 | - ${DOCKER_HOST_POSTGRES_PORT}:${POSTGRES_PORT} 21 | command: 22 | [ 23 | "postgres", 24 | "-c", 25 | "shared_preload_libraries=pg_cron", 26 | "-c", 27 | "cron.database_name=${POSTGRES_DB}", 28 | ] 29 | 30 | volumes: 31 | postgres_data: 32 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/MultipleEqualAuxdatas/sources/src/interfaces/IPeterStorage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.17; 3 | 4 | /// A shared interface for data storage of the Peter 5 | interface IPeterStorage { 6 | 7 | // Token id => Peter 8 | struct Peters { 9 | mapping(uint256 => StoredPeter) all; 10 | } 11 | 12 | // An individual Peter 13 | struct Peter { 14 | StoredPeter stored; 15 | } 16 | 17 | // The token id in the traits contract of each corresponding trait to be layered on the Peter from the PeterTraits contract 18 | struct StoredPeter { 19 | uint256 tokenId; 20 | // uint256 hatId; 21 | // uint256 hairId; 22 | // uint256 glassesId; 23 | // uint256 handheldId; 24 | uint256 shirtId; 25 | uint256 pantsId; 26 | // uint256 shoesId; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/mocks/tokens/MintableERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | import {ERC20} from '../../dependencies/openzeppelin/contracts/ERC20.sol'; 5 | 6 | /** 7 | * @title ERC20Mintable 8 | * @dev ERC20 minting logic 9 | */ 10 | contract MintableERC20 is ERC20 { 11 | constructor( 12 | string memory name, 13 | string memory symbol, 14 | uint8 decimals 15 | ) public ERC20(name, symbol) { 16 | _setupDecimals(decimals); 17 | } 18 | 19 | /** 20 | * @dev Function to mint tokens 21 | * @param value The amount of tokens to mint. 22 | * @return A boolean that indicates if the operation was successful. 23 | */ 24 | function mint(uint256 value) public returns (bool) { 25 | _mint(_msgSender(), value); 26 | return true; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/MultipleEqualAuxdatas/sources/src/TraitCategory.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.17; 3 | 4 | library TraitCategory { 5 | 6 | // TODO: add bg as a trait? 7 | enum Name { 8 | Hat, // 0 9 | Hair, // 1 10 | Glasses, // 2 11 | Handheld, // 3 12 | Shirt, // 4 13 | Pants, // 5 14 | Shoes // 6 15 | } 16 | 17 | function toString(Name name) public pure returns (string memory) { 18 | if (name == Name.Hat) return "Hat"; 19 | if (name == Name.Hair) return "Hair"; 20 | if (name == Name.Glasses) return "Glasses"; 21 | if (name == Name.Handheld) return "Handheld"; 22 | if (name == Name.Shirt) return "Shirt"; 23 | if (name == Name.Pants) return "Pants"; 24 | if (name == Name.Shoes) return "Shoes"; 25 | return ""; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /services/4byte/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## sourcify-4byte@1.1.5 - 2025-12-15 4 | 5 | - Update dependencies 6 | 7 | ## sourcify-4byte@1.1.4 - 2025-11-19 8 | 9 | - update dependencies 10 | - Turn @typescript-eslint/consistent-type-imports rule on (#2496) 11 | 12 | ## sourcify-4byte@1.1.3 - 2025-11-04 13 | 14 | - update dependencies 15 | 16 | ## sourcify-4byte@1.1.2 - 2025-10-30 17 | 18 | - Add canonical signature (#2471) 19 | 20 | ## sourcify-4byte@1.1.1 - 2025-10-28 21 | 22 | - update dependencies 23 | 24 | ## sourcify-4byte@1.1.0 - 2025-10-16 25 | 26 | - Create 4byte service (#2402) 27 | - Creates a separate 4byte service, removing the endpoints in Sourcify server and instead publishing a new standalone service. 28 | - Update 4byte after bulk import and implementing /import endpoint (#2443) 29 | - Implements `/import` endpoint to submit new signatures, not associated to verified contracts. 30 | - Fix openchain compatiblity (#2447) 31 | -------------------------------------------------------------------------------- /services/server/test/testcontracts/FactoryImmutableWithoutConstrArg/FactoryTest3.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.17; 3 | 4 | contract Factory2{ 5 | Child2[] public children; 6 | uint disabledCount; 7 | 8 | event ChildCreated(address childAddress); 9 | 10 | function createChild() external{ 11 | Child2 child = new Child2(); 12 | children.push(child); 13 | emit ChildCreated(address(child)); 14 | } 15 | 16 | function getChildren() external view returns(Child2[] memory _children){ 17 | _children = new Child2[](children.length- disabledCount); 18 | uint count; 19 | for(uint i=0;i ${file%.sol}" 13 | fi 14 | } 15 | 16 | # Recursive function to process directories 17 | process_directory() { 18 | local dir="$1" 19 | for item in "$dir"/*; do 20 | if [[ -d "$item" ]]; then 21 | process_directory "$item" 22 | elif [[ -f "$item" ]]; then 23 | remove_sol_extension "$item" 24 | fi 25 | done 26 | } 27 | 28 | 29 | # Start processing from REPO_PATH 30 | echo "Starting to remove .sol extensions from files in $REPO_PATH" 31 | process_directory "$REPO_PATH" 32 | echo "Finished removing .sol extensions" 33 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/57/sources/@openzeppelin/contracts/utils/Context.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | /** 6 | * @dev Provides information about the current execution context, including the 7 | * sender of the transaction and its data. While these are generally available 8 | * via msg.sender and msg.data, they should not be accessed in such a direct 9 | * manner, since when dealing with meta-transactions the account sending and 10 | * paying for execution may not be the actual sender (as far as an application 11 | * is concerned). 12 | * 13 | * This contract is only required for intermediate, library-like contracts. 14 | */ 15 | abstract contract Context { 16 | function _msgSender() internal view virtual returns (address) { 17 | return msg.sender; 18 | } 19 | 20 | function _msgData() internal view virtual returns (bytes calldata) { 21 | return msg.data; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/6119/sources/contracts/IUPTNAddressValidator.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.9; 3 | 4 | interface IUPTNAddressValidator { 5 | function isBlacklist(address account) external view returns (bool); 6 | function addBlacklist(address account) external; 7 | function removeBlacklist(address account) external; 8 | 9 | function isWhitelist(bytes32 tokenHash, address account) external view returns (bool); 10 | function addWhitelist(bytes32 tokenHash, address account) external; 11 | function removeWhitelist(bytes32 tokenHash, address account) external; 12 | 13 | function whitelistPaused(bytes32 tokenHash) external view returns (bool); 14 | function pauseWhitelist(bytes32 tokenHash) external; 15 | function unpauseWhitelist(bytes32 tokenHash) external; 16 | 17 | function isValid(bytes32 tokenHash, address fromAccount, address toAccount) external view returns (bool); 18 | } 19 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/6119/sources/@openzeppelin/contracts/interfaces/IERC4906.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4906.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./IERC165.sol"; 7 | import "./IERC721.sol"; 8 | 9 | /// @title EIP-721 Metadata Update Extension 10 | interface IERC4906 is IERC165, IERC721 { 11 | /// @dev This event emits when the metadata of a token is changed. 12 | /// So that the third-party platforms such as NFT market could 13 | /// timely update the images and related attributes of the NFT. 14 | event MetadataUpdate(uint256 _tokenId); 15 | 16 | /// @dev This event emits when the metadata of a range of tokens is changed. 17 | /// So that the third-party platforms such as NFT market could 18 | /// timely update the images and related attributes of the NFTs. 19 | event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId); 20 | } 21 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/6119/sources/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../IERC721.sol"; 7 | 8 | /** 9 | * @title ERC-721 Non-Fungible Token Standard, optional metadata extension 10 | * @dev See https://eips.ethereum.org/EIPS/eip-721 11 | */ 12 | interface IERC721Metadata is IERC721 { 13 | /** 14 | * @dev Returns the token collection name. 15 | */ 16 | function name() external view returns (string memory); 17 | 18 | /** 19 | * @dev Returns the token collection symbol. 20 | */ 21 | function symbol() external view returns (string memory); 22 | 23 | /** 24 | * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. 25 | */ 26 | function tokenURI(uint256 tokenId) external view returns (string memory); 27 | } 28 | -------------------------------------------------------------------------------- /services/server/src/server/apiv1/verification/session-state/session-state.routes.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "express"; 2 | import { 3 | getSessionDataEndpoint, 4 | addInputFilesEndpoint, 5 | restartSessionEndpoint, 6 | addInputContractEndpoint, 7 | } from "./session-state.handlers"; 8 | 9 | const router: Router = Router(); 10 | 11 | router.route("/session/data").get(getSessionDataEndpoint); 12 | router.route("/session/input-files").post(addInputFilesEndpoint); 13 | router.route("/session/clear").post(restartSessionEndpoint); 14 | router.route("/session/input-contract").post(addInputContractEndpoint); 15 | 16 | export const deprecatedRoutesSessionState = { 17 | "/session-data": { 18 | method: "get", 19 | path: "/session/data", 20 | }, 21 | "/input-files": { 22 | method: "post", 23 | path: "/session/input-files", 24 | }, 25 | "/restart-session": { 26 | method: "post", 27 | path: "/session/clear", 28 | }, 29 | }; 30 | 31 | export default router; 32 | -------------------------------------------------------------------------------- /services/server/src/server/services/services.ts: -------------------------------------------------------------------------------- 1 | import type { StorageServiceOptions } from "./StorageService"; 2 | import { StorageService } from "./StorageService"; 3 | import type { VerificationServiceOptions } from "./VerificationService"; 4 | import { VerificationService } from "./VerificationService"; 5 | 6 | export class Services { 7 | public verification: VerificationService; 8 | public storage: StorageService; 9 | 10 | constructor( 11 | verificationServiceOptions: VerificationServiceOptions, 12 | storageServiceOptions: StorageServiceOptions, 13 | ) { 14 | this.storage = new StorageService(storageServiceOptions); 15 | this.verification = new VerificationService( 16 | verificationServiceOptions, 17 | this.storage, 18 | ); 19 | } 20 | 21 | public async init() { 22 | await this.storage.init(); 23 | await this.verification.init(); 24 | } 25 | 26 | public async close() { 27 | await this.verification.close(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/CallProtectionForLibraries/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { "version": "0.8.19+commit.7dd6d404" }, 3 | "language": "Solidity", 4 | "output": { 5 | "abi": [], 6 | "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, 7 | "userdoc": { "kind": "user", "methods": {}, "version": 1 } 8 | }, 9 | "settings": { 10 | "compilationTarget": { "Ballot.sol": "Ballot" }, 11 | "evmVersion": "paris", 12 | "libraries": {}, 13 | "metadata": { "bytecodeHash": "ipfs" }, 14 | "optimizer": { "enabled": true, "runs": 200 }, 15 | "remappings": [] 16 | }, 17 | "sources": { 18 | "Ballot.sol": { 19 | "keccak256": "0x21d251aa06c7fcbb362bca4b1645ef4fbc3d0844f6774f4598588f9045fdfe97", 20 | "urls": [ 21 | "bzz-raw://7464b55b34107bd79040fa11eed489e2d20bde5e15b801e2ba144d7bd10bbeca", 22 | "dweb:/ipfs/Qmbrd7Up3r6Q5JA9NMvZZawsJ5EuuoFfRuMBEjAYk7oDod" 23 | ] 24 | } 25 | }, 26 | "version": 1 27 | } 28 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/42161/metadata.json: -------------------------------------------------------------------------------- 1 | {"compiler":{"version":"0.8.11+commit.d7f03943"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"getBalances","outputs":[{"internalType":"uint256[]","name":"balances","type":"uint256[]"}],"stateMutability":"view","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"BalanceFetcher.sol":"BalanceFetcher"},"evmVersion":"london","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":999999},"remappings":[]},"sources":{"BalanceFetcher.sol":{"keccak256":"0x7c6801e6812b31abf3e35b274eac4cab0207ab279ac57fbd124f9691bc6c71a2","license":"MIT","urls":["bzz-raw://9fd7a879ffe771b37c48035af409f7960b2d397ac0ad35880f735f8facaf2a09","dweb:/ipfs/QmNs3wbyChdQ1SkBUCeSKZSHTGPvnJu8bArWqPoXyUMzrb"]}},"version":1} -------------------------------------------------------------------------------- /packages/lib-sourcify/src/utils/utils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Checks whether the provided object contains any keys or not. 3 | * @param obj The object whose emptiness is tested. 4 | * @returns true if any keys present; false otherwise 5 | */ 6 | export function isEmpty(obj: object): boolean { 7 | return !Object.keys(obj).length && obj.constructor === Object; 8 | } 9 | 10 | /** 11 | * Splits a fully qualified name into a contract path and a contract name. 12 | * @param fullyQualifiedName The fully qualified name to split. 13 | * @returns An object containing the contract path and the contract name. 14 | */ 15 | export function splitFullyQualifiedName(fullyQualifiedName: string): { 16 | contractPath: string; 17 | contractName: string; 18 | } { 19 | const splitIdentifier = fullyQualifiedName.split(':'); 20 | const contractName = splitIdentifier[splitIdentifier.length - 1]; 21 | const contractPath = splitIdentifier.slice(0, -1).join(':'); 22 | return { contractPath, contractName }; 23 | } 24 | -------------------------------------------------------------------------------- /services/server/test/integration/apiv2/v2.common.spec.ts: -------------------------------------------------------------------------------- 1 | import chai from "chai"; 2 | import chaiHttp from "chai-http"; 3 | import { ServerFixture } from "../../helpers/ServerFixture"; 4 | import { RWStorageIdentifiers } from "../../../src/server/services/storageServices/identifiers"; 5 | 6 | chai.use(chaiHttp); 7 | 8 | describe("/v2 with no database configured", function () { 9 | const serverFixture = new ServerFixture({ 10 | skipDatabaseReset: true, 11 | read: RWStorageIdentifiers.RepositoryV1, 12 | writeOrErr: [RWStorageIdentifiers.RepositoryV1], 13 | }); 14 | 15 | it("should return a 404", async function () { 16 | const res = await chai 17 | .request(serverFixture.server.app) 18 | .get(`/v2/contracts/1`); 19 | 20 | chai.expect(res.status).to.equal(404); 21 | chai.expect(res.body.customCode).to.equal("route_not_found"); 22 | chai.expect(res.body).to.have.property("errorId"); 23 | chai.expect(res.body).to.have.property("message"); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /services/server/test/testcontracts/path-sanitization/sources/Context.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Provides information about the current execution context, including the 8 | * sender of the transaction and its data. While these are generally available 9 | * via msg.sender and msg.data, they should not be accessed in such a direct 10 | * manner, since when dealing with meta-transactions the account sending and 11 | * paying for execution may not be the actual sender (as far as an application 12 | * is concerned). 13 | * 14 | * This contract is only required for intermediate, library-like contracts. 15 | */ 16 | abstract contract Context { 17 | function _msgSender() internal view virtual returns (address) { 18 | return msg.sender; 19 | } 20 | 21 | function _msgData() internal view virtual returns (bytes calldata) { 22 | return msg.data; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/CBORInTheMiddleFactory/sources/@openzeppelin/contracts/utils/introspection/IERC165.sol: -------------------------------------------------------------------------------- 1 | { 2 | "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" 3 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/MultipleEqualAuxdatas/sources/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Metadata.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../IERC721.sol"; 7 | 8 | /** 9 | * @title ERC-721 Non-Fungible Token Standard, optional metadata extension 10 | * @dev See https://eips.ethereum.org/EIPS/eip-721 11 | */ 12 | interface IERC721Metadata is IERC721 { 13 | /** 14 | * @dev Returns the token collection name. 15 | */ 16 | function name() external view returns (string memory); 17 | 18 | /** 19 | * @dev Returns the token collection symbol. 20 | */ 21 | function symbol() external view returns (string memory); 22 | 23 | /** 24 | * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. 25 | */ 26 | function tokenURI(uint256 tokenId) external view returns (string memory); 27 | } 28 | -------------------------------------------------------------------------------- /packages/bytecode-utils/test/bytecodes/without0x.hex: -------------------------------------------------------------------------------- 1 | 6080604052600436106100aa576100176000356100b7565b80632e64cec1811461003357636057361d811461006d576100a7565b3415610042576100416100ea565b5b61004d3660046100f4565b6100556102ad565b61005d6100e0565b6100678282610125565b81810382f35b341561007c5761007b6100ea565b5b61008736600461016c565b61009081610252565b6100986100e0565b6100a181610199565b81810382f35b50505b6100b26101a5565b6102ce565b60007c010000000000000000000000000000000000000000000000000000000082049050919050565b6000604051905090565b600080fd5b600080fd5b6000818…61010c565b9050919050565b6000819050919050565b61023882610203565b61024b61024482610225565b83546101b7565b8255505050565b808061025f81600061022f565b505050565b600090565b6000600182049050919050565b6000819050919050565b600061029361028e83610269565b610276565b9050919050565b60006102a68254610280565b9050919050565b60006102b7610264565b8091506102c4600061029a565b8080935050505090565bfea3646970667358221220bfdd0169ba76579372f6637e9fd849a7cefae9eede22f3fa7031e547a2738ab06c6578706572696d656e74616cf564736f6c634300080a0041 -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/CBORInTheMiddleFactory/sources/@openzeppelin/contracts/interfaces/draft-IERC1822.sol: -------------------------------------------------------------------------------- 1 | { 2 | "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" 3 | } -------------------------------------------------------------------------------- /packages/bytecode-utils/test/bytecodes/experimental.hex: -------------------------------------------------------------------------------- 1 | 0x6080604052600436106100aa576100176000356100b7565b80632e64cec1811461003357636057361d811461006d576100a7565b3415610042576100416100ea565b5b61004d3660046100f4565b6100556102ad565b61005d6100e0565b6100678282610125565b81810382f35b341561007c5761007b6100ea565b5b61008736600461016c565b61009081610252565b6100986100e0565b6100a181610199565b81810382f35b50505b6100b26101a5565b6102ce565b60007c010000000000000000000000000000000000000000000000000000000082049050919050565b6000604051905090565b600080fd5b600080fd5b6000818…61010c565b9050919050565b6000819050919050565b61023882610203565b61024b61024482610225565b83546101b7565b8255505050565b808061025f81600061022f565b505050565b600090565b6000600182049050919050565b6000819050919050565b600061029361028e83610269565b610276565b9050919050565b60006102a68254610280565b9050919050565b60006102b7610264565b8091506102c4600061029a565b8080935050505090565bfea3646970667358221220bfdd0169ba76579372f6637e9fd849a7cefae9eede22f3fa7031e547a2738ab06c6578706572696d656e74616cf564736f6c634300080a0041 -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/CallProtectionForLibrariesViaIR/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { "version": "0.8.19+commit.7dd6d404" }, 3 | "language": "Solidity", 4 | "output": { 5 | "abi": [], 6 | "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, 7 | "userdoc": { "kind": "user", "methods": {}, "version": 1 } 8 | }, 9 | "settings": { 10 | "compilationTarget": { "Ballot.sol": "Ballot" }, 11 | "evmVersion": "paris", 12 | "libraries": {}, 13 | "metadata": { "bytecodeHash": "ipfs" }, 14 | "optimizer": { "enabled": true, "runs": 200 }, 15 | "remappings": [], 16 | "viaIR": true 17 | }, 18 | "sources": { 19 | "Ballot.sol": { 20 | "keccak256": "0x21d251aa06c7fcbb362bca4b1645ef4fbc3d0844f6774f4598588f9045fdfe97", 21 | "urls": [ 22 | "bzz-raw://7464b55b34107bd79040fa11eed489e2d20bde5e15b801e2ba144d7bd10bbeca", 23 | "dweb:/ipfs/Qmbrd7Up3r6Q5JA9NMvZZawsJ5EuuoFfRuMBEjAYk7oDod" 24 | ] 25 | } 26 | }, 27 | "version": 1 28 | } 29 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Add New Chain 4 | 5 | Thanks for your pull request to add a new support in Sourcify. 6 | 7 | If you haven't done so, please follow the instructions on [how to request chain support](https://docs.sourcify.dev/docs/chain-support/) in docs. 8 | 9 | Please check the following items before submitting your pull request for a speedy review. 10 | 11 | ## Checklist 12 | 13 | - [ ] The branch is named as `add-chain-`. 14 | - [ ] I haven't modified the `chains.json` file directly. 15 | - [ ] In `sourcify-chains.json` file 16 | - [ ] I've set `supported: true`. 17 | - [ ] I haven't added an `rpc` field but the one in [chains.json](../../src/chains.json) is used (if not, please explain why). 18 | - [ ] I've added a test in [chain-tests.js](../../test/chains/chains-test.js) file. 19 | - [ ] `test-new-chain` test in Circle CI is passing. 20 | -------------------------------------------------------------------------------- /scripts/.env.example: -------------------------------------------------------------------------------- 1 | # Database connection settings for delete-sourcify-match.ts script 2 | # Copy this file to .env and fill in your values 3 | 4 | # Database type: "postgres" or "bigquery" 5 | DATABASE_TYPE=postgres 6 | 7 | # Rollback changes before committing 8 | DRY_RUN=true 9 | 10 | # PostgreSQL Configuration (when DATABASE_TYPE=postgres) 11 | SOURCIFY_POSTGRES_HOST=localhost 12 | SOURCIFY_POSTGRES_PORT=5432 13 | SOURCIFY_POSTGRES_DB=sourcify 14 | SOURCIFY_POSTGRES_USER=sourcify 15 | SOURCIFY_POSTGRES_PASSWORD=sourcify 16 | 17 | # BigQuery Configuration (when DATABASE_TYPE=bigquery) 18 | BIGQUERY_PROJECT_ID=sourcify-project 19 | BIGQUERY_DATASET=sourcify 20 | BIGQUERY_LOCATION=europe-west1 21 | # Find your dataset location: https://console.cloud.google.com/bigquery 22 | # Authentication: 23 | # Option A: Use service account key 24 | GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-key.json 25 | # Option B: Use gcloud default credentials (no extra config needed) 26 | # Just run: gcloud auth application-default login -------------------------------------------------------------------------------- /services/database/.env.template: -------------------------------------------------------------------------------- 1 | POSTGRES_HOST=localhost 2 | POSTGRES_DB=sourcify 3 | POSTGRES_USER=sourcify 4 | POSTGRES_PASSWORD=sourcify 5 | POSTGRES_PORT=5432 6 | DOCKER_HOST_POSTGRES_PORT=5432 7 | # If the sourcify instance requires authentication 8 | BEARER_TOKEN= 9 | 10 | # Variables for v0->v1 schema upgrade 11 | POSTGRES_SCHEMA=public 12 | BATCH_SIZE=1000 13 | 14 | # Variables for Dune 15 | DUNE_API_KEY= 16 | 17 | ##### DBMATE configuration for migrations 18 | # Configure the database connection 19 | DATABASE_URL=postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$DOCKER_HOST_POSTGRES_PORT/$POSTGRES_DB?sslmode=disable 20 | 21 | # Keep this for updating the schema dump after adding a new migration 22 | DBMATE_SCHEMA_FILE=./sourcify-database.sql 23 | 24 | 25 | ##### Massive replace script configuration 26 | # Database configuration uses the POSTGRES_ variables above 27 | # API configuration 28 | API_BASE_URL=https://staging.sourcify.dev/server 29 | API_AUTH_TOKEN=token_here 30 | STORE_FAILED_CONTRACT_IDS=false -------------------------------------------------------------------------------- /services/server/test/chains/sources/6119/sources/@openzeppelin/contracts/utils/Context.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Provides information about the current execution context, including the 8 | * sender of the transaction and its data. While these are generally available 9 | * via msg.sender and msg.data, they should not be accessed in such a direct 10 | * manner, since when dealing with meta-transactions the account sending and 11 | * paying for execution may not be the actual sender (as far as an application 12 | * is concerned). 13 | * 14 | * This contract is only required for intermediate, library-like contracts. 15 | */ 16 | abstract contract Context { 17 | function _msgSender() internal view virtual returns (address) { 18 | return msg.sender; 19 | } 20 | 21 | function _msgData() internal view virtual returns (bytes calldata) { 22 | return msg.data; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/interfaces/IUniswapV2Router02.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | interface IUniswapV2Router02 { 5 | function swapExactTokensForTokens( 6 | uint256 amountIn, 7 | uint256 amountOutMin, 8 | address[] calldata path, 9 | address to, 10 | uint256 deadline 11 | ) external returns (uint256[] memory amounts); 12 | 13 | function swapTokensForExactTokens( 14 | uint256 amountOut, 15 | uint256 amountInMax, 16 | address[] calldata path, 17 | address to, 18 | uint256 deadline 19 | ) external returns (uint256[] memory amounts); 20 | 21 | function getAmountsOut(uint256 amountIn, address[] calldata path) 22 | external 23 | view 24 | returns (uint256[] memory amounts); 25 | 26 | function getAmountsIn(uint256 amountOut, address[] calldata path) 27 | external 28 | view 29 | returns (uint256[] memory amounts); 30 | } 31 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/multiple/Savings.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity ^0.6.0; 3 | import "./Main.sol"; 4 | 5 | contract Savings { 6 | 7 | Main main; 8 | mapping(address => uint256) accountSavings; 9 | 10 | constructor(address payable _main) public { 11 | main = Main(_main); 12 | } 13 | 14 | // saves funds of the address passed in _of 15 | function saveFunds(address _of) public payable{ 16 | require(msg.sender == address(main)); 17 | accountSavings[_of] += msg.value; 18 | } 19 | 20 | function withdrawFunds(address _of, address payable _achievedTargetCollector) public payable{ 21 | require(msg.sender == address(main)); 22 | main.withdrawTargetFromSavings{value: accountSavings[_of]}(_of, _achievedTargetCollector); 23 | accountSavings[_of] = 0; 24 | } 25 | 26 | function balance() public view returns(uint256){ 27 | return (address(this).balance); 28 | } 29 | } -------------------------------------------------------------------------------- /services/server/src/server/apiv2/routes.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "express"; 2 | import lookupRoutes from "./lookup/lookup.routes"; 3 | import jobsRoutes from "./jobs/jobs.routes"; 4 | import verificationRoutes from "./verification/verification.routes"; 5 | import type { Services } from "../services/services"; 6 | import { RWStorageIdentifiers } from "../services/storageServices/identifiers"; 7 | import { RouteNotFoundError } from "./errors"; 8 | 9 | const router: Router = Router(); 10 | 11 | router.use((req, res, next) => { 12 | const services = req.app.get("services") as Services; 13 | if ( 14 | services.storage.enabledServices.read !== 15 | RWStorageIdentifiers.SourcifyDatabase 16 | ) { 17 | throw new RouteNotFoundError( 18 | "API v2 is disabled because the server has no database configured as read service.", 19 | ); 20 | } 21 | next(); 22 | }); 23 | 24 | router.use("/", lookupRoutes); 25 | router.use("/", jobsRoutes); 26 | router.use("/", verificationRoutes); 27 | 28 | export default router; 29 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/multiple-altered/Savings.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity ^0.6.0; 3 | import "./Main.sol"; 4 | 5 | contract Savings { 6 | 7 | Main main; 8 | mapping(address => uint256) accountSavings; 9 | 10 | constructor(address payable _main) public { 11 | main = Main(_main); 12 | } 13 | 14 | // saves funds of the address passed in _of 15 | function saveFunds(address _of) public payable{ 16 | require(msg.sender == address(main)); 17 | accountSavings[_of] += msg.value; 18 | } 19 | 20 | function withdrawFunds(address _of, address payable _achievedTargetCollector) public payable{ 21 | require(msg.sender == address(main)); 22 | main.withdrawTargetFromSavings{value: accountSavings[_of]}(_of, _achievedTargetCollector); 23 | accountSavings[_of] = 0; 24 | } 25 | 26 | function balance() public view returns(uint256){ 27 | return (address(this).balance); 28 | } 29 | } -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/sources/IFlashLoanReceiver.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol'; 5 | import {ILendingPool} from '../../interfaces/ILendingPool.sol'; 6 | 7 | /** 8 | * @title IFlashLoanReceiver interface 9 | * @notice Interface for the Aave fee IFlashLoanReceiver. 10 | * @author Aave 11 | * @dev implement this interface to develop a flashloan-compatible flashLoanReceiver contract 12 | **/ 13 | interface IFlashLoanReceiver { 14 | function executeOperation( 15 | address[] calldata assets, 16 | uint256[] calldata amounts, 17 | uint256[] calldata premiums, 18 | address initiator, 19 | bytes calldata params 20 | ) external returns (bool); 21 | 22 | function ADDRESSES_PROVIDER() external view returns (ILendingPoolAddressesProvider); 23 | 24 | function LENDING_POOL() external view returns (ILendingPool); 25 | } 26 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/1/airdrop.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | import "./IERC20.sol"; 4 | 5 | contract Airdrop { 6 | 7 | address private owner; 8 | 9 | /** 10 | * @dev Sets the values for {owner} . 11 | * 12 | */ 13 | constructor () { 14 | owner = msg.sender; 15 | } 16 | 17 | /** 18 | * @dev daAirdrop to address 19 | * @param _tokenAddr address the erc20 token address 20 | * @param dests address[] addresses to airdrop 21 | * @param values uint256 value(in ether) to airdrop 22 | */ 23 | function doAirdrop(address _tokenAddr, address[] memory dests, uint256 values) public 24 | returns (uint256) { 25 | require(msg.sender==owner,'You do not have permission'); 26 | uint256 i = 0; 27 | while (i < dests.length) { 28 | IERC20(_tokenAddr).transferFrom(msg.sender, dests[i], values); 29 | i += 1; 30 | } 31 | return(i); 32 | } 33 | 34 | function getOwner() public view returns(address){ 35 | return(owner); 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /services/server/test/chains/sources/42161/BalanceFetcher.sol: -------------------------------------------------------------------------------- 1 | /** 2 | *Submitted for verification at polygonscan.com on 2021-12-27 3 | */ 4 | 5 | // SPDX-License-Identifier: MIT 6 | // Author: LufyCZ 7 | 8 | pragma solidity ^0.8.0; 9 | 10 | interface IERC20 { 11 | function balanceOf(address _owner) external view returns(uint256); 12 | } 13 | 14 | contract BalanceFetcher { 15 | function getBalances(address _owner, address[] calldata _tokens) external view returns (uint256[] memory balances) { 16 | balances = new uint256[](_tokens.length); 17 | 18 | for(uint256 i = 0; i < _tokens.length; i++) { 19 | if(!isContract(_tokens[i])) { 20 | continue; 21 | } 22 | try IERC20(_tokens[i]).balanceOf(_owner) returns(uint256 balance) { 23 | balances[i] = balance; 24 | } catch {} 25 | } 26 | } 27 | 28 | function isContract(address addr) internal view returns (bool) { 29 | uint size; 30 | assembly { size := extcodesize(addr) } 31 | return size > 0; 32 | } 33 | } -------------------------------------------------------------------------------- /services/server/test/chains/sources/6119/sources/@openzeppelin/contracts/utils/introspection/IERC165.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Interface of the ERC165 standard, as defined in the 8 | * https://eips.ethereum.org/EIPS/eip-165[EIP]. 9 | * 10 | * Implementers can declare support of contract interfaces, which can then be 11 | * queried by others ({ERC165Checker}). 12 | * 13 | * For an implementation, see {ERC165}. 14 | */ 15 | interface IERC165 { 16 | /** 17 | * @dev Returns true if this contract implements the interface defined by 18 | * `interfaceId`. See the corresponding 19 | * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] 20 | * to learn more about how these ids are created. 21 | * 22 | * This function call must use less than 30 000 gas. 23 | */ 24 | function supportsInterface(bytes4 interfaceId) external view returns (bool); 25 | } 26 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/MultipleEqualAuxdatas/sources/lib/openzeppelin-contracts/contracts/utils/Context.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Provides information about the current execution context, including the 8 | * sender of the transaction and its data. While these are generally available 9 | * via msg.sender and msg.data, they should not be accessed in such a direct 10 | * manner, since when dealing with meta-transactions the account sending and 11 | * paying for execution may not be the actual sender (as far as an application 12 | * is concerned). 13 | * 14 | * This contract is only required for intermediate, library-like contracts. 15 | */ 16 | abstract contract Context { 17 | function _msgSender() internal view virtual returns (address) { 18 | return msg.sender; 19 | } 20 | 21 | function _msgData() internal view virtual returns (bytes calldata) { 22 | return msg.data; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/flashloan/interfaces/IFlashLoanReceiver.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol'; 5 | import {ILendingPool} from '../../interfaces/ILendingPool.sol'; 6 | 7 | /** 8 | * @title IFlashLoanReceiver interface 9 | * @notice Interface for the Aave fee IFlashLoanReceiver. 10 | * @author Aave 11 | * @dev implement this interface to develop a flashloan-compatible flashLoanReceiver contract 12 | **/ 13 | interface IFlashLoanReceiver { 14 | function executeOperation( 15 | address[] calldata assets, 16 | uint256[] calldata amounts, 17 | uint256[] calldata premiums, 18 | address initiator, 19 | bytes calldata params 20 | ) external returns (bool); 21 | 22 | function ADDRESSES_PROVIDER() external view returns (ILendingPoolAddressesProvider); 23 | 24 | function LENDING_POOL() external view returns (ILendingPool); 25 | } 26 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | import './BaseImmutableAdminUpgradeabilityProxy.sol'; 5 | import '../../../dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol'; 6 | 7 | /** 8 | * @title InitializableAdminUpgradeabilityProxy 9 | * @dev Extends BaseAdminUpgradeabilityProxy with an initializer function 10 | */ 11 | contract InitializableImmutableAdminUpgradeabilityProxy is 12 | BaseImmutableAdminUpgradeabilityProxy, 13 | InitializableUpgradeabilityProxy 14 | { 15 | constructor(address admin) public BaseImmutableAdminUpgradeabilityProxy(admin) {} 16 | 17 | /** 18 | * @dev Only fall back when the sender is not the admin. 19 | */ 20 | function _willFallback() internal override(BaseImmutableAdminUpgradeabilityProxy, Proxy) { 21 | BaseImmutableAdminUpgradeabilityProxy._willFallback(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/MultipleEqualAuxdatas/sources/lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Interface of the ERC165 standard, as defined in the 8 | * https://eips.ethereum.org/EIPS/eip-165[EIP]. 9 | * 10 | * Implementers can declare support of contract interfaces, which can then be 11 | * queried by others ({ERC165Checker}). 12 | * 13 | * For an implementation, see {ERC165}. 14 | */ 15 | interface IERC165 { 16 | /** 17 | * @dev Returns true if this contract implements the interface defined by 18 | * `interfaceId`. See the corresponding 19 | * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] 20 | * to learn more about how these ids are created. 21 | * 22 | * This function call must use less than 30 000 gas. 23 | */ 24 | function supportsInterface(bytes4 interfaceId) external view returns (bool); 25 | } 26 | -------------------------------------------------------------------------------- /services/server/src/config/migration.js: -------------------------------------------------------------------------------- 1 | const { 2 | RWStorageIdentifiers, 3 | WStorageIdentifiers, 4 | } = require("../server/services/storageServices/identifiers"); 5 | 6 | module.exports = { 7 | server: { 8 | port: 80, 9 | }, 10 | repositoryV1: { 11 | path: "/home/app/data/repository", 12 | }, 13 | repositoryV2: { 14 | path: "/home/app/data/repositoryV2", 15 | }, 16 | // The storage services where the verified contract be saved and read from 17 | storage: { 18 | read: RWStorageIdentifiers.SourcifyDatabase, 19 | writeOrWarn: [], 20 | writeOrErr: [ 21 | WStorageIdentifiers.RepositoryV2, 22 | RWStorageIdentifiers.RepositoryV1, 23 | RWStorageIdentifiers.SourcifyDatabase, 24 | ], 25 | }, 26 | solcRepo: "/home/app/data/compilers/solc", 27 | solJsonRepo: "/home/app/data/compilers/soljson", 28 | vyperRepo: "/home/app/data/compilers/vyper", 29 | session: { 30 | secure: true, // Set Secure in the Set-Cookie header i.e. require https 31 | }, 32 | initCompilers: true, 33 | verifyDeprecated: true, 34 | }; 35 | -------------------------------------------------------------------------------- /services/server/test/unit/utils/parsing-util.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect } from "chai"; 2 | import { getContractPathFromSources } from "../../../src/server/services/utils/parsing-util"; 3 | 4 | describe("getContractPathFromSources (lib)", () => { 5 | it("should return the correct contract path", () => { 6 | const sources = { 7 | "SolidityContract.sol": { content: "contract WrongContract {}" }, 8 | "path/file.sol": { 9 | content: "contract WrongContract {}\ncontract SolidityContract {}", 10 | }, 11 | } as any; 12 | const result = getContractPathFromSources("SolidityContract", sources); 13 | expect(result).to.equal("path/file.sol"); 14 | }); 15 | 16 | it("should return undefined when the contract path is not found in the provided sources", () => { 17 | const sources = { 18 | "path/file.sol": { content: "contract SolidityContract {}" }, 19 | } as any; 20 | const result = getContractPathFromSources( 21 | "AnotherSolidityContract", 22 | sources, 23 | ); 24 | expect(result).to.be.undefined; 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/82/Storage_meta.json: -------------------------------------------------------------------------------- 1 | {"compiler":{"version":"0.6.9+commit.3e3065ac"},"language":"Solidity","output":{"abi":[{"inputs":[],"name":"retrieve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"num","type":"uint256"}],"name":"store","outputs":[],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"methods":{"retrieve()":{"details":"Return value","returns":{"_0":"value of 'number'"}},"store(uint256)":{"details":"Store value in variable","params":{"num":"value to store"}}}},"userdoc":{"methods":{}}},"settings":{"compilationTarget":{"Storage.sol":"Storage"},"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"sources":{"Storage.sol":{"keccak256":"0xf8ef48b7c155a2b796b0a9c140e4bdaaa4e1cf7cdd3770b68c683dff1f4059e5","license":"GPL-3.0","urls":["bzz-raw://22f4ebc98d5058ca7752b056fdbc4411d29d4ae66370e7ae4a25655cfc2cfb1c","dweb:/ipfs/QmSXQEnVaSQBbwpa1XNovERQNmgAS588987rquLNYTtj6A"]}},"version":1} -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/mocks/tokens/MintableDelegationERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | import {ERC20} from '../../dependencies/openzeppelin/contracts/ERC20.sol'; 5 | 6 | /** 7 | * @title ERC20Mintable 8 | * @dev ERC20 minting logic 9 | */ 10 | contract MintableDelegationERC20 is ERC20 { 11 | address public delegatee; 12 | 13 | constructor( 14 | string memory name, 15 | string memory symbol, 16 | uint8 decimals 17 | ) public ERC20(name, symbol) { 18 | _setupDecimals(decimals); 19 | } 20 | 21 | /** 22 | * @dev Function to mint tokensp 23 | * @param value The amount of tokens to mint. 24 | * @return A boolean that indicates if the operation was successful. 25 | */ 26 | function mint(uint256 value) public returns (bool) { 27 | _mint(msg.sender, value); 28 | return true; 29 | } 30 | 31 | function delegate(address delegateeAddress) external { 32 | delegatee = delegateeAddress; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/CBORInTheMiddle/metadata.json: -------------------------------------------------------------------------------- 1 | {"compiler":{"version":"0.8.26+commit.8a97fa7a"},"language":"Solidity","output":{"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"getActiveConfig","outputs":[{"components":[{"internalType":"address","name":"vrf","type":"address"},{"internalType":"bytes32","name":"key_hash","type":"bytes32"}],"internalType":"struct Type.InitiazationObject","name":"","type":"tuple"}],"stateMutability":"view","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"contracts/CBORInTheMiddle.sol":"DeploymentHelper"},"evmVersion":"cancun","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"sources":{"contracts/CBORInTheMiddle.sol":{"keccak256":"0x2718b880b03105e97950bd1cbb1134720edc5187ebdb9440b2cb3753d929b295","license":"MIT","urls":["bzz-raw://f97208d403360b74cb5d7b2fb3f4f7ba74dc4a7d75aa938bc01bef3343454454","dweb:/ipfs/QmXzbTMxEBzmthqQ74XNjK7sqUVMP1YcJDrvhtzzpWU4Lg"]}},"version":1} -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/MultipleEqualAuxdatas/sources/src/interfaces/ITraitStorage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.17; 3 | 4 | import { TraitCategory } from '../TraitCategory.sol'; 5 | 6 | interface ITraitStorage { 7 | 8 | struct Traits { 9 | mapping(uint256 => StoredTrait) all; 10 | } 11 | 12 | struct Trait { 13 | StoredTrait stored; 14 | } 15 | 16 | struct StoredTrait { 17 | uint256 tokenId; // probs don't need this 18 | TraitCategory.Name traitType; // e.g. Shirt // TODO: rename to category 19 | string traitName; // e.g. Hoodie Black 20 | // string traitPath; // e.g. the svg code minus the top and bottom svg tags | TODO 21 | } 22 | 23 | struct TraitMetadata { 24 | string traitName; // e.g. 'Blue Shirt', same as key, redundant for now 25 | TraitCategory.Name traitType; // e.g. TraitCategory.Name.Shirt 26 | string traitPath; // e.g. the svg code minus the top and bottom svg tags 27 | // maybe a property in here for the attributes array values 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /packages/compilers-types/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## @ethereum-sourcify/compilers-types@1.0.10 - 2025-10-28 4 | 5 | none 6 | 7 | ## @ethereum-sourcify/compilers-types@1.0.9 - 2025-10-16 8 | 9 | - Update dependencies 10 | 11 | ## @ethereum-sourcify/compilers-types@1.0.8 - 2025-09-18 12 | 13 | - update repo links 14 | 15 | ## @ethereum-sourcify/compilers-types@1.0.7 - 2025-08-25 16 | 17 | - Use consistent ethers version and JsonFragment instead of abitype 18 | 19 | ## @ethereum-sourcify/compilers-types@1.0.6 - 2025-08-11 20 | 21 | - update dependencies 22 | 23 | ## @ethereum-sourcify/compilers-types@1.0.5 - 2025-08-04 24 | 25 | - update dependencies 26 | 27 | ## @ethereum-sourcify/compilers-types@1.0.4 - 2025-06-18 28 | 29 | - Add a shared output error type for Solidity and Vyper 30 | 31 | ## @ethereum-sourcify/compilers-types@1.0.3 - 2025-05-06 32 | 33 | - bump version 34 | 35 | ## @ethereum-sourcify/compilers-types@1.0.2 - 2025-04-30 36 | 37 | - Fixes build for browser context 38 | - update dependencies 39 | 40 | ## @ethereum-sourcify/compilers-types@1.0.1 - 2025-04-09 41 | 42 | - Initialize compilers types 43 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/mocks/oracle/LendingRateOracle.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | import {ILendingRateOracle} from '../../interfaces/ILendingRateOracle.sol'; 5 | import {Ownable} from '../../dependencies/openzeppelin/contracts/Ownable.sol'; 6 | 7 | contract LendingRateOracle is ILendingRateOracle, Ownable { 8 | mapping(address => uint256) borrowRates; 9 | mapping(address => uint256) liquidityRates; 10 | 11 | function getMarketBorrowRate(address _asset) external view override returns (uint256) { 12 | return borrowRates[_asset]; 13 | } 14 | 15 | function setMarketBorrowRate(address _asset, uint256 _rate) external override onlyOwner { 16 | borrowRates[_asset] = _rate; 17 | } 18 | 19 | function getMarketLiquidityRate(address _asset) external view returns (uint256) { 20 | return liquidityRates[_asset]; 21 | } 22 | 23 | function setMarketLiquidityRate(address _asset, uint256 _rate) external onlyOwner { 24 | liquidityRates[_asset] = _rate; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "server:database-test:up", 6 | "type": "shell", 7 | "command": "cd services/server && export DOCKER_HOST_POSTGRES_TEST_PORT=${DOCKER_HOST_POSTGRES_TEST_PORT:-5431} && npm run postgres-test:start && sleep 2 && SOURCIFY_POSTGRES_HOST=localhost npm run postgres-test:migrate", 8 | "problemMatcher": [] 9 | }, 10 | { 11 | "label": "server:database-test:down", 12 | "type": "shell", 13 | "command": "cd services/server && npm run postgres-test:stop", 14 | "problemMatcher": [] 15 | }, 16 | { 17 | "label": "4byte:database-test:up", 18 | "type": "shell", 19 | "command": "cd services/4byte && npm run postgres-test:start && sleep 3 && FOURBYTES_POSTGRES_HOST=localhost FOURBYTES_POSTGRES_PORT=5433 npm run postgres-test:migrate", 20 | "problemMatcher": [] 21 | }, 22 | { 23 | "label": "4byte:database-test:down", 24 | "type": "shell", 25 | "command": "cd services/4byte && npm run postgres-test:stop", 26 | "problemMatcher": [] 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/CBORInTheMiddleFactory/sources/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol: -------------------------------------------------------------------------------- 1 | { 2 | "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be\n * reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" 3 | } -------------------------------------------------------------------------------- /services/4byte/src/utils/signature-util.ts: -------------------------------------------------------------------------------- 1 | import canonicalSignaturesData from "./canonical-signatures.json"; 2 | import { Fragment } from "ethers"; 3 | 4 | export enum SignatureType { 5 | Function = "function", 6 | Event = "event", 7 | Error = "error", // Keep error here. We don't have error in /import but it can come from verified contracts as compiled_contracts_signatures.signature_type 8 | } 9 | 10 | // prettier-ignore 11 | export function getCanonicalSignatures(): 12 | Record< 13 | string, 14 | { signature?: string } 15 | > { 16 | return canonicalSignaturesData as Record; 17 | } 18 | 19 | // Use ethers.js Fragment.from() to validate signature instead of custom parser. 20 | export function validateSignature(signature: string): boolean { 21 | try { 22 | const fullSignature = `function ${signature}`; // ethers uses "Human Readable ABI" for parsing and requires type keyword. Assume it's a function. https://docs.ethers.org/v5/api/utils/abi/formats/#abi-formats--human-readable-abi 23 | Fragment.from(fullSignature); 24 | return true; 25 | } catch { 26 | return false; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/compilers/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/dependencies/openzeppelin/contracts/Context.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.6.12; 3 | 4 | /* 5 | * @dev Provides information about the current execution context, including the 6 | * sender of the transaction and its data. While these are generally available 7 | * via msg.sender and msg.data, they should not be accessed in such a direct 8 | * manner, since when dealing with GSN meta-transactions the account sending and 9 | * paying for execution may not be the actual sender (as far as an application 10 | * is concerned). 11 | * 12 | * This contract is only required for intermediate, library-like contracts. 13 | */ 14 | abstract contract Context { 15 | function _msgSender() internal view virtual returns (address payable) { 16 | return msg.sender; 17 | } 18 | 19 | function _msgData() internal view virtual returns (bytes memory) { 20 | this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 21 | return msg.data; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/WithMultipleAuxdatas/sources/Factory.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.8.9; 3 | 4 | import "./ERC20Token.sol"; 5 | import "./ERC721Token.sol"; 6 | 7 | contract Factory { 8 | event ERC20TokenCreated(address tokenAddress); 9 | event ERC721TokenCreated(address tokenAddress); 10 | 11 | function deployNewERC20Token( 12 | string calldata name, 13 | string calldata symbol, 14 | uint8 decimals, 15 | uint256 initialSupply 16 | ) public returns (address) { 17 | ERC20Token t = new ERC20Token( 18 | name, 19 | symbol, 20 | decimals, 21 | initialSupply, 22 | msg.sender 23 | ); 24 | emit ERC20TokenCreated(address(t)); 25 | 26 | return address(t); 27 | } 28 | 29 | function deployNewERC721Token(string memory name, string memory symbol) 30 | public 31 | returns (address) 32 | { 33 | ERC721Token t = new ERC721Token(name, symbol); 34 | emit ERC721TokenCreated(address(t)); 35 | 36 | return address(t); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/bytecode-utils/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/lib-sourcify/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/compilers-types/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/AbstractCreationBytecodeAttack/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.6.12+commit.27d51765" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [], 8 | "devdoc": { 9 | "kind": "dev", 10 | "methods": {}, 11 | "version": 1 12 | }, 13 | "userdoc": { 14 | "kind": "user", 15 | "methods": {}, 16 | "version": 1 17 | } 18 | }, 19 | "settings": { 20 | "compilationTarget": { 21 | "sources/FFF.sol": "FFF" 22 | }, 23 | "evmVersion": "istanbul", 24 | "libraries": {}, 25 | "metadata": { 26 | "bytecodeHash": "ipfs" 27 | }, 28 | "optimizer": { 29 | "enabled": false, 30 | "runs": 200 31 | }, 32 | "remappings": [] 33 | }, 34 | "sources": { 35 | "sources/FFF.sol": { 36 | "keccak256": "0x7ed3554b3f768ad3b3069d7fc8b1a08a24500507fc8a60eb11c726e37f3cd9a3", 37 | "urls": [ 38 | "bzz-raw://6d83c127e075a149ec14c6af579bc7b24955cdb7578ae7da2f253b7142d267cc", 39 | "dweb:/ipfs/QmW6tdCTV7X5dd5LCKDWedbMmkurQTMi4ePx7LY3DNuLn7" 40 | ] 41 | } 42 | }, 43 | "version": 1 44 | } 45 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/single-keep-original/metadata.json: -------------------------------------------------------------------------------- 1 | {"compiler":{"version":"0.6.6+commit.6c089d02"},"language":"Solidity","output":{"abi":[{"inputs":[],"name":"retrieve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"num","type":"uint256"}],"name":"store","outputs":[],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"details":"Store & retrieve value in a variable","methods":{"retrieve()":{"details":"Return value ","returns":{"_0":"value of 'number'"}},"store(uint256)":{"details":"Store value in variable","params":{"num":"value to store"}}},"title":"Storage"},"userdoc":{"methods":{}}},"settings":{"compilationTarget":{"1_Storage.sol":"Storage"},"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"1_Storage.sol":{"keccak256":"0x65593de3dd3aeff448b50f5fdde433ad95f22a28e107b150b58441ee2ce7e6e6","urls":["bzz-raw://35481bb56d599f4995e482482410132ba2d3e22dbf011da881a17c9fae6c64fe","dweb:/ipfs/QmQiLxpan6vrZnWzGEXWYnniaUf5KpAdnBUEELQu3SY4RB"]}},"version":1} 2 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/single-altered/metadata.json: -------------------------------------------------------------------------------- 1 | {"compiler":{"version":"0.6.6+commit.6c089d02"},"language":"Solidity","output":{"abi":[{"inputs":[],"name":"retreive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"num","type":"uint256"}],"name":"store","outputs":[],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"details":"Store & retreive value in a variable","methods":{"retreive()":{"details":"Return value ","returns":{"_0":"value of 'number'"}},"store(uint256)":{"details":"Store value in variable","params":{"num":"value to store"}}},"title":"Storage"},"userdoc":{"methods":{}}},"settings":{"compilationTarget":{"browser/1_Storage.sol":"Storage"},"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"browser/1_Storage.sol":{"keccak256":"0xaedc7086ad8503907209f50bac1e4dc6c2eca2ed41b15d03740fea748ea3f88e","urls":["bzz-raw://4bc331951c25951321cb29abbd689eb3af669530222c6bb2d45ff45334ee83a7","dweb:/ipfs/QmWb1NQ6Pw8ZLMFX8uDjMyftgcEieT9iP2TvWisPhjN3U2"]}},"version":1} -------------------------------------------------------------------------------- /packages/lib-sourcify/test/validationFiles/files/single-altered-metadata/metadata.json: -------------------------------------------------------------------------------- 1 | {"compiler":{"version":"0.6.6+commit.6c089d02"},"language":"Solidity","output":{"abi":[{"inputs":[],"name":"retreive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"num","type":"uint256"}],"name":"store","outputs":[],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"details":"Store & retreive value in a variable","methods":{"retreive()":{"details":"Return value ","returns":{"_0":"value of 'number'"}},"store(uint256)":{"details":"Store value in variable","params":{"num":"value to store"}}},"title":"Storage"},"userdoc":{"methods":{}}},"settings":{"compilationTarget":{"browser/1_Storage.sol":"Storage"},"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"browser/1_Storage.sol":{"keccak256":"0xbedc7086ad8503907209f50bac1e4dc6c2eca2ed41b15d03740fea748ea3f88e","urls":["bzz-raw://4bc331951c25951321cb29abbd689eb3af669530222c6bb2d45ff45334ee83a7","dweb:/ipfs/QmWb1NQ6Pw8ZLMFX8uDjMyftgcEieT9iP2TvWisPhjN3U2"]}},"version":1} -------------------------------------------------------------------------------- /packages/compilers/README.md: -------------------------------------------------------------------------------- 1 | # compilers 2 | 3 | Wrapper around multiple compilers to download the right version and invoke the compilation with a common interface. 4 | 5 | ## Install 6 | 7 | ``` 8 | npm i @ethereum-sourcify/compilers 9 | ``` 10 | 11 | ## Usage 12 | 13 | ```ts 14 | import { 15 | SolidityOutput, 16 | ISolidityCompiler, 17 | JsonInput, 18 | } from '@ethereum-sourcify/lib-sourcify'; 19 | import { useSolidityCompiler } from '@ethereum-sourcify/compilers'; 20 | 21 | class SolcLocal implements ISolidityCompiler { 22 | constructor( 23 | private solcRepoPath: string, 24 | private solJsonRepoPath: string, 25 | ) {} 26 | 27 | async compile( 28 | version: string, 29 | solcJsonInput: JsonInput, 30 | forceEmscripten: boolean = false, 31 | ): Promise { 32 | return await useSolidityCompiler( 33 | this.solcRepoPath, 34 | this.solJsonRepoPath, 35 | version, 36 | solcJsonInput, 37 | forceEmscripten, 38 | ); 39 | } 40 | } 41 | ``` 42 | 43 | The `SolcLocal` class can then be used as the `solidityCompiler` argument of the constructor of `SolidityCheckedContract`. 44 | Vyper follows the same pattern. 45 | -------------------------------------------------------------------------------- /packages/lib-sourcify/test/sources/ExtraFilesBytecodeMismatch/complete_sources/contracts/flashloan/base/FlashLoanReceiverBase.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: agpl-3.0 2 | pragma solidity 0.6.12; 3 | 4 | import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol'; 5 | import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol'; 6 | import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol'; 7 | import {IFlashLoanReceiver} from '../interfaces/IFlashLoanReceiver.sol'; 8 | import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol'; 9 | import {ILendingPool} from '../../interfaces/ILendingPool.sol'; 10 | 11 | abstract contract FlashLoanReceiverBase is IFlashLoanReceiver { 12 | using SafeERC20 for IERC20; 13 | using SafeMath for uint256; 14 | 15 | ILendingPoolAddressesProvider public immutable override ADDRESSES_PROVIDER; 16 | ILendingPool public immutable override LENDING_POOL; 17 | 18 | constructor(ILendingPoolAddressesProvider provider) public { 19 | ADDRESSES_PROVIDER = provider; 20 | LENDING_POOL = ILendingPool(provider.getLendingPool()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /services/server/test/chains/sources/6119/sources/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @title ERC721 token receiver interface 8 | * @dev Interface for any contract that wants to support safeTransfers 9 | * from ERC721 asset contracts. 10 | */ 11 | interface IERC721Receiver { 12 | /** 13 | * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} 14 | * by `operator` from `from`, this function is called. 15 | * 16 | * It must return its Solidity selector to confirm the token transfer. 17 | * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. 18 | * 19 | * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. 20 | */ 21 | function onERC721Received( 22 | address operator, 23 | address from, 24 | uint256 tokenId, 25 | bytes calldata data 26 | ) external returns (bytes4); 27 | } 28 | --------------------------------------------------------------------------------