@snovon/solast 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +190 -0
- package/dist/api.d.ts +89 -0
- package/dist/api.js +33 -0
- package/dist/ast/resolve-return-names.d.ts +2 -0
- package/dist/ast/resolve-return-names.js +199 -0
- package/dist/ast/solc-walker.d.ts +17 -0
- package/dist/ast/solc-walker.js +497 -0
- package/dist/ast/storage-layout.d.ts +21 -0
- package/dist/ast/storage-layout.js +64 -0
- package/dist/cli.d.ts +65 -0
- package/dist/cli.js +755 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.js +284 -0
- package/dist/dedup/files.d.ts +1 -0
- package/dist/dedup/files.js +74 -0
- package/dist/dedup/findings.d.ts +41 -0
- package/dist/dedup/findings.js +211 -0
- package/dist/detectors/_common/access-control.d.ts +204 -0
- package/dist/detectors/_common/access-control.js +377 -0
- package/dist/detectors/_common/ast.d.ts +139 -0
- package/dist/detectors/_common/ast.js +239 -0
- package/dist/detectors/_common/compiler-profile.d.ts +14 -0
- package/dist/detectors/_common/compiler-profile.js +66 -0
- package/dist/detectors/_common/dataflow.d.ts +75 -0
- package/dist/detectors/_common/dataflow.js +57 -0
- package/dist/detectors/_common/fhe.d.ts +7 -0
- package/dist/detectors/_common/fhe.js +40 -0
- package/dist/detectors/_common/integer-overflow-helpers.d.ts +58 -0
- package/dist/detectors/_common/integer-overflow-helpers.js +422 -0
- package/dist/detectors/_common/loop-call-stack.d.ts +9 -0
- package/dist/detectors/_common/loop-call-stack.js +132 -0
- package/dist/detectors/_common/oracle.d.ts +5 -0
- package/dist/detectors/_common/oracle.js +64 -0
- package/dist/detectors/_common/price-rate.d.ts +116 -0
- package/dist/detectors/_common/price-rate.js +446 -0
- package/dist/detectors/_common/source-text.d.ts +11 -0
- package/dist/detectors/_common/source-text.js +82 -0
- package/dist/detectors/_common/weighted-pool-invariant.d.ts +21 -0
- package/dist/detectors/_common/weighted-pool-invariant.js +105 -0
- package/dist/detectors/aave-v2-reentrancy.d.ts +7 -0
- package/dist/detectors/aave-v2-reentrancy.js +286 -0
- package/dist/detectors/access-control.d.ts +103 -0
- package/dist/detectors/access-control.js +983 -0
- package/dist/detectors/add-reentrancy-on-weth-contract.d.ts +7 -0
- package/dist/detectors/add-reentrancy-on-weth-contract.js +536 -0
- package/dist/detectors/ai-generated-randomness.d.ts +32 -0
- package/dist/detectors/ai-generated-randomness.js +239 -0
- package/dist/detectors/amm-spot-oracle-manipulation.d.ts +52 -0
- package/dist/detectors/amm-spot-oracle-manipulation.js +420 -0
- package/dist/detectors/analyzing-the-uniswap-v3-exploit.d.ts +26 -0
- package/dist/detectors/analyzing-the-uniswap-v3-exploit.js +279 -0
- package/dist/detectors/any-token-is-destroyed.d.ts +34 -0
- package/dist/detectors/any-token-is-destroyed.js +527 -0
- package/dist/detectors/anyswap-anytoken-permit-allowance-drain.d.ts +7 -0
- package/dist/detectors/anyswap-anytoken-permit-allowance-drain.js +524 -0
- package/dist/detectors/anyswap-insufficient-token-validation.d.ts +24 -0
- package/dist/detectors/anyswap-insufficient-token-validation.js +342 -0
- package/dist/detectors/approval-based-drain.d.ts +7 -0
- package/dist/detectors/approval-based-drain.js +772 -0
- package/dist/detectors/arbitrary-account-balance-transfer.d.ts +7 -0
- package/dist/detectors/arbitrary-account-balance-transfer.js +485 -0
- package/dist/detectors/arbitrary-address-spoofing-attack.d.ts +7 -0
- package/dist/detectors/arbitrary-address-spoofing-attack.js +444 -0
- package/dist/detectors/arbitrary-address-spoofing.d.ts +9 -0
- package/dist/detectors/arbitrary-address-spoofing.js +657 -0
- package/dist/detectors/arbitrary-call-error.d.ts +127 -0
- package/dist/detectors/arbitrary-call-error.js +1163 -0
- package/dist/detectors/arbitrary-call.d.ts +4 -0
- package/dist/detectors/arbitrary-call.js +11 -0
- package/dist/detectors/arbitrary-delegatecall-target.d.ts +35 -0
- package/dist/detectors/arbitrary-delegatecall-target.js +554 -0
- package/dist/detectors/arbitrary-recipient-no-access-control.d.ts +7 -0
- package/dist/detectors/arbitrary-recipient-no-access-control.js +638 -0
- package/dist/detectors/arbitrary-storage-proof-forgery.d.ts +35 -0
- package/dist/detectors/arbitrary-storage-proof-forgery.js +340 -0
- package/dist/detectors/arbitrary-transfer-from.d.ts +38 -0
- package/dist/detectors/arbitrary-transfer-from.js +339 -0
- package/dist/detectors/arbitrum-cross-chain-message-replay.d.ts +22 -0
- package/dist/detectors/arbitrum-cross-chain-message-replay.js +477 -0
- package/dist/detectors/avs-slashing-without-quorum-check.d.ts +50 -0
- package/dist/detectors/avs-slashing-without-quorum-check.js +386 -0
- package/dist/detectors/bad-debt-propagation.d.ts +13 -0
- package/dist/detectors/bad-debt-propagation.js +480 -0
- package/dist/detectors/bad-k-value-verification.d.ts +7 -0
- package/dist/detectors/bad-k-value-verification.js +512 -0
- package/dist/detectors/bad-randomness-zero-blockhash.d.ts +29 -0
- package/dist/detectors/bad-randomness-zero-blockhash.js +115 -0
- package/dist/detectors/balancer-flash-loan-manipulation.d.ts +33 -0
- package/dist/detectors/balancer-flash-loan-manipulation.js +178 -0
- package/dist/detectors/balancer-pause-guard.d.ts +33 -0
- package/dist/detectors/balancer-pause-guard.js +307 -0
- package/dist/detectors/balancer-weighted-pool-flash-loan.d.ts +42 -0
- package/dist/detectors/balancer-weighted-pool-flash-loan.js +275 -0
- package/dist/detectors/batch-transfer-overflow.d.ts +7 -0
- package/dist/detectors/batch-transfer-overflow.js +465 -0
- package/dist/detectors/beneficiary-validation.d.ts +7 -0
- package/dist/detectors/beneficiary-validation.js +696 -0
- package/dist/detectors/borrow-behalf-consent.d.ts +7 -0
- package/dist/detectors/borrow-behalf-consent.js +400 -0
- package/dist/detectors/break-continue-scope.d.ts +7 -0
- package/dist/detectors/break-continue-scope.js +194 -0
- package/dist/detectors/bridge-accounting-bypass.d.ts +65 -0
- package/dist/detectors/bridge-accounting-bypass.js +449 -0
- package/dist/detectors/bridge-business-logic-flaw-incorrect-acc.d.ts +43 -0
- package/dist/detectors/bridge-business-logic-flaw-incorrect-acc.js +394 -0
- package/dist/detectors/bridge-collateral-drain.d.ts +7 -0
- package/dist/detectors/bridge-collateral-drain.js +630 -0
- package/dist/detectors/bridge-forged-proof.d.ts +7 -0
- package/dist/detectors/bridge-forged-proof.js +754 -0
- package/dist/detectors/bridge-missing-message-nonce.d.ts +57 -0
- package/dist/detectors/bridge-missing-message-nonce.js +638 -0
- package/dist/detectors/bridge-swap-metapool-attack.d.ts +20 -0
- package/dist/detectors/bridge-swap-metapool-attack.js +230 -0
- package/dist/detectors/business-logic-flaw-flashloan-price-mani.d.ts +7 -0
- package/dist/detectors/business-logic-flaw-flashloan-price-mani.js +353 -0
- package/dist/detectors/business-logic-flaw-incorrect-recipient-balance.d.ts +7 -0
- package/dist/detectors/business-logic-flaw-incorrect-recipient-balance.js +403 -0
- package/dist/detectors/business-logic-flaw.d.ts +21 -0
- package/dist/detectors/business-logic-flaw.js +339 -0
- package/dist/detectors/business-logic.d.ts +17 -0
- package/dist/detectors/business-logic.js +22 -0
- package/dist/detectors/bypassed-insolvency-check.d.ts +30 -0
- package/dist/detectors/bypassed-insolvency-check.js +232 -0
- package/dist/detectors/bytecode-divergence-risk.d.ts +32 -0
- package/dist/detectors/bytecode-divergence-risk.js +150 -0
- package/dist/detectors/cache-array-length.d.ts +30 -0
- package/dist/detectors/cache-array-length.js +177 -0
- package/dist/detectors/cache-storage-reads.d.ts +46 -0
- package/dist/detectors/cache-storage-reads.js +323 -0
- package/dist/detectors/calldata-secret-access-control.d.ts +36 -0
- package/dist/detectors/calldata-secret-access-control.js +446 -0
- package/dist/detectors/capital-cross-contract-reentrancy.d.ts +34 -0
- package/dist/detectors/capital-cross-contract-reentrancy.js +481 -0
- package/dist/detectors/cartel-custom-approval-logic.d.ts +7 -0
- package/dist/detectors/cartel-custom-approval-logic.js +407 -0
- package/dist/detectors/ccip-receiver-missing-replay-guard.d.ts +22 -0
- package/dist/detectors/ccip-receiver-missing-replay-guard.js +413 -0
- package/dist/detectors/chain-coupling-risk.d.ts +8 -0
- package/dist/detectors/chain-coupling-risk.js +203 -0
- package/dist/detectors/chainlink-deprecated-function.d.ts +7 -0
- package/dist/detectors/chainlink-deprecated-function.js +205 -0
- package/dist/detectors/chainlink-tx-origin.d.ts +7 -0
- package/dist/detectors/chainlink-tx-origin.js +363 -0
- package/dist/detectors/check-effects-interactions.d.ts +39 -0
- package/dist/detectors/check-effects-interactions.js +783 -0
- package/dist/detectors/check-permit-missing-chainid.d.ts +27 -0
- package/dist/detectors/check-permit-missing-chainid.js +456 -0
- package/dist/detectors/classic-reentrancy.d.ts +93 -0
- package/dist/detectors/classic-reentrancy.js +645 -0
- package/dist/detectors/coinbase-morpho-wethloan-policy.d.ts +29 -0
- package/dist/detectors/coinbase-morpho-wethloan-policy.js +368 -0
- package/dist/detectors/compoundv2-inflation-attack.d.ts +7 -0
- package/dist/detectors/compoundv2-inflation-attack.js +675 -0
- package/dist/detectors/constructor-address-validation.d.ts +24 -0
- package/dist/detectors/constructor-address-validation.js +335 -0
- package/dist/detectors/constructor-interface-no-address-validation.d.ts +32 -0
- package/dist/detectors/constructor-interface-no-address-validation.js +283 -0
- package/dist/detectors/cross-chain-arbitrary-call.d.ts +7 -0
- package/dist/detectors/cross-chain-arbitrary-call.js +601 -0
- package/dist/detectors/cross-chain-input-validation.d.ts +31 -0
- package/dist/detectors/cross-chain-input-validation.js +347 -0
- package/dist/detectors/cross-chain-intent-replay.d.ts +38 -0
- package/dist/detectors/cross-chain-intent-replay.js +453 -0
- package/dist/detectors/cross-chain-intent-stale-resolution.d.ts +7 -0
- package/dist/detectors/cross-chain-intent-stale-resolution.js +463 -0
- package/dist/detectors/cross-chain-message-order-dependency.d.ts +8 -0
- package/dist/detectors/cross-chain-message-order-dependency.js +472 -0
- package/dist/detectors/cross-chain-message-replay.d.ts +8 -0
- package/dist/detectors/cross-chain-message-replay.js +568 -0
- package/dist/detectors/cross-chain-messaging.d.ts +7 -0
- package/dist/detectors/cross-chain-messaging.js +663 -0
- package/dist/detectors/cross-chain-msg-truncation.d.ts +7 -0
- package/dist/detectors/cross-chain-msg-truncation.js +453 -0
- package/dist/detectors/cross-chain-truncation.d.ts +7 -0
- package/dist/detectors/cross-chain-truncation.js +422 -0
- package/dist/detectors/cross-contract-integer-overflow.d.ts +76 -0
- package/dist/detectors/cross-contract-integer-overflow.js +554 -0
- package/dist/detectors/cross-contract-reentrancy-trusted-callee.d.ts +39 -0
- package/dist/detectors/cross-contract-reentrancy-trusted-callee.js +385 -0
- package/dist/detectors/cross-contract-reentrancy.d.ts +63 -0
- package/dist/detectors/cross-contract-reentrancy.js +631 -0
- package/dist/detectors/cross-function-reentrancy.d.ts +37 -0
- package/dist/detectors/cross-function-reentrancy.js +648 -0
- package/dist/detectors/cross-protocol-contagion.d.ts +20 -0
- package/dist/detectors/cross-protocol-contagion.js +445 -0
- package/dist/detectors/cross-protocol-oracle-collateral.d.ts +38 -0
- package/dist/detectors/cross-protocol-oracle-collateral.js +487 -0
- package/dist/detectors/cross-vm-reentrancy.d.ts +7 -0
- package/dist/detectors/cross-vm-reentrancy.js +484 -0
- package/dist/detectors/decimals-mismatch.d.ts +89 -0
- package/dist/detectors/decimals-mismatch.js +451 -0
- package/dist/detectors/deferred-state-update.d.ts +16 -0
- package/dist/detectors/deferred-state-update.js +35 -0
- package/dist/detectors/deflationary-token.d.ts +27 -0
- package/dist/detectors/deflationary-token.js +751 -0
- package/dist/detectors/delegate-transfer-unrestricted-caller.d.ts +44 -0
- package/dist/detectors/delegate-transfer-unrestricted-caller.js +410 -0
- package/dist/detectors/delegatecall-fallback-reentrancy-bypass.d.ts +14 -0
- package/dist/detectors/delegatecall-fallback-reentrancy-bypass.js +241 -0
- package/dist/detectors/delegatecall-in-loops.d.ts +7 -0
- package/dist/detectors/delegatecall-in-loops.js +129 -0
- package/dist/detectors/delegatecall-init-owner-mutator.d.ts +8 -0
- package/dist/detectors/delegatecall-init-owner-mutator.js +655 -0
- package/dist/detectors/delegatecall-init.d.ts +7 -0
- package/dist/detectors/delegatecall-init.js +769 -0
- package/dist/detectors/delegatecall-untrusted-implementation.d.ts +41 -0
- package/dist/detectors/delegatecall-untrusted-implementation.js +888 -0
- package/dist/detectors/delegated-authorization-bypass.d.ts +7 -0
- package/dist/detectors/delegated-authorization-bypass.js +370 -0
- package/dist/detectors/denial-of-service.d.ts +117 -0
- package/dist/detectors/denial-of-service.js +947 -0
- package/dist/detectors/division-before-multiplication.d.ts +7 -0
- package/dist/detectors/division-before-multiplication.js +303 -0
- package/dist/detectors/dn404-mirror-access-control.d.ts +26 -0
- package/dist/detectors/dn404-mirror-access-control.js +315 -0
- package/dist/detectors/doge-flashloan.d.ts +29 -0
- package/dist/detectors/doge-flashloan.js +329 -0
- package/dist/detectors/donate-inflation-exchangerate-roundin.d.ts +7 -0
- package/dist/detectors/donate-inflation-exchangerate-roundin.js +621 -0
- package/dist/detectors/donation-share-inflation.d.ts +24 -0
- package/dist/detectors/donation-share-inflation.js +466 -0
- package/dist/detectors/dont-let-eth-get-rekt.d.ts +84 -0
- package/dist/detectors/dont-let-eth-get-rekt.js +1151 -0
- package/dist/detectors/dos-unbounded-loop-external-call-revert.d.ts +37 -0
- package/dist/detectors/dos-unbounded-loop-external-call-revert.js +541 -0
- package/dist/detectors/eip1167-proxy-reentrancy.d.ts +7 -0
- package/dist/detectors/eip1167-proxy-reentrancy.js +508 -0
- package/dist/detectors/eip4626-vault-reentrancy.d.ts +32 -0
- package/dist/detectors/eip4626-vault-reentrancy.js +312 -0
- package/dist/detectors/eip5792-auth-replay.d.ts +45 -0
- package/dist/detectors/eip5792-auth-replay.js +519 -0
- package/dist/detectors/eip712-domain-separator.d.ts +42 -0
- package/dist/detectors/eip712-domain-separator.js +524 -0
- package/dist/detectors/eip712-signature-verification.d.ts +49 -0
- package/dist/detectors/eip712-signature-verification.js +689 -0
- package/dist/detectors/eip7702-auth-replay.d.ts +7 -0
- package/dist/detectors/eip7702-auth-replay.js +768 -0
- package/dist/detectors/eip7702-cross-chain-replay.d.ts +27 -0
- package/dist/detectors/eip7702-cross-chain-replay.js +307 -0
- package/dist/detectors/eip7702-delegated-eoa-approval-race.d.ts +39 -0
- package/dist/detectors/eip7702-delegated-eoa-approval-race.js +413 -0
- package/dist/detectors/eip7702-delegation-reentrancy.d.ts +21 -0
- package/dist/detectors/eip7702-delegation-reentrancy.js +705 -0
- package/dist/detectors/eip7702-delegation-risk.d.ts +7 -0
- package/dist/detectors/eip7702-delegation-risk.js +745 -0
- package/dist/detectors/eip7702-eoa-assumption.d.ts +57 -0
- package/dist/detectors/eip7702-eoa-assumption.js +461 -0
- package/dist/detectors/erc1155-batch-missing-per-id-approval.d.ts +23 -0
- package/dist/detectors/erc1155-batch-missing-per-id-approval.js +343 -0
- package/dist/detectors/erc1155-reentrancy.d.ts +31 -0
- package/dist/detectors/erc1155-reentrancy.js +217 -0
- package/dist/detectors/erc1271-stub-implementation.d.ts +21 -0
- package/dist/detectors/erc1271-stub-implementation.js +268 -0
- package/dist/detectors/erc20-safe-wrapper-return-unchecked.d.ts +43 -0
- package/dist/detectors/erc20-safe-wrapper-return-unchecked.js +368 -0
- package/dist/detectors/erc20-unchecked-non-standard-return.d.ts +55 -0
- package/dist/detectors/erc20-unchecked-non-standard-return.js +454 -0
- package/dist/detectors/erc2612-permit-frontrunning.d.ts +23 -0
- package/dist/detectors/erc2612-permit-frontrunning.js +246 -0
- package/dist/detectors/erc2771-context-spoofing.d.ts +41 -0
- package/dist/detectors/erc2771-context-spoofing.js +510 -0
- package/dist/detectors/erc4337-validation-storage-access.d.ts +35 -0
- package/dist/detectors/erc4337-validation-storage-access.js +232 -0
- package/dist/detectors/erc4626-totalassets-stub.d.ts +17 -0
- package/dist/detectors/erc4626-totalassets-stub.js +216 -0
- package/dist/detectors/erc6909-balance-overflow.d.ts +7 -0
- package/dist/detectors/erc6909-balance-overflow.js +688 -0
- package/dist/detectors/erc6909-operator-scope.d.ts +49 -0
- package/dist/detectors/erc6909-operator-scope.js +494 -0
- package/dist/detectors/erc721-unchecked-transfer.d.ts +38 -0
- package/dist/detectors/erc721-unchecked-transfer.js +364 -0
- package/dist/detectors/erc7579-module-install-without-threshold.d.ts +40 -0
- package/dist/detectors/erc7579-module-install-without-threshold.js +338 -0
- package/dist/detectors/erc7683-fill-validation.d.ts +53 -0
- package/dist/detectors/erc7683-fill-validation.js +758 -0
- package/dist/detectors/erc7683-intent-resolution.d.ts +7 -0
- package/dist/detectors/erc7683-intent-resolution.js +457 -0
- package/dist/detectors/erc777-callback-reentrancy.d.ts +8 -0
- package/dist/detectors/erc777-callback-reentrancy.js +439 -0
- package/dist/detectors/erc777-reentrancy.d.ts +7 -0
- package/dist/detectors/erc777-reentrancy.js +488 -0
- package/dist/detectors/erc777-tokens-to-send-reentrancy.d.ts +47 -0
- package/dist/detectors/erc777-tokens-to-send-reentrancy.js +674 -0
- package/dist/detectors/estuary-token-flaw.d.ts +16 -0
- package/dist/detectors/estuary-token-flaw.js +547 -0
- package/dist/detectors/euler-debt-token-manipulation.d.ts +32 -0
- package/dist/detectors/euler-debt-token-manipulation.js +347 -0
- package/dist/detectors/exploiting-a-vulnerability-in-curve-fina.d.ts +29 -0
- package/dist/detectors/exploiting-a-vulnerability-in-curve-fina.js +210 -0
- package/dist/detectors/fallback-delegatecall-reentrancy.d.ts +14 -0
- package/dist/detectors/fallback-delegatecall-reentrancy.js +236 -0
- package/dist/detectors/farm-business-logic-flaw-lack-of-access.d.ts +7 -0
- package/dist/detectors/farm-business-logic-flaw-lack-of-access.js +665 -0
- package/dist/detectors/fee-mechanism-exploitation.d.ts +20 -0
- package/dist/detectors/fee-mechanism-exploitation.js +400 -0
- package/dist/detectors/fee-on-transfer-balance-mismatch.d.ts +49 -0
- package/dist/detectors/fee-on-transfer-balance-mismatch.js +394 -0
- package/dist/detectors/fhe-encrypted-input-validation.d.ts +29 -0
- package/dist/detectors/fhe-encrypted-input-validation.js +210 -0
- package/dist/detectors/fhe-handle-leakage.d.ts +44 -0
- package/dist/detectors/fhe-handle-leakage.js +315 -0
- package/dist/detectors/fhe-oz-pattern-misuse.d.ts +26 -0
- package/dist/detectors/fhe-oz-pattern-misuse.js +311 -0
- package/dist/detectors/fhe-state-leakage.d.ts +8 -0
- package/dist/detectors/fhe-state-leakage.js +400 -0
- package/dist/detectors/fi-bridges.d.ts +33 -0
- package/dist/detectors/fi-bridges.js +428 -0
- package/dist/detectors/finance-access-control-price-oracle-man.d.ts +9 -0
- package/dist/detectors/finance-access-control-price-oracle-man.js +640 -0
- package/dist/detectors/finance-bridge-address0safetransferfrom.d.ts +8 -0
- package/dist/detectors/finance-bridge-address0safetransferfrom.js +574 -0
- package/dist/detectors/finance-business-logic-in-mint.d.ts +54 -0
- package/dist/detectors/finance-business-logic-in-mint.js +687 -0
- package/dist/detectors/finance-erc667-reentrancy.d.ts +7 -0
- package/dist/detectors/finance-erc667-reentrancy.js +509 -0
- package/dist/detectors/finance-flashloan-price-oracle-manipul.d.ts +7 -0
- package/dist/detectors/finance-flashloan-price-oracle-manipul.js +546 -0
- package/dist/detectors/finance-flashloan-reentrancy.d.ts +7 -0
- package/dist/detectors/finance-flashloan-reentrancy.js +547 -0
- package/dist/detectors/finance-swap-metapool-attack.d.ts +19 -0
- package/dist/detectors/finance-swap-metapool-attack.js +321 -0
- package/dist/detectors/flashloan-price-manipulation.d.ts +7 -0
- package/dist/detectors/flashloan-price-manipulation.js +950 -0
- package/dist/detectors/flashloan-reentrancy-rari.d.ts +28 -0
- package/dist/detectors/flashloan-reentrancy-rari.js +577 -0
- package/dist/detectors/flashloan-reentrancy.d.ts +7 -0
- package/dist/detectors/flashloan-reentrancy.js +383 -0
- package/dist/detectors/flashloan-token-migrate.d.ts +7 -0
- package/dist/detectors/flashloan-token-migrate.js +274 -0
- package/dist/detectors/force-fed-eth-state-corruption.d.ts +32 -0
- package/dist/detectors/force-fed-eth-state-corruption.js +293 -0
- package/dist/detectors/free-mint-bug.d.ts +41 -0
- package/dist/detectors/free-mint-bug.js +483 -0
- package/dist/detectors/front-running-orderbook-state-update.d.ts +37 -0
- package/dist/detectors/front-running-orderbook-state-update.js +471 -0
- package/dist/detectors/front-running-shared-collateral-write.d.ts +41 -0
- package/dist/detectors/front-running-shared-collateral-write.js +508 -0
- package/dist/detectors/fusion-v1-settlement-arbitrary-yul-calld.d.ts +30 -0
- package/dist/detectors/fusion-v1-settlement-arbitrary-yul-calld.js +354 -0
- package/dist/detectors/generalized-frontrunning.d.ts +7 -0
- package/dist/detectors/generalized-frontrunning.js +836 -0
- package/dist/detectors/governance-flash-loan.d.ts +62 -0
- package/dist/detectors/governance-flash-loan.js +452 -0
- package/dist/detectors/governance-flashloan-vote.d.ts +41 -0
- package/dist/detectors/governance-flashloan-vote.js +272 -0
- package/dist/detectors/halborn-security-report-aave-v3.d.ts +6 -0
- package/dist/detectors/halborn-security-report-aave-v3.js +357 -0
- package/dist/detectors/incorrect-access-control.d.ts +26 -0
- package/dist/detectors/incorrect-access-control.js +328 -0
- package/dist/detectors/incorrect-burn-accounting.d.ts +10 -0
- package/dist/detectors/incorrect-burn-accounting.js +387 -0
- package/dist/detectors/incorrect-dividends-calculation.d.ts +27 -0
- package/dist/detectors/incorrect-dividends-calculation.js +524 -0
- package/dist/detectors/incorrect-dividends.d.ts +27 -0
- package/dist/detectors/incorrect-dividends.js +485 -0
- package/dist/detectors/incorrect-input-validation.d.ts +23 -0
- package/dist/detectors/incorrect-input-validation.js +312 -0
- package/dist/detectors/incorrect-signature-verification.d.ts +26 -0
- package/dist/detectors/incorrect-signature-verification.js +530 -0
- package/dist/detectors/infinite-loop.d.ts +7 -0
- package/dist/detectors/infinite-loop.js +440 -0
- package/dist/detectors/infinite-number-of-loans.d.ts +13 -0
- package/dist/detectors/infinite-number-of-loans.js +565 -0
- package/dist/detectors/inheritance-override.d.ts +26 -0
- package/dist/detectors/inheritance-override.js +320 -0
- package/dist/detectors/initialization-access-control.d.ts +8 -0
- package/dist/detectors/initialization-access-control.js +659 -0
- package/dist/detectors/insecure-randomness.d.ts +73 -0
- package/dist/detectors/insecure-randomness.js +610 -0
- package/dist/detectors/insufficient-access-control-trusted-param.d.ts +39 -0
- package/dist/detectors/insufficient-access-control-trusted-param.js +356 -0
- package/dist/detectors/insufficient-dvn-threshold.d.ts +32 -0
- package/dist/detectors/insufficient-dvn-threshold.js +585 -0
- package/dist/detectors/integer-overflow-detector.d.ts +45 -0
- package/dist/detectors/integer-overflow-detector.js +284 -0
- package/dist/detectors/integer-overflow.d.ts +95 -0
- package/dist/detectors/integer-overflow.js +344 -0
- package/dist/detectors/integer-underflow.d.ts +7 -0
- package/dist/detectors/integer-underflow.js +422 -0
- package/dist/detectors/intent-settlement-balance-manipulation.d.ts +22 -0
- package/dist/detectors/intent-settlement-balance-manipulation.js +548 -0
- package/dist/detectors/l1-to-l2-message-reentrancy.d.ts +7 -0
- package/dist/detectors/l1-to-l2-message-reentrancy.js +545 -0
- package/dist/detectors/l2-withdrawal-validation.d.ts +8 -0
- package/dist/detectors/l2-withdrawal-validation.js +303 -0
- package/dist/detectors/lack-of-access-control.d.ts +7 -0
- package/dist/detectors/lack-of-access-control.js +425 -0
- package/dist/detectors/lack-of-calldata-validation.d.ts +16 -0
- package/dist/detectors/lack-of-calldata-validation.js +914 -0
- package/dist/detectors/lack-of-input-validation-reentrancy.d.ts +7 -0
- package/dist/detectors/lack-of-input-validation-reentrancy.js +637 -0
- package/dist/detectors/lack-of-slippage-control.d.ts +7 -0
- package/dist/detectors/lack-of-slippage-control.js +513 -0
- package/dist/detectors/lack-of-slippage-protection.d.ts +7 -0
- package/dist/detectors/lack-of-slippage-protection.js +474 -0
- package/dist/detectors/lack-of-validation-data.d.ts +23 -0
- package/dist/detectors/lack-of-validation-data.js +391 -0
- package/dist/detectors/lack-of-validation-pool.d.ts +7 -0
- package/dist/detectors/lack-of-validation-pool.js +492 -0
- package/dist/detectors/lack-of-validation-userdata.d.ts +7 -0
- package/dist/detectors/lack-of-validation-userdata.js +583 -0
- package/dist/detectors/lack-of-validation.d.ts +27 -0
- package/dist/detectors/lack-of-validation.js +609 -0
- package/dist/detectors/layerzero-dvn-quorum-missing.d.ts +22 -0
- package/dist/detectors/layerzero-dvn-quorum-missing.js +464 -0
- package/dist/detectors/layerzero-v2-unverified-origin.d.ts +40 -0
- package/dist/detectors/layerzero-v2-unverified-origin.js +368 -0
- package/dist/detectors/liquidation-accounting-desync.d.ts +14 -0
- package/dist/detectors/liquidation-accounting-desync.js +145 -0
- package/dist/detectors/liquidation-gain-manipulation.d.ts +42 -0
- package/dist/detectors/liquidation-gain-manipulation.js +606 -0
- package/dist/detectors/liquidation-price-rounding-advantage.d.ts +26 -0
- package/dist/detectors/liquidation-price-rounding-advantage.js +283 -0
- package/dist/detectors/liquidity-poisoning.d.ts +25 -0
- package/dist/detectors/liquidity-poisoning.js +339 -0
- package/dist/detectors/loans-malicious-proposal-price-oracle.d.ts +44 -0
- package/dist/detectors/loans-malicious-proposal-price-oracle.js +813 -0
- package/dist/detectors/logic-flaw.d.ts +186 -0
- package/dist/detectors/logic-flaw.js +3356 -0
- package/dist/detectors/manipulation-of-funds.d.ts +31 -0
- package/dist/detectors/manipulation-of-funds.js +304 -0
- package/dist/detectors/merkl-unsafe-claim-callback.d.ts +22 -0
- package/dist/detectors/merkl-unsafe-claim-callback.js +94 -0
- package/dist/detectors/mev-boost-timestamp.d.ts +7 -0
- package/dist/detectors/mev-boost-timestamp.js +318 -0
- package/dist/detectors/mev-merge-exploit.d.ts +29 -0
- package/dist/detectors/mev-merge-exploit.js +397 -0
- package/dist/detectors/mev-sandwich-vulnerability.d.ts +24 -0
- package/dist/detectors/mev-sandwich-vulnerability.js +648 -0
- package/dist/detectors/mev-slot-manipulation.d.ts +36 -0
- package/dist/detectors/mev-slot-manipulation.js +691 -0
- package/dist/detectors/mevbot-insufficient-validation.d.ts +48 -0
- package/dist/detectors/mevbot-insufficient-validation.js +574 -0
- package/dist/detectors/migration-rebalance-without-bound.d.ts +7 -0
- package/dist/detectors/migration-rebalance-without-bound.js +514 -0
- package/dist/detectors/mint-hardcoded-asset-parity.d.ts +31 -0
- package/dist/detectors/mint-hardcoded-asset-parity.js +356 -0
- package/dist/detectors/miscalculation-on-spendallowance.d.ts +7 -0
- package/dist/detectors/miscalculation-on-spendallowance.js +188 -0
- package/dist/detectors/misconfiguration.d.ts +27 -0
- package/dist/detectors/misconfiguration.js +410 -0
- package/dist/detectors/missing-access-control-caller-supplied-auth.d.ts +7 -0
- package/dist/detectors/missing-access-control-caller-supplied-auth.js +550 -0
- package/dist/detectors/missing-access-control-receiver-payout.d.ts +7 -0
- package/dist/detectors/missing-access-control-receiver-payout.js +460 -0
- package/dist/detectors/missing-access-control-role-or-transferfrom.d.ts +7 -0
- package/dist/detectors/missing-access-control-role-or-transferfrom.js +663 -0
- package/dist/detectors/missing-access-control.d.ts +19 -0
- package/dist/detectors/missing-access-control.js +781 -0
- package/dist/detectors/missing-sequencer-uptime-check.d.ts +30 -0
- package/dist/detectors/missing-sequencer-uptime-check.js +348 -0
- package/dist/detectors/missing-storage-gap.d.ts +19 -0
- package/dist/detectors/missing-storage-gap.js +193 -0
- package/dist/detectors/missing-swap-deadline-slippage.d.ts +31 -0
- package/dist/detectors/missing-swap-deadline-slippage.js +231 -0
- package/dist/detectors/missing-zk-proof-verification.d.ts +60 -0
- package/dist/detectors/missing-zk-proof-verification.js +547 -0
- package/dist/detectors/my-experience-with-yearn-finance.d.ts +7 -0
- package/dist/detectors/my-experience-with-yearn-finance.js +552 -0
- package/dist/detectors/network-bridge-ronin.d.ts +7 -0
- package/dist/detectors/network-bridge-ronin.js +408 -0
- package/dist/detectors/network-bridge.d.ts +7 -0
- package/dist/detectors/network-bridge.js +444 -0
- package/dist/detectors/network-underflow.d.ts +7 -0
- package/dist/detectors/network-underflow.js +517 -0
- package/dist/detectors/nft-denial-of-service.d.ts +7 -0
- package/dist/detectors/nft-denial-of-service.js +223 -0
- package/dist/detectors/nft-marketplace-order-reentrancy.d.ts +7 -0
- package/dist/detectors/nft-marketplace-order-reentrancy.js +427 -0
- package/dist/detectors/nft-token-standard-access-control.d.ts +7 -0
- package/dist/detectors/nft-token-standard-access-control.js +455 -0
- package/dist/detectors/oracle-manipulation-amm-spot-price.d.ts +42 -0
- package/dist/detectors/oracle-manipulation-amm-spot-price.js +321 -0
- package/dist/detectors/oracle-manipulation-liquidity-withdrawal.d.ts +27 -0
- package/dist/detectors/oracle-manipulation-liquidity-withdrawal.js +192 -0
- package/dist/detectors/oracle-manipulation.d.ts +90 -0
- package/dist/detectors/oracle-manipulation.js +1023 -0
- package/dist/detectors/oracle-vortex-manipulation.d.ts +30 -0
- package/dist/detectors/oracle-vortex-manipulation.js +473 -0
- package/dist/detectors/overpriced-asset-in-oracle.d.ts +41 -0
- package/dist/detectors/overpriced-asset-in-oracle.js +420 -0
- package/dist/detectors/oz-access-control-roles.d.ts +33 -0
- package/dist/detectors/oz-access-control-roles.js +359 -0
- package/dist/detectors/pair-manipulation-transfer-hook.d.ts +38 -0
- package/dist/detectors/pair-manipulation-transfer-hook.js +366 -0
- package/dist/detectors/parameter-access-control.d.ts +47 -0
- package/dist/detectors/parameter-access-control.js +511 -0
- package/dist/detectors/parameter-manipulation.d.ts +7 -0
- package/dist/detectors/parameter-manipulation.js +505 -0
- package/dist/detectors/parity-multisig-delegatecall.d.ts +7 -0
- package/dist/detectors/parity-multisig-delegatecall.js +707 -0
- package/dist/detectors/permissionless-claim-amm-spot-pricing.d.ts +7 -0
- package/dist/detectors/permissionless-claim-amm-spot-pricing.js +351 -0
- package/dist/detectors/permit-future-dated-deadline.d.ts +31 -0
- package/dist/detectors/permit-future-dated-deadline.js +339 -0
- package/dist/detectors/phishing-attack-bybit.d.ts +37 -0
- package/dist/detectors/phishing-attack-bybit.js +513 -0
- package/dist/detectors/post-insolvency-check.d.ts +7 -0
- package/dist/detectors/post-insolvency-check.js +277 -0
- package/dist/detectors/precision-loss-vulnerability.d.ts +7 -0
- package/dist/detectors/precision-loss-vulnerability.js +472 -0
- package/dist/detectors/precision-truncation.d.ts +8 -0
- package/dist/detectors/precision-truncation.js +425 -0
- package/dist/detectors/price-dependency-veth.d.ts +41 -0
- package/dist/detectors/price-dependency-veth.js +588 -0
- package/dist/detectors/price-feed-verification.d.ts +7 -0
- package/dist/detectors/price-feed-verification.js +557 -0
- package/dist/detectors/price-manipulation-reentrancy.d.ts +32 -0
- package/dist/detectors/price-manipulation-reentrancy.js +445 -0
- package/dist/detectors/price-manipulation-via-reentranc.d.ts +7 -0
- package/dist/detectors/price-manipulation-via-reentranc.js +569 -0
- package/dist/detectors/price-oracle-manipulation.d.ts +25 -0
- package/dist/detectors/price-oracle-manipulation.js +530 -0
- package/dist/detectors/project-instant-rewards-unlocked.d.ts +6 -0
- package/dist/detectors/project-instant-rewards-unlocked.js +462 -0
- package/dist/detectors/protocol-reentrancy.d.ts +7 -0
- package/dist/detectors/protocol-reentrancy.js +457 -0
- package/dist/detectors/proxy-init-race.d.ts +11 -0
- package/dist/detectors/proxy-init-race.js +634 -0
- package/dist/detectors/proxy-storage-slot-collision.d.ts +7 -0
- package/dist/detectors/proxy-storage-slot-collision.js +135 -0
- package/dist/detectors/public-internal-function.d.ts +39 -0
- package/dist/detectors/public-internal-function.js +233 -0
- package/dist/detectors/quote-silent-zero.d.ts +25 -0
- package/dist/detectors/quote-silent-zero.js +156 -0
- package/dist/detectors/readonly-reentrancy.d.ts +9 -0
- package/dist/detectors/readonly-reentrancy.js +108 -0
- package/dist/detectors/receipt-redemption-missing-validation.d.ts +31 -0
- package/dist/detectors/receipt-redemption-missing-validation.js +453 -0
- package/dist/detectors/reentrancy-balance.d.ts +36 -0
- package/dist/detectors/reentrancy-balance.js +577 -0
- package/dist/detectors/reentrancy-business-logic-game.d.ts +36 -0
- package/dist/detectors/reentrancy-business-logic-game.js +616 -0
- package/dist/detectors/reentrancy-on-sell-nft.d.ts +23 -0
- package/dist/detectors/reentrancy-on-sell-nft.js +510 -0
- package/dist/detectors/reflection-token-balance-desync.d.ts +28 -0
- package/dist/detectors/reflection-token-balance-desync.js +246 -0
- package/dist/detectors/registry-engine.d.ts +34 -0
- package/dist/detectors/registry-engine.js +388 -0
- package/dist/detectors/rollup-unvalidated-state-update.d.ts +35 -0
- package/dist/detectors/rollup-unvalidated-state-update.js +286 -0
- package/dist/detectors/s-horizon-bridge-private-key-compromis.d.ts +8 -0
- package/dist/detectors/s-horizon-bridge-private-key-compromis.js +615 -0
- package/dist/detectors/share-price-manipulation.d.ts +7 -0
- package/dist/detectors/share-price-manipulation.js +653 -0
- package/dist/detectors/signature-replay.d.ts +30 -0
- package/dist/detectors/signature-replay.js +367 -0
- package/dist/detectors/simpleswap-unverified-approval.d.ts +27 -0
- package/dist/detectors/simpleswap-unverified-approval.js +198 -0
- package/dist/detectors/single-spot-oracle-collateral-valuation.d.ts +22 -0
- package/dist/detectors/single-spot-oracle-collateral-valuation.js +419 -0
- package/dist/detectors/skim-token-balance.d.ts +7 -0
- package/dist/detectors/skim-token-balance.js +788 -0
- package/dist/detectors/sky-oft-governance-payload.d.ts +7 -0
- package/dist/detectors/sky-oft-governance-payload.js +515 -0
- package/dist/detectors/sky-oft-governance-truncation.d.ts +32 -0
- package/dist/detectors/sky-oft-governance-truncation.js +377 -0
- package/dist/detectors/solana-evm-bridge-truncation.d.ts +7 -0
- package/dist/detectors/solana-evm-bridge-truncation.js +638 -0
- package/dist/detectors/solhint-unchecked-low-level-call.d.ts +74 -0
- package/dist/detectors/solhint-unchecked-low-level-call.js +463 -0
- package/dist/detectors/stablecoin-pair-spot-oracle.d.ts +7 -0
- package/dist/detectors/stablecoin-pair-spot-oracle.js +364 -0
- package/dist/detectors/staked-rate-as-oracle.d.ts +44 -0
- package/dist/detectors/staked-rate-as-oracle.js +497 -0
- package/dist/detectors/stale-oracle.d.ts +63 -0
- package/dist/detectors/stale-oracle.js +649 -0
- package/dist/detectors/starkware-proof-validation-gap.d.ts +18 -0
- package/dist/detectors/starkware-proof-validation-gap.js +629 -0
- package/dist/detectors/steth-transfer-reentrancy.d.ts +8 -0
- package/dist/detectors/steth-transfer-reentrancy.js +317 -0
- package/dist/detectors/storage-collision-malicious-proposal.d.ts +27 -0
- package/dist/detectors/storage-collision-malicious-proposal.js +386 -0
- package/dist/detectors/timestamp-manipulation.d.ts +49 -0
- package/dist/detectors/timestamp-manipulation.js +383 -0
- package/dist/detectors/token-access-control.d.ts +7 -0
- package/dist/detectors/token-access-control.js +544 -0
- package/dist/detectors/token-incorrect-signature-verification.d.ts +23 -0
- package/dist/detectors/token-incorrect-signature-verification.js +434 -0
- package/dist/detectors/token-transfer-logic-flaw.d.ts +33 -0
- package/dist/detectors/token-transfer-logic-flaw.js +267 -0
- package/dist/detectors/transfer-double-debit-pool-recipient.d.ts +7 -0
- package/dist/detectors/transfer-double-debit-pool-recipient.js +542 -0
- package/dist/detectors/treasury-reentrancy.d.ts +7 -0
- package/dist/detectors/treasury-reentrancy.js +442 -0
- package/dist/detectors/tstore-poison.d.ts +32 -0
- package/dist/detectors/tstore-poison.js +417 -0
- package/dist/detectors/tstore-race-condition.d.ts +7 -0
- package/dist/detectors/tstore-race-condition.js +632 -0
- package/dist/detectors/types.d.ts +85 -0
- package/dist/detectors/types.js +20 -0
- package/dist/detectors/unauthorized-payer-transferfrom.d.ts +66 -0
- package/dist/detectors/unauthorized-payer-transferfrom.js +339 -0
- package/dist/detectors/unauthorized-transferfrom-shell.d.ts +7 -0
- package/dist/detectors/unauthorized-transferfrom-shell.js +504 -0
- package/dist/detectors/unauthorized-transferfrom.d.ts +16 -0
- package/dist/detectors/unauthorized-transferfrom.js +838 -0
- package/dist/detectors/unbound-zk-verifier-input.d.ts +7 -0
- package/dist/detectors/unbound-zk-verifier-input.js +445 -0
- package/dist/detectors/unbounded-share-price-collateral-oracle.d.ts +48 -0
- package/dist/detectors/unbounded-share-price-collateral-oracle.js +566 -0
- package/dist/detectors/uncapped-reward-emission.d.ts +7 -0
- package/dist/detectors/uncapped-reward-emission.js +493 -0
- package/dist/detectors/unchecked-call-forwarding.d.ts +31 -0
- package/dist/detectors/unchecked-call-forwarding.js +330 -0
- package/dist/detectors/unchecked-external-call-unconditional-state-mutation.d.ts +18 -0
- package/dist/detectors/unchecked-external-call-unconditional-state-mutation.js +311 -0
- package/dist/detectors/unchecked-external-call.d.ts +66 -0
- package/dist/detectors/unchecked-external-call.js +389 -0
- package/dist/detectors/unchecked-oft-return.d.ts +13 -0
- package/dist/detectors/unchecked-oft-return.js +118 -0
- package/dist/detectors/unguarded-governance-execution.d.ts +35 -0
- package/dist/detectors/unguarded-governance-execution.js +422 -0
- package/dist/detectors/unguarded-governance-executor.d.ts +35 -0
- package/dist/detectors/unguarded-governance-executor.js +349 -0
- package/dist/detectors/unindexed-event-address.d.ts +7 -0
- package/dist/detectors/unindexed-event-address.js +268 -0
- package/dist/detectors/uninitialized-implementation.d.ts +27 -0
- package/dist/detectors/uninitialized-implementation.js +333 -0
- package/dist/detectors/uninitialized-storage-pointer.d.ts +7 -0
- package/dist/detectors/uninitialized-storage-pointer.js +110 -0
- package/dist/detectors/uniswap-skim-token-balance-attack.d.ts +8 -0
- package/dist/detectors/uniswap-skim-token-balance-attack.js +331 -0
- package/dist/detectors/uniswap-v4-hook-state-manipulation.d.ts +7 -0
- package/dist/detectors/uniswap-v4-hook-state-manipulation.js +296 -0
- package/dist/detectors/unprotected-admin-or-fund-sink.d.ts +7 -0
- package/dist/detectors/unprotected-admin-or-fund-sink.js +643 -0
- package/dist/detectors/unprotected-dex-swap.d.ts +43 -0
- package/dist/detectors/unprotected-dex-swap.js +334 -0
- package/dist/detectors/unprotected-initializer.d.ts +7 -0
- package/dist/detectors/unprotected-initializer.js +707 -0
- package/dist/detectors/unprotected-pair-initializer.d.ts +22 -0
- package/dist/detectors/unprotected-pair-initializer.js +359 -0
- package/dist/detectors/unprotected-upgrade-function.d.ts +7 -0
- package/dist/detectors/unprotected-upgrade-function.js +180 -0
- package/dist/detectors/unreachable-code-0.8.28.d.ts +19 -0
- package/dist/detectors/unreachable-code-0.8.28.js +206 -0
- package/dist/detectors/unsafe-proxy-storage.d.ts +7 -0
- package/dist/detectors/unsafe-proxy-storage.js +436 -0
- package/dist/detectors/unsafe-transient-storage.d.ts +7 -0
- package/dist/detectors/unsafe-transient-storage.js +1052 -0
- package/dist/detectors/unsafe-tx-origin.d.ts +9 -0
- package/dist/detectors/unsafe-tx-origin.js +179 -0
- package/dist/detectors/unsigned-validity-window.d.ts +20 -0
- package/dist/detectors/unsigned-validity-window.js +220 -0
- package/dist/detectors/unvalidated-interface-address.d.ts +25 -0
- package/dist/detectors/unvalidated-interface-address.js +377 -0
- package/dist/detectors/uups-uninitialized-storage.d.ts +9 -0
- package/dist/detectors/uups-uninitialized-storage.js +366 -0
- package/dist/detectors/v2-error-k-value-attack.d.ts +33 -0
- package/dist/detectors/v2-error-k-value-attack.js +276 -0
- package/dist/detectors/v2-k-invariant-bypass.d.ts +33 -0
- package/dist/detectors/v2-k-invariant-bypass.js +283 -0
- package/dist/detectors/v4-hook-reentrancy.d.ts +9 -0
- package/dist/detectors/v4-hook-reentrancy.js +488 -0
- package/dist/detectors/vault-inflation-rounding.d.ts +23 -0
- package/dist/detectors/vault-inflation-rounding.js +477 -0
- package/dist/detectors/vault-share-price-manipulation.d.ts +7 -0
- package/dist/detectors/vault-share-price-manipulation.js +332 -0
- package/dist/detectors/vortex-interaction-guard.d.ts +45 -0
- package/dist/detectors/vortex-interaction-guard.js +275 -0
- package/dist/detectors/vortex-protocol-reentrancy-guard.d.ts +27 -0
- package/dist/detectors/vortex-protocol-reentrancy-guard.js +408 -0
- package/dist/detectors/vulnerable-price-dependency.d.ts +41 -0
- package/dist/detectors/vulnerable-price-dependency.js +473 -0
- package/dist/detectors/weak-random-mint.d.ts +37 -0
- package/dist/detectors/weak-random-mint.js +271 -0
- package/dist/detectors/withdraw-be-to-withdraw.d.ts +26 -0
- package/dist/detectors/withdraw-be-to-withdraw.js +329 -0
- package/dist/detectors/wrong-function-visibility.d.ts +29 -0
- package/dist/detectors/wrong-function-visibility.js +147 -0
- package/dist/detectors/wrong-price-calculation.d.ts +42 -0
- package/dist/detectors/wrong-price-calculation.js +387 -0
- package/dist/detectors/yearn-vault-v2-share-price-manipulation.d.ts +32 -0
- package/dist/detectors/yearn-vault-v2-share-price-manipulation.js +248 -0
- package/dist/detectors/zero-fee.d.ts +7 -0
- package/dist/detectors/zero-fee.js +596 -0
- package/dist/detectors/zetachain-gateway-hack-analysis.d.ts +7 -0
- package/dist/detectors/zetachain-gateway-hack-analysis.js +629 -0
- package/dist/detectors/zk-rollup-da-gap.d.ts +8 -0
- package/dist/detectors/zk-rollup-da-gap.js +322 -0
- package/dist/detectors/zksync-batch-validation.d.ts +8 -0
- package/dist/detectors/zksync-batch-validation.js +461 -0
- package/dist/detectors/zksync-era-rollup-state-update.d.ts +60 -0
- package/dist/detectors/zksync-era-rollup-state-update.js +360 -0
- package/dist/detectors/zksync-simulation-drift.d.ts +35 -0
- package/dist/detectors/zksync-simulation-drift.js +309 -0
- package/dist/exit-codes.d.ts +15 -0
- package/dist/exit-codes.js +18 -0
- package/dist/formatters/github-actions.d.ts +2 -0
- package/dist/formatters/github-actions.js +61 -0
- package/dist/formatters/sarif.d.ts +24 -0
- package/dist/formatters/sarif.js +670 -0
- package/dist/formatters/text.d.ts +14 -0
- package/dist/formatters/text.js +152 -0
- package/dist/fp-rates.json +70 -0
- package/dist/identity/diff-baseline.d.ts +16 -0
- package/dist/identity/diff-baseline.js +152 -0
- package/dist/identity/hashing.d.ts +39 -0
- package/dist/identity/hashing.js +96 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.js +358 -0
- package/dist/parallel-scan.d.ts +66 -0
- package/dist/parallel-scan.js +227 -0
- package/dist/registry.d.ts +17 -0
- package/dist/registry.js +118 -0
- package/dist/rules/glob.d.ts +5 -0
- package/dist/rules/glob.js +76 -0
- package/dist/rules/suppressions.d.ts +23 -0
- package/dist/rules/suppressions.js +136 -0
- package/dist/rules/tiers.d.ts +23 -0
- package/dist/rules/tiers.js +341 -0
- package/dist/scan-worker.d.ts +1 -0
- package/dist/scan-worker.js +61 -0
- package/dist/scan.d.ts +24 -0
- package/dist/scan.js +558 -0
- package/dist/semantic/contracts.d.ts +10 -0
- package/dist/semantic/contracts.js +141 -0
- package/dist/semantic/diagnostics.d.ts +29 -0
- package/dist/semantic/diagnostics.js +25 -0
- package/dist/semantic/eog.d.ts +56 -0
- package/dist/semantic/eog.js +545 -0
- package/dist/semantic/imports.d.ts +88 -0
- package/dist/semantic/imports.js +246 -0
- package/dist/semantic/index.d.ts +2 -0
- package/dist/semantic/index.js +8 -0
- package/dist/semantic/inheritance.d.ts +33 -0
- package/dist/semantic/inheritance.js +137 -0
- package/dist/semantic/model.d.ts +95 -0
- package/dist/semantic/model.js +232 -0
- package/dist/semantic/taint-tracker.d.ts +49 -0
- package/dist/semantic/taint-tracker.js +410 -0
- package/dist/semantic/types.d.ts +119 -0
- package/dist/semantic/types.js +18 -0
- package/dist/severity.d.ts +10 -0
- package/dist/severity.js +78 -0
- package/package.json +52 -0
|
@@ -0,0 +1,836 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GeneralizedFrontrunningDetector = void 0;
|
|
4
|
+
const access_control_1 = require("./_common/access-control");
|
|
5
|
+
const RULE_ID = 'generalized-frontrunning';
|
|
6
|
+
const SWAP_PATTERN = `${RULE_ID}/permissive-swap-bound`;
|
|
7
|
+
const LIQUIDATION_PATTERN = `${RULE_ID}/oracle-driven-execution-without-bound`;
|
|
8
|
+
const APPROVE_RACE_PATTERN = `${RULE_ID}/approve-race`;
|
|
9
|
+
const RESULT_REVEAL_PATTERN = `${RULE_ID}/result-revealing-no-commit`;
|
|
10
|
+
const SPOT_SETTLEMENT_PATTERN = `${RULE_ID}/unprotected-spot-settlement`;
|
|
11
|
+
const FIRST_CLAIMER_PATTERN = `${RULE_ID}/first-claimer-race`;
|
|
12
|
+
const PROVENANCE = 'issue-1650-generalized-frontrunning';
|
|
13
|
+
const SWAP_SPECS = {
|
|
14
|
+
swapExactTokensForTokens: { minIndex: 1, deadlineIndex: 4 },
|
|
15
|
+
swapExactTokensForETH: { minIndex: 1, deadlineIndex: 4 },
|
|
16
|
+
swapExactETHForTokens: { minIndex: 0, deadlineIndex: 3 },
|
|
17
|
+
swapExactTokensForTokensSupportingFeeOnTransferTokens: { minIndex: 1, deadlineIndex: 4 },
|
|
18
|
+
swapExactTokensForETHSupportingFeeOnTransferTokens: { minIndex: 1, deadlineIndex: 4 },
|
|
19
|
+
swapExactETHForTokensSupportingFeeOnTransferTokens: { minIndex: 0, deadlineIndex: 3 },
|
|
20
|
+
swapTokensForExactTokens: { maxIndex: 1, deadlineIndex: 4 },
|
|
21
|
+
swapTokensForExactETH: { maxIndex: 1, deadlineIndex: 4 },
|
|
22
|
+
exchange: { minIndex: 3 },
|
|
23
|
+
exchange_underlying: { minIndex: 3 },
|
|
24
|
+
};
|
|
25
|
+
class GeneralizedFrontrunningDetector {
|
|
26
|
+
id = RULE_ID;
|
|
27
|
+
patternKey = RULE_ID;
|
|
28
|
+
supportedAstKinds = ['parser', 'solc'];
|
|
29
|
+
scanAst(ast, file, sourceText = '') {
|
|
30
|
+
if (!ast || typeof ast !== 'object')
|
|
31
|
+
return [];
|
|
32
|
+
if (!isNode(ast, 'SourceUnit'))
|
|
33
|
+
return [];
|
|
34
|
+
const findings = [];
|
|
35
|
+
const seen = new Set();
|
|
36
|
+
for (const contract of collectContracts(ast)) {
|
|
37
|
+
if (isInterfaceLike(contract))
|
|
38
|
+
continue;
|
|
39
|
+
const contractName = getName(contract) || '<anonymous>';
|
|
40
|
+
const contractFunctionNames = new Set(getContractFunctions(contract)
|
|
41
|
+
.map(getName)
|
|
42
|
+
.filter(Boolean));
|
|
43
|
+
for (const fn of getContractFunctions(contract)) {
|
|
44
|
+
if (!fn.body)
|
|
45
|
+
continue;
|
|
46
|
+
if (!isExternallyCallable(fn))
|
|
47
|
+
continue;
|
|
48
|
+
const functionName = getName(fn) || '<anonymous>';
|
|
49
|
+
const params = new Set();
|
|
50
|
+
for (const param of getParameters(fn)) {
|
|
51
|
+
const name = getName(param);
|
|
52
|
+
if (name)
|
|
53
|
+
params.add(name);
|
|
54
|
+
}
|
|
55
|
+
const ctx = {
|
|
56
|
+
file,
|
|
57
|
+
sourceText,
|
|
58
|
+
contractName,
|
|
59
|
+
functionName,
|
|
60
|
+
contractFunctionNames,
|
|
61
|
+
params,
|
|
62
|
+
zeroValues: new Set(),
|
|
63
|
+
maxValues: new Set(),
|
|
64
|
+
oracleDerived: new Set(),
|
|
65
|
+
guardedOutputs: new Set(),
|
|
66
|
+
};
|
|
67
|
+
for (const sink of scanFunctionShape(fn, contract, ctx)) {
|
|
68
|
+
const loc = locOf(sink.node, sourceText) || locOf(fn, sourceText) || { line: 1, column: 0 };
|
|
69
|
+
const key = `${contractName}:${functionName}:${loc.line}:${loc.column}:${sink.pattern}`;
|
|
70
|
+
if (seen.has(key))
|
|
71
|
+
continue;
|
|
72
|
+
seen.add(key);
|
|
73
|
+
findings.push(makeFinding(ctx, loc, sink));
|
|
74
|
+
}
|
|
75
|
+
for (const sink of scanBlock(fn.body, ctx)) {
|
|
76
|
+
const loc = locOf(sink.node, sourceText) || locOf(fn, sourceText) || { line: 1, column: 0 };
|
|
77
|
+
const key = `${contractName}:${functionName}:${loc.line}:${loc.column}:${sink.pattern}`;
|
|
78
|
+
if (seen.has(key))
|
|
79
|
+
continue;
|
|
80
|
+
seen.add(key);
|
|
81
|
+
findings.push(makeFinding(ctx, loc, sink));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return findings;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.GeneralizedFrontrunningDetector = GeneralizedFrontrunningDetector;
|
|
89
|
+
function scanFunctionShape(fn, contract, ctx) {
|
|
90
|
+
const out = [];
|
|
91
|
+
if (isUnsafeApproveRace(fn, ctx)) {
|
|
92
|
+
out.push({
|
|
93
|
+
node: fn,
|
|
94
|
+
pattern: APPROVE_RACE_PATTERN,
|
|
95
|
+
message: `Generalized front-running risk in '${ctx.contractName}.${ctx.functionName}': approve overwrites an existing allowance without a zero-first guard or delta allowance alternative.`,
|
|
96
|
+
rationale: 'ERC-20 allowance changes from one non-zero value to another are transaction-order dependent because the spender can race the allowance overwrite.',
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (isResultRevealingResolution(fn, contract, ctx)) {
|
|
100
|
+
out.push({
|
|
101
|
+
node: fn,
|
|
102
|
+
pattern: RESULT_REVEAL_PATTERN,
|
|
103
|
+
message: `Generalized front-running risk in '${ctx.contractName}.${ctx.functionName}': calldata-visible input is accepted and resolved for value in the same transaction without commit-reveal protection.`,
|
|
104
|
+
rationale: 'When the winning guess or bid is visible in calldata before execution, another transaction can copy or reorder around it unless the protocol separates commitment from reveal.',
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
if (isFirstClaimerRace(fn, ctx)) {
|
|
108
|
+
out.push({
|
|
109
|
+
node: fn,
|
|
110
|
+
pattern: FIRST_CLAIMER_PATTERN,
|
|
111
|
+
message: `Generalized front-running risk in '${ctx.contractName}.${ctx.functionName}': an anyone-callable first-claim or initializer path assigns order-dependent privileged state.`,
|
|
112
|
+
rationale: 'First-claimer and initializer flows are transaction-order dependent when any caller can win the race to capture owner, depositor, or initialization state.',
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return out;
|
|
116
|
+
}
|
|
117
|
+
function scanBlock(block, ctx) {
|
|
118
|
+
const findings = [];
|
|
119
|
+
for (const stmt of getBlockStatements(block)) {
|
|
120
|
+
findings.push(...scanStatement(stmt, ctx));
|
|
121
|
+
}
|
|
122
|
+
return findings;
|
|
123
|
+
}
|
|
124
|
+
function scanStatement(stmt, ctx) {
|
|
125
|
+
if (!stmt || typeof stmt !== 'object')
|
|
126
|
+
return [];
|
|
127
|
+
if (isNode(stmt, 'Block'))
|
|
128
|
+
return scanBlock(stmt, ctx);
|
|
129
|
+
if (isNode(stmt, 'IfStatement')) {
|
|
130
|
+
const findings = [];
|
|
131
|
+
const trueCtx = cloneCtx(ctx);
|
|
132
|
+
collectBoundGuards(stmt.condition, trueCtx);
|
|
133
|
+
if (stmt.trueBody)
|
|
134
|
+
findings.push(...scanStatement(stmt.trueBody, trueCtx));
|
|
135
|
+
if (stmt.falseBody)
|
|
136
|
+
findings.push(...scanStatement(stmt.falseBody, cloneCtx(ctx)));
|
|
137
|
+
return findings;
|
|
138
|
+
}
|
|
139
|
+
if (isRequireOrAssertStatement(stmt)) {
|
|
140
|
+
collectBoundGuards(getCallArguments(stmt.expression)[0], ctx);
|
|
141
|
+
collectAssignments(stmt, ctx);
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
const findings = findSinkCandidates(stmt, ctx);
|
|
145
|
+
collectAssignments(stmt, ctx);
|
|
146
|
+
return findings;
|
|
147
|
+
}
|
|
148
|
+
function collectAssignments(stmt, ctx) {
|
|
149
|
+
walk(stmt, node => {
|
|
150
|
+
if (isNode(node, 'VariableDeclarationStatement')) {
|
|
151
|
+
const init = node.initialValue ?? node.initialValueExpression ?? node.value;
|
|
152
|
+
for (const decl of getVariableDeclarations(node)) {
|
|
153
|
+
const name = getName(decl);
|
|
154
|
+
if (!name)
|
|
155
|
+
continue;
|
|
156
|
+
if (isZeroExpression(init, ctx))
|
|
157
|
+
ctx.zeroValues.add(name);
|
|
158
|
+
if (isMaxExpression(init, ctx))
|
|
159
|
+
ctx.maxValues.add(name);
|
|
160
|
+
if (isOracleDerivedExpression(init, ctx))
|
|
161
|
+
ctx.oracleDerived.add(name);
|
|
162
|
+
}
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (!isAssignmentNode(node))
|
|
166
|
+
return;
|
|
167
|
+
const right = getBinaryRight(node);
|
|
168
|
+
for (const name of collectAssignTargets(getBinaryLeft(node))) {
|
|
169
|
+
if (isZeroExpression(right, ctx))
|
|
170
|
+
ctx.zeroValues.add(name);
|
|
171
|
+
if (isMaxExpression(right, ctx))
|
|
172
|
+
ctx.maxValues.add(name);
|
|
173
|
+
if (isOracleDerivedExpression(right, ctx))
|
|
174
|
+
ctx.oracleDerived.add(name);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
function collectBoundGuards(condition, ctx) {
|
|
179
|
+
walk(condition, node => {
|
|
180
|
+
if (!isNode(node, 'BinaryOperation'))
|
|
181
|
+
return;
|
|
182
|
+
const op = String(node.operator || '');
|
|
183
|
+
if (!['>', '>=', '<', '<=', '!='].includes(op))
|
|
184
|
+
return;
|
|
185
|
+
const left = getBinaryLeft(node);
|
|
186
|
+
const right = getBinaryRight(node);
|
|
187
|
+
if ((op === '>' || op === '>=' || op === '!=') && isOracleDerivedExpression(left, ctx) && isCallerBound(right, ctx)) {
|
|
188
|
+
addAccessRoot(left, ctx.guardedOutputs);
|
|
189
|
+
}
|
|
190
|
+
if ((op === '<' || op === '<=' || op === '!=') && isOracleDerivedExpression(right, ctx) && isCallerBound(left, ctx)) {
|
|
191
|
+
addAccessRoot(right, ctx.guardedOutputs);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
function findSinkCandidates(stmt, ctx) {
|
|
196
|
+
const candidates = [];
|
|
197
|
+
walk(stmt, node => {
|
|
198
|
+
if (!isNode(node, 'FunctionCall'))
|
|
199
|
+
return;
|
|
200
|
+
const callee = unwrapCallOptions(node.expression);
|
|
201
|
+
if (!isNode(callee, 'MemberAccess'))
|
|
202
|
+
return;
|
|
203
|
+
const method = String(callee.memberName || '');
|
|
204
|
+
const swapSpec = SWAP_SPECS[method];
|
|
205
|
+
if (swapSpec) {
|
|
206
|
+
const reasons = vulnerableSwapReasons(node, swapSpec, ctx);
|
|
207
|
+
if (reasons.length > 0) {
|
|
208
|
+
candidates.push({
|
|
209
|
+
node,
|
|
210
|
+
pattern: SWAP_PATTERN,
|
|
211
|
+
message: `Generalized front-running risk in '${ctx.contractName}.${ctx.functionName}': ${method} uses ${reasons.join(' and ')}.`,
|
|
212
|
+
rationale: 'Caller-visible swap execution with missing or permissive slippage/deadline protection can be sandwiched or reordered before inclusion.',
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const transferAmount = getTransferAmount(method, node);
|
|
218
|
+
if (!transferAmount)
|
|
219
|
+
return;
|
|
220
|
+
if (!isOracleDerivedExpression(transferAmount, ctx))
|
|
221
|
+
return;
|
|
222
|
+
const amountName = accessRoot(transferAmount);
|
|
223
|
+
if (amountName && ctx.guardedOutputs.has(amountName))
|
|
224
|
+
return;
|
|
225
|
+
const pattern = isLiquidationLikeFunction(ctx.functionName) ? LIQUIDATION_PATTERN : SPOT_SETTLEMENT_PATTERN;
|
|
226
|
+
candidates.push({
|
|
227
|
+
node,
|
|
228
|
+
pattern,
|
|
229
|
+
message: pattern === LIQUIDATION_PATTERN
|
|
230
|
+
? `Generalized front-running risk in '${ctx.contractName}.${ctx.functionName}': externally influenced price or reserve data drives value-sensitive execution without a caller-provided bound.`
|
|
231
|
+
: `Generalized front-running risk in '${ctx.contractName}.${ctx.functionName}': spot-derived settlement moves value without caller-provided min-out, nonce, or deadline protection.`,
|
|
232
|
+
rationale: pattern === LIQUIDATION_PATTERN
|
|
233
|
+
? 'Liquidation or arbitrage-sensitive execution derived from fresh external price/reserve state can be transaction-ordering sensitive when no min/max guard constrains the result.'
|
|
234
|
+
: 'Spot oracle or reserve reads can be sandwiched or reordered when settlement transfers the derived amount directly and the caller cannot constrain the execution result.',
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
return candidates;
|
|
238
|
+
}
|
|
239
|
+
function isUnsafeApproveRace(fn, ctx) {
|
|
240
|
+
if (ctx.functionName !== 'approve')
|
|
241
|
+
return false;
|
|
242
|
+
const params = getParameters(fn);
|
|
243
|
+
if (params.length < 2)
|
|
244
|
+
return false;
|
|
245
|
+
const spenderName = getName(params[0]);
|
|
246
|
+
const amountName = getName(params[1]);
|
|
247
|
+
if (!spenderName || !amountName)
|
|
248
|
+
return false;
|
|
249
|
+
if (ctx.contractFunctionNames.has('increaseAllowance') && ctx.contractFunctionNames.has('decreaseAllowance'))
|
|
250
|
+
return false;
|
|
251
|
+
if (hasZeroFirstAllowanceGuard(fn, amountName))
|
|
252
|
+
return false;
|
|
253
|
+
return walkAny(fn.body, node => {
|
|
254
|
+
if (!isAssignmentNode(node))
|
|
255
|
+
return false;
|
|
256
|
+
const left = getBinaryLeft(node);
|
|
257
|
+
const right = getBinaryRight(node);
|
|
258
|
+
return isAllowanceAccess(left) && accessRoot(right) === amountName;
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
function hasZeroFirstAllowanceGuard(fn, amountName) {
|
|
262
|
+
return walkAny(fn.body, node => {
|
|
263
|
+
if (!isRequireOrAssertStatement(node))
|
|
264
|
+
return false;
|
|
265
|
+
const condition = getCallArguments(node.expression)[0];
|
|
266
|
+
return isZeroFirstCondition(condition, amountName);
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
function isZeroFirstCondition(expr, amountName) {
|
|
270
|
+
if (!expr || typeof expr !== 'object')
|
|
271
|
+
return false;
|
|
272
|
+
if (isNode(expr, 'BinaryOperation') && String(expr.operator || '') === '||') {
|
|
273
|
+
const left = getBinaryLeft(expr);
|
|
274
|
+
const right = getBinaryRight(expr);
|
|
275
|
+
return (isAmountZeroCheck(left, amountName) && isAllowanceZeroCheck(right))
|
|
276
|
+
|| (isAmountZeroCheck(right, amountName) && isAllowanceZeroCheck(left));
|
|
277
|
+
}
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
function isAmountZeroCheck(expr, amountName) {
|
|
281
|
+
if (!isNode(expr, 'BinaryOperation'))
|
|
282
|
+
return false;
|
|
283
|
+
if (!['==', '===', '<='].includes(String(expr.operator || '')))
|
|
284
|
+
return false;
|
|
285
|
+
const left = getBinaryLeft(expr);
|
|
286
|
+
const right = getBinaryRight(expr);
|
|
287
|
+
return (accessRoot(left) === amountName && isZeroLiteral(right))
|
|
288
|
+
|| (accessRoot(right) === amountName && isZeroLiteral(left));
|
|
289
|
+
}
|
|
290
|
+
function isAllowanceZeroCheck(expr) {
|
|
291
|
+
if (!isNode(expr, 'BinaryOperation'))
|
|
292
|
+
return false;
|
|
293
|
+
if (!['==', '===', '<='].includes(String(expr.operator || '')))
|
|
294
|
+
return false;
|
|
295
|
+
const left = getBinaryLeft(expr);
|
|
296
|
+
const right = getBinaryRight(expr);
|
|
297
|
+
return (isAllowanceAccess(left) && isZeroLiteral(right))
|
|
298
|
+
|| (isAllowanceAccess(right) && isZeroLiteral(left));
|
|
299
|
+
}
|
|
300
|
+
function isAllowanceAccess(expr) {
|
|
301
|
+
return (accessRoot(expr) || '').toLowerCase() === 'allowance';
|
|
302
|
+
}
|
|
303
|
+
function isResultRevealingResolution(fn, contract, ctx) {
|
|
304
|
+
if (contractHasCommitReveal(contract))
|
|
305
|
+
return false;
|
|
306
|
+
const visibleInputs = [...ctx.params].filter(isRevealedResultInputName);
|
|
307
|
+
if (visibleInputs.length === 0)
|
|
308
|
+
return false;
|
|
309
|
+
if (!functionMovesValue(fn))
|
|
310
|
+
return false;
|
|
311
|
+
return walkAny(fn.body, node => {
|
|
312
|
+
if (!isNode(node, 'BinaryOperation'))
|
|
313
|
+
return false;
|
|
314
|
+
const op = String(node.operator || '');
|
|
315
|
+
if (op !== '==' && op !== '===')
|
|
316
|
+
return false;
|
|
317
|
+
const left = getBinaryLeft(node);
|
|
318
|
+
const right = getBinaryRight(node);
|
|
319
|
+
return visibleInputs.some(name => accessRoot(left) === name || accessRoot(right) === name);
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
function contractHasCommitReveal(contract) {
|
|
323
|
+
const functions = getContractFunctions(contract);
|
|
324
|
+
const hasCommitPhase = functions.some(fn => isCommitLikeFunction(fn) && writesCallerCommitment(fn));
|
|
325
|
+
if (!hasCommitPhase)
|
|
326
|
+
return false;
|
|
327
|
+
return functions.some(fn => isRevealLikeFunction(fn) && validatesCommittedHash(fn));
|
|
328
|
+
}
|
|
329
|
+
function isCommitLikeFunction(fn) {
|
|
330
|
+
return /^(commit|submitCommitment|seal|submitSealed)$/i.test(getName(fn));
|
|
331
|
+
}
|
|
332
|
+
function isRevealLikeFunction(fn) {
|
|
333
|
+
return /^(reveal|claim|settle)$/i.test(getName(fn));
|
|
334
|
+
}
|
|
335
|
+
function writesCallerCommitment(fn) {
|
|
336
|
+
return walkAny(fn.body, node => {
|
|
337
|
+
if (!isAssignmentNode(node))
|
|
338
|
+
return false;
|
|
339
|
+
const left = getBinaryLeft(node);
|
|
340
|
+
return isCommitmentAccess(left) && walkAny(left, child => isMsgSenderLike(child));
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
function validatesCommittedHash(fn) {
|
|
344
|
+
return walkAny(fn.body, node => {
|
|
345
|
+
if (!isRequireOrAssertStatement(node))
|
|
346
|
+
return false;
|
|
347
|
+
return comparesCommitmentToHash(getCallArguments(node.expression)[0]);
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
function comparesCommitmentToHash(expr) {
|
|
351
|
+
return walkAny(expr, node => {
|
|
352
|
+
if (!isNode(node, 'BinaryOperation'))
|
|
353
|
+
return false;
|
|
354
|
+
const op = String(node.operator || '');
|
|
355
|
+
if (op !== '==' && op !== '===')
|
|
356
|
+
return false;
|
|
357
|
+
const left = getBinaryLeft(node);
|
|
358
|
+
const right = getBinaryRight(node);
|
|
359
|
+
return (isCommitmentAccess(left) && containsKeccak256Call(right))
|
|
360
|
+
|| (isCommitmentAccess(right) && containsKeccak256Call(left));
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
function isCommitmentAccess(expr) {
|
|
364
|
+
const root = accessRoot(expr) || '';
|
|
365
|
+
return /commit|sealed/i.test(root);
|
|
366
|
+
}
|
|
367
|
+
function containsKeccak256Call(expr) {
|
|
368
|
+
return walkAny(expr, node => isNode(node, 'FunctionCall') && getCalleeIdentifierName(node.expression).toLowerCase() === 'keccak256');
|
|
369
|
+
}
|
|
370
|
+
function isRevealedResultInputName(name) {
|
|
371
|
+
return /^(guess|bid|answer|value|choice|secret|solution|claim)$/i.test(name);
|
|
372
|
+
}
|
|
373
|
+
function functionMovesValue(fn) {
|
|
374
|
+
return walkAny(fn.body, node => {
|
|
375
|
+
if (!isNode(node, 'FunctionCall'))
|
|
376
|
+
return false;
|
|
377
|
+
const callee = unwrapCallOptions(node.expression);
|
|
378
|
+
if (isNode(callee, 'MemberAccess')) {
|
|
379
|
+
const method = String(callee.memberName || '').toLowerCase();
|
|
380
|
+
if (method === 'transfer' || method === 'send')
|
|
381
|
+
return true;
|
|
382
|
+
if (method === 'call')
|
|
383
|
+
return callHasValueOption(node) || callHasValueOption(callee.expression);
|
|
384
|
+
}
|
|
385
|
+
return false;
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
function callHasValueOption(node) {
|
|
389
|
+
return walkAny(node, child => isNode(child, 'NameValueExpression') && nodeName(child.name).toLowerCase() === 'value');
|
|
390
|
+
}
|
|
391
|
+
function isFirstClaimerRace(fn, ctx) {
|
|
392
|
+
const name = ctx.functionName.toLowerCase();
|
|
393
|
+
if ((0, access_control_1.hasRecognisedAccessControlModifier)(fn))
|
|
394
|
+
return false;
|
|
395
|
+
if (hasInlineAccessControl(fn))
|
|
396
|
+
return false;
|
|
397
|
+
if (name === 'initialize' || name === 'init')
|
|
398
|
+
return hasFirstStateGate(fn) && assignsPrivilegedOrInitializerState(fn);
|
|
399
|
+
if (/^(deposit|mint|seed|join|register|claim)$/.test(name))
|
|
400
|
+
return hasFirstStateGate(fn) && assignsCallerCapturedState(fn);
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
function hasInlineAccessControl(fn) {
|
|
404
|
+
return walkAny(fn.body, node => {
|
|
405
|
+
if (!isRequireOrAssertStatement(node))
|
|
406
|
+
return false;
|
|
407
|
+
const condition = getCallArguments(node.expression)[0];
|
|
408
|
+
return (0, access_control_1.requireExpressesAccessControl)(condition, name => (0, access_control_1.isPrivilegedIdentifier)(name));
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
function assignsPrivilegedOrInitializerState(fn) {
|
|
412
|
+
return walkAny(fn.body, node => {
|
|
413
|
+
if (!isAssignmentNode(node))
|
|
414
|
+
return false;
|
|
415
|
+
const left = getBinaryLeft(node);
|
|
416
|
+
const target = accessRoot(left) || '';
|
|
417
|
+
return (0, access_control_1.isPrivilegedIdentifier)(target) || isInitializerStateName(target);
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
function hasFirstStateGate(fn) {
|
|
421
|
+
return walkAny(fn.body, node => {
|
|
422
|
+
if (!isRequireOrAssertStatement(node))
|
|
423
|
+
return false;
|
|
424
|
+
const condition = getCallArguments(node.expression)[0];
|
|
425
|
+
if (isNegatedInitializedCheck(condition))
|
|
426
|
+
return true;
|
|
427
|
+
return walkAny(condition, child => {
|
|
428
|
+
if (!isNode(child, 'BinaryOperation'))
|
|
429
|
+
return false;
|
|
430
|
+
const op = String(child.operator || '');
|
|
431
|
+
if (!['==', '===', '<=', '<'].includes(op))
|
|
432
|
+
return false;
|
|
433
|
+
const left = getBinaryLeft(child);
|
|
434
|
+
const right = getBinaryRight(child);
|
|
435
|
+
return (isFirstStateName(accessRoot(left) || '') && isZeroLiteral(right))
|
|
436
|
+
|| (isFirstStateName(accessRoot(right) || '') && isZeroLiteral(left))
|
|
437
|
+
|| isNegatedInitializedCheck(child);
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
function isNegatedInitializedCheck(expr) {
|
|
442
|
+
return isNode(expr, 'UnaryOperation')
|
|
443
|
+
&& String(expr.operator || '') === '!'
|
|
444
|
+
&& isInitializerStateName(accessRoot(expr.subExpression) || '');
|
|
445
|
+
}
|
|
446
|
+
function assignsCallerCapturedState(fn) {
|
|
447
|
+
return walkAny(fn.body, node => {
|
|
448
|
+
if (!isAssignmentNode(node))
|
|
449
|
+
return false;
|
|
450
|
+
const left = getBinaryLeft(node);
|
|
451
|
+
const right = getBinaryRight(node);
|
|
452
|
+
const target = accessRoot(left) || '';
|
|
453
|
+
return isFirstStateName(target) || isMsgSenderLike(right);
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
function isFirstStateName(name) {
|
|
457
|
+
return /^(totalShares|firstDepositor|firstDeposit|seeded|initialized)$/i.test(name);
|
|
458
|
+
}
|
|
459
|
+
function isInitializerStateName(name) {
|
|
460
|
+
return /^(initialized|initialised|initializer|owner|admin)$/i.test(name);
|
|
461
|
+
}
|
|
462
|
+
function isMsgSenderLike(expr) {
|
|
463
|
+
return collectAccessPath(expr) === 'msg.sender';
|
|
464
|
+
}
|
|
465
|
+
function isLiquidationLikeFunction(name) {
|
|
466
|
+
return /liquidat|arbitrage|rebalance/i.test(name);
|
|
467
|
+
}
|
|
468
|
+
function vulnerableSwapReasons(call, spec, ctx) {
|
|
469
|
+
const reasons = [];
|
|
470
|
+
const minArg = getNamedCallArgument(call, ['amountoutmin', 'amountoutminimum', 'minout', 'minimumamountout'])
|
|
471
|
+
|| (spec.minIndex === undefined ? null : getCallArguments(call)[spec.minIndex]);
|
|
472
|
+
if (spec.minIndex !== undefined && (!minArg || isZeroExpression(minArg, ctx))) {
|
|
473
|
+
reasons.push('a missing or zero minimum output bound');
|
|
474
|
+
}
|
|
475
|
+
const maxArg = getNamedCallArgument(call, ['amountinmax', 'maxin', 'maximumamountin'])
|
|
476
|
+
|| (spec.maxIndex === undefined ? null : getCallArguments(call)[spec.maxIndex]);
|
|
477
|
+
if (spec.maxIndex !== undefined && (!maxArg || isMaxExpression(maxArg, ctx))) {
|
|
478
|
+
reasons.push('a missing or unbounded maximum input');
|
|
479
|
+
}
|
|
480
|
+
const deadlineArg = getNamedCallArgument(call, ['deadline'])
|
|
481
|
+
|| (spec.deadlineIndex === undefined ? null : getCallArguments(call)[spec.deadlineIndex]);
|
|
482
|
+
if (spec.deadlineIndex !== undefined && (!deadlineArg || isDirectBlockTimestamp(deadlineArg))) {
|
|
483
|
+
reasons.push('missing or ineffective deadline protection');
|
|
484
|
+
}
|
|
485
|
+
return reasons;
|
|
486
|
+
}
|
|
487
|
+
function getTransferAmount(method, call) {
|
|
488
|
+
const args = getCallArguments(call);
|
|
489
|
+
if (method === 'transfer')
|
|
490
|
+
return args[1] || null;
|
|
491
|
+
if (method === 'transferFrom')
|
|
492
|
+
return args[2] || null;
|
|
493
|
+
if (/^(liquidate|executeLiquidation|rebalance|arbitrage)$/i.test(method))
|
|
494
|
+
return args[1] || args[0] || null;
|
|
495
|
+
return null;
|
|
496
|
+
}
|
|
497
|
+
function isOracleDerivedExpression(expr, ctx) {
|
|
498
|
+
if (!expr || typeof expr !== 'object')
|
|
499
|
+
return false;
|
|
500
|
+
const root = accessRoot(expr);
|
|
501
|
+
if (root && ctx.oracleDerived.has(root))
|
|
502
|
+
return true;
|
|
503
|
+
return walkAny(expr, node => {
|
|
504
|
+
const nestedRoot = accessRoot(node);
|
|
505
|
+
if (nestedRoot && ctx.oracleDerived.has(nestedRoot))
|
|
506
|
+
return true;
|
|
507
|
+
if (!isNode(node, 'FunctionCall'))
|
|
508
|
+
return false;
|
|
509
|
+
const callee = unwrapCallOptions(node.expression);
|
|
510
|
+
if (isNode(callee, 'MemberAccess'))
|
|
511
|
+
return isOracleLikeMethod(String(callee.memberName || ''));
|
|
512
|
+
if (isNode(callee, 'Identifier'))
|
|
513
|
+
return /^(uint|uint256|int|int256)$/i.test(String(callee.name || '')) && getCallArguments(node).some(arg => isOracleDerivedExpression(arg, ctx));
|
|
514
|
+
return false;
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
function isOracleLikeMethod(method) {
|
|
518
|
+
return /(price|quote|reserve|getreserve|latestanswer|latestrounddata|getamountsout|getamountout|consult|peek|read)/i.test(method);
|
|
519
|
+
}
|
|
520
|
+
function isCallerBound(expr, ctx) {
|
|
521
|
+
const root = accessRoot(expr);
|
|
522
|
+
return !!root && ctx.params.has(root) && isBoundName(root);
|
|
523
|
+
}
|
|
524
|
+
function isBoundName(name) {
|
|
525
|
+
return /(min|minimum|max|maximum|amountoutmin|amountinmax|slippage|limit|floor|ceiling|bound|worst|guaranteed)/i.test(name);
|
|
526
|
+
}
|
|
527
|
+
function isZeroExpression(expr, ctx) {
|
|
528
|
+
if (isZeroLiteral(expr))
|
|
529
|
+
return true;
|
|
530
|
+
const root = accessRoot(expr);
|
|
531
|
+
return !!root && ctx.zeroValues.has(root);
|
|
532
|
+
}
|
|
533
|
+
function isMaxExpression(expr, ctx) {
|
|
534
|
+
if (!expr || typeof expr !== 'object')
|
|
535
|
+
return false;
|
|
536
|
+
const root = accessRoot(expr);
|
|
537
|
+
if (root && ctx.maxValues.has(root))
|
|
538
|
+
return true;
|
|
539
|
+
return isTypeMaxExpression(expr);
|
|
540
|
+
}
|
|
541
|
+
function isZeroLiteral(expr) {
|
|
542
|
+
if (!expr || typeof expr !== 'object')
|
|
543
|
+
return false;
|
|
544
|
+
if (isNode(expr, 'NumberLiteral'))
|
|
545
|
+
return String(expr.number ?? expr.value ?? '') === '0';
|
|
546
|
+
if (isNode(expr, 'Literal'))
|
|
547
|
+
return String(expr.value ?? '') === '0';
|
|
548
|
+
return false;
|
|
549
|
+
}
|
|
550
|
+
function isTypeMaxExpression(expr) {
|
|
551
|
+
if (!isNode(expr, 'MemberAccess'))
|
|
552
|
+
return false;
|
|
553
|
+
if (String(expr.memberName || '').toLowerCase() !== 'max')
|
|
554
|
+
return false;
|
|
555
|
+
const inner = unwrapCallOptions(expr.expression);
|
|
556
|
+
if (!isNode(inner, 'FunctionCall'))
|
|
557
|
+
return false;
|
|
558
|
+
const callee = unwrapCallOptions(inner.expression);
|
|
559
|
+
return isNode(callee, 'Identifier') && String(callee.name || '').toLowerCase() === 'type';
|
|
560
|
+
}
|
|
561
|
+
function isDirectBlockTimestamp(expr) {
|
|
562
|
+
return collectAccessPath(expr) === 'block.timestamp';
|
|
563
|
+
}
|
|
564
|
+
function isRequireOrAssertStatement(stmt) {
|
|
565
|
+
if (!isNode(stmt, 'ExpressionStatement') || !isNode(stmt.expression, 'FunctionCall'))
|
|
566
|
+
return false;
|
|
567
|
+
const name = getCalleeIdentifierName(stmt.expression.expression).toLowerCase();
|
|
568
|
+
return name === 'require' || name === 'assert';
|
|
569
|
+
}
|
|
570
|
+
function makeFinding(ctx, loc, sink) {
|
|
571
|
+
return {
|
|
572
|
+
file: ctx.file,
|
|
573
|
+
contract: ctx.contractName,
|
|
574
|
+
'function': ctx.functionName,
|
|
575
|
+
line: loc.line,
|
|
576
|
+
endLine: loc.line,
|
|
577
|
+
column: loc.column,
|
|
578
|
+
pattern: sink.pattern,
|
|
579
|
+
confidence: 'medium',
|
|
580
|
+
ruleId: RULE_ID,
|
|
581
|
+
severity: 'medium',
|
|
582
|
+
message: sink.message,
|
|
583
|
+
rationale: sink.rationale,
|
|
584
|
+
suggestedFix: suggestedFixFor(sink.pattern),
|
|
585
|
+
contractName: ctx.contractName,
|
|
586
|
+
functionName: ctx.functionName,
|
|
587
|
+
sourceLocation: { line: loc.line, column: loc.column },
|
|
588
|
+
findingId: '',
|
|
589
|
+
contractHash: '',
|
|
590
|
+
provenance: PROVENANCE,
|
|
591
|
+
source: PROVENANCE,
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
function suggestedFixFor(pattern) {
|
|
595
|
+
if (pattern === APPROVE_RACE_PATTERN) {
|
|
596
|
+
return 'Require zero-first allowance updates or expose increaseAllowance/decreaseAllowance style delta updates instead of direct non-zero overwrites.';
|
|
597
|
+
}
|
|
598
|
+
if (pattern === RESULT_REVEAL_PATTERN) {
|
|
599
|
+
return 'Separate input commitment from value resolution with a commit-reveal or sealed-bid phase so the winning input is not visible before ordering is fixed.';
|
|
600
|
+
}
|
|
601
|
+
if (pattern === FIRST_CLAIMER_PATTERN) {
|
|
602
|
+
return 'Protect initializer and first-claimer flows with access control, constructor-time setup, or a deployment process that cannot be won by an arbitrary caller.';
|
|
603
|
+
}
|
|
604
|
+
if (pattern === SPOT_SETTLEMENT_PATTERN) {
|
|
605
|
+
return 'Require caller-supplied minOut/maxIn bounds, an effective deadline, and replay/nonce protection before moving value from a spot-derived amount.';
|
|
606
|
+
}
|
|
607
|
+
return 'Require caller-supplied non-zero minOut/maxIn bounds and forward an effective deadline such as a caller deadline or block.timestamp plus a bounded offset.';
|
|
608
|
+
}
|
|
609
|
+
function cloneCtx(ctx) {
|
|
610
|
+
return {
|
|
611
|
+
...ctx,
|
|
612
|
+
params: new Set(ctx.params),
|
|
613
|
+
zeroValues: new Set(ctx.zeroValues),
|
|
614
|
+
maxValues: new Set(ctx.maxValues),
|
|
615
|
+
oracleDerived: new Set(ctx.oracleDerived),
|
|
616
|
+
guardedOutputs: new Set(ctx.guardedOutputs),
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
function getNamedCallArgument(call, targetNames) {
|
|
620
|
+
const targets = new Set(targetNames.map(name => name.toLowerCase()));
|
|
621
|
+
const names = getArgumentNames(call).map(name => name.toLowerCase());
|
|
622
|
+
const args = getCallArguments(call);
|
|
623
|
+
const index = names.findIndex(name => targets.has(name));
|
|
624
|
+
if (index >= 0)
|
|
625
|
+
return args[index] || null;
|
|
626
|
+
for (const rawArg of getRawCallArguments(call)) {
|
|
627
|
+
if (!isNode(rawArg, 'NameValueExpression'))
|
|
628
|
+
continue;
|
|
629
|
+
const name = nodeName(rawArg.name).toLowerCase();
|
|
630
|
+
if (targets.has(name))
|
|
631
|
+
return rawArg.expression ?? rawArg.value ?? null;
|
|
632
|
+
}
|
|
633
|
+
return null;
|
|
634
|
+
}
|
|
635
|
+
function getArgumentNames(call) {
|
|
636
|
+
if (Array.isArray(call?.names))
|
|
637
|
+
return call.names.map(nodeName);
|
|
638
|
+
if (Array.isArray(call?.arguments?.names))
|
|
639
|
+
return call.arguments.names.map(nodeName);
|
|
640
|
+
if (Array.isArray(call?.identifiers))
|
|
641
|
+
return call.identifiers.map(nodeName);
|
|
642
|
+
return [];
|
|
643
|
+
}
|
|
644
|
+
function getCallArguments(node) {
|
|
645
|
+
return getRawCallArguments(node).map(arg => isNode(arg, 'NameValueExpression') ? (arg.expression ?? arg.value ?? null) : arg);
|
|
646
|
+
}
|
|
647
|
+
function getRawCallArguments(node) {
|
|
648
|
+
return Array.isArray(node?.arguments) ? node.arguments : [];
|
|
649
|
+
}
|
|
650
|
+
function unwrapCallOptions(expr) {
|
|
651
|
+
let current = expr;
|
|
652
|
+
while (current && (isNode(current, 'NameValueExpression') || isNode(current, 'FunctionCallOptions'))) {
|
|
653
|
+
current = current.expression;
|
|
654
|
+
}
|
|
655
|
+
return current;
|
|
656
|
+
}
|
|
657
|
+
function getCalleeIdentifierName(expr) {
|
|
658
|
+
const unwrapped = unwrapCallOptions(expr);
|
|
659
|
+
if (isNode(unwrapped, 'Identifier'))
|
|
660
|
+
return String(unwrapped.name || '');
|
|
661
|
+
if (isNode(unwrapped, 'MemberAccess'))
|
|
662
|
+
return String(unwrapped.memberName || '');
|
|
663
|
+
return '';
|
|
664
|
+
}
|
|
665
|
+
function getVariableDeclarations(stmt) {
|
|
666
|
+
if (Array.isArray(stmt?.variables))
|
|
667
|
+
return stmt.variables;
|
|
668
|
+
if (Array.isArray(stmt?.declarations))
|
|
669
|
+
return stmt.declarations;
|
|
670
|
+
return [];
|
|
671
|
+
}
|
|
672
|
+
function collectAssignTargets(node) {
|
|
673
|
+
if (!node || typeof node !== 'object')
|
|
674
|
+
return [];
|
|
675
|
+
if (isNode(node, 'Identifier'))
|
|
676
|
+
return node.name ? [String(node.name)] : [];
|
|
677
|
+
if (isNode(node, 'TupleExpression'))
|
|
678
|
+
return getTupleComponents(node).flatMap(collectAssignTargets);
|
|
679
|
+
return [];
|
|
680
|
+
}
|
|
681
|
+
function getTupleComponents(node) {
|
|
682
|
+
if (Array.isArray(node?.components))
|
|
683
|
+
return node.components;
|
|
684
|
+
if (Array.isArray(node?.elements))
|
|
685
|
+
return node.elements;
|
|
686
|
+
return [];
|
|
687
|
+
}
|
|
688
|
+
function isAssignmentNode(node) {
|
|
689
|
+
if (!node || typeof node !== 'object')
|
|
690
|
+
return false;
|
|
691
|
+
if (isNode(node, 'Assignment'))
|
|
692
|
+
return true;
|
|
693
|
+
return isNode(node, 'BinaryOperation') && String(node.operator || '') === '=';
|
|
694
|
+
}
|
|
695
|
+
function getBinaryLeft(node) {
|
|
696
|
+
return node?.left ?? node?.leftExpression ?? node?.leftHandSide;
|
|
697
|
+
}
|
|
698
|
+
function getBinaryRight(node) {
|
|
699
|
+
return node?.right ?? node?.rightExpression ?? node?.rightHandSide;
|
|
700
|
+
}
|
|
701
|
+
function accessRoot(node) {
|
|
702
|
+
const path = collectAccessPath(node);
|
|
703
|
+
return path ? path.split(/[.\[]/)[0] : null;
|
|
704
|
+
}
|
|
705
|
+
function addAccessRoot(node, target) {
|
|
706
|
+
const root = accessRoot(node);
|
|
707
|
+
if (root)
|
|
708
|
+
target.add(root);
|
|
709
|
+
}
|
|
710
|
+
function collectAccessPath(node) {
|
|
711
|
+
if (!node || typeof node !== 'object')
|
|
712
|
+
return null;
|
|
713
|
+
if (isNode(node, 'Identifier'))
|
|
714
|
+
return node.name ? String(node.name) : null;
|
|
715
|
+
if (isNode(node, 'MemberAccess')) {
|
|
716
|
+
const base = collectAccessPath(node.expression);
|
|
717
|
+
if (!base || !node.memberName)
|
|
718
|
+
return null;
|
|
719
|
+
return `${base}.${String(node.memberName)}`;
|
|
720
|
+
}
|
|
721
|
+
if (isNode(node, 'IndexAccess')) {
|
|
722
|
+
const base = collectAccessPath(node.base ?? node.baseExpression);
|
|
723
|
+
return base ? `${base}[]` : null;
|
|
724
|
+
}
|
|
725
|
+
return null;
|
|
726
|
+
}
|
|
727
|
+
function isExternallyCallable(fn) {
|
|
728
|
+
const visibility = String(fn.visibility || '').toLowerCase();
|
|
729
|
+
if (visibility === 'private' || visibility === 'internal')
|
|
730
|
+
return false;
|
|
731
|
+
const kind = String(fn.kind || '').toLowerCase();
|
|
732
|
+
return kind !== 'constructor' && !fn.isConstructor;
|
|
733
|
+
}
|
|
734
|
+
function isInterfaceLike(contract) {
|
|
735
|
+
const kind = String(contract?.kind || contract?.contractKind || '').toLowerCase();
|
|
736
|
+
return kind === 'interface' || kind === 'library';
|
|
737
|
+
}
|
|
738
|
+
function getParameters(fn) {
|
|
739
|
+
if (Array.isArray(fn?.parameters))
|
|
740
|
+
return fn.parameters;
|
|
741
|
+
if (Array.isArray(fn?.parameters?.parameters))
|
|
742
|
+
return fn.parameters.parameters;
|
|
743
|
+
return [];
|
|
744
|
+
}
|
|
745
|
+
function getContractFunctions(contract) {
|
|
746
|
+
return getContractMembers(contract).filter(node => isNode(node, 'FunctionDefinition'));
|
|
747
|
+
}
|
|
748
|
+
function getContractMembers(contract) {
|
|
749
|
+
if (Array.isArray(contract?.subNodes))
|
|
750
|
+
return contract.subNodes;
|
|
751
|
+
if (Array.isArray(contract?.nodes))
|
|
752
|
+
return contract.nodes;
|
|
753
|
+
return [];
|
|
754
|
+
}
|
|
755
|
+
function getBlockStatements(body) {
|
|
756
|
+
return Array.isArray(body?.statements) ? body.statements : [];
|
|
757
|
+
}
|
|
758
|
+
function collectContracts(ast) {
|
|
759
|
+
const out = [];
|
|
760
|
+
walk(ast, node => {
|
|
761
|
+
if (isNode(node, 'ContractDefinition'))
|
|
762
|
+
out.push(node);
|
|
763
|
+
});
|
|
764
|
+
return out;
|
|
765
|
+
}
|
|
766
|
+
function walk(node, visit) {
|
|
767
|
+
if (!node || typeof node !== 'object')
|
|
768
|
+
return;
|
|
769
|
+
visit(node);
|
|
770
|
+
for (const child of childrenOf(node))
|
|
771
|
+
walk(child, visit);
|
|
772
|
+
}
|
|
773
|
+
function walkAny(node, predicate) {
|
|
774
|
+
if (!node || typeof node !== 'object')
|
|
775
|
+
return false;
|
|
776
|
+
if (predicate(node))
|
|
777
|
+
return true;
|
|
778
|
+
for (const child of childrenOf(node)) {
|
|
779
|
+
if (walkAny(child, predicate))
|
|
780
|
+
return true;
|
|
781
|
+
}
|
|
782
|
+
return false;
|
|
783
|
+
}
|
|
784
|
+
function childrenOf(node) {
|
|
785
|
+
if (!node || typeof node !== 'object')
|
|
786
|
+
return [];
|
|
787
|
+
const out = [];
|
|
788
|
+
for (const [key, value] of Object.entries(node)) {
|
|
789
|
+
if (key === 'loc' || key === 'src' || key === 'range' || key === 'typeDescriptions' || key === 'id')
|
|
790
|
+
continue;
|
|
791
|
+
if (Array.isArray(value)) {
|
|
792
|
+
for (const item of value)
|
|
793
|
+
if (item && typeof item === 'object')
|
|
794
|
+
out.push(item);
|
|
795
|
+
}
|
|
796
|
+
else if (value && typeof value === 'object') {
|
|
797
|
+
out.push(value);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
return out;
|
|
801
|
+
}
|
|
802
|
+
function isNode(node, kind) {
|
|
803
|
+
return node?.type === kind || node?.nodeType === kind;
|
|
804
|
+
}
|
|
805
|
+
function getName(node) {
|
|
806
|
+
return typeof node?.name === 'string' ? node.name : '';
|
|
807
|
+
}
|
|
808
|
+
function nodeName(node) {
|
|
809
|
+
if (typeof node === 'string')
|
|
810
|
+
return node;
|
|
811
|
+
if (!node || typeof node !== 'object')
|
|
812
|
+
return '';
|
|
813
|
+
return String(node.name || node.namePath || node.memberName || '');
|
|
814
|
+
}
|
|
815
|
+
function locOf(node, sourceText = '') {
|
|
816
|
+
if (node?.loc?.start)
|
|
817
|
+
return { line: node.loc.start.line || 0, column: node.loc.start.column || 0 };
|
|
818
|
+
if (typeof node?.src === 'string' && sourceText) {
|
|
819
|
+
const start = Number(node.src.split(':')[0]);
|
|
820
|
+
if (Number.isFinite(start))
|
|
821
|
+
return offsetToLoc(sourceText, start);
|
|
822
|
+
}
|
|
823
|
+
return null;
|
|
824
|
+
}
|
|
825
|
+
function offsetToLoc(sourceText, offset) {
|
|
826
|
+
let line = 1;
|
|
827
|
+
let lineStart = 0;
|
|
828
|
+
for (let i = 0; i < sourceText.length && i < offset; i++) {
|
|
829
|
+
if (sourceText.charCodeAt(i) === 10) {
|
|
830
|
+
line++;
|
|
831
|
+
lineStart = i + 1;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
return { line, column: Math.max(0, offset - lineStart) };
|
|
835
|
+
}
|
|
836
|
+
//# sourceMappingURL=generalized-frontrunning.js.map
|