Skip to content

fix(foundry): resolve ABI when source file name differs from contract name#423

Merged
technophile-04 merged 3 commits into
mainfrom
fix-foundry-debug-diff-file-contract
May 19, 2026
Merged

fix(foundry): resolve ABI when source file name differs from contract name#423
technophile-04 merged 3 commits into
mainfrom
fix-foundry-debug-diff-file-contract

Conversation

@rin-st
Copy link
Copy Markdown
Member

@rin-st rin-st commented May 12, 2026

Noticed by Damu here

Summary

  • generateTsAbis.js looked up artifacts at out/<ContractName>.sol/<ContractName>.json, so contracts whose source file name differs from the contract name (e.g.
    OracleToken.sol containing contract ORA) were silently skipped and never appeared in deployedContracts.ts (or the debug page).
  • Fall back to scanning out/*.sol/ for <ContractName>.json when the conventional path doesn't exist. Fast path unchanged when names match.

Test plan

  • In a Foundry extension, rename a contract so it differs from its file name (e.g. file Foo.sol with contract Bar), deploy via a script, verify Bar appears in packages/nextjs/contracts/deployedContracts.ts and on the debug page. Example extension: Foundry support - Challenge-oracles se-2-challenges#440 . OracleToken.sol file with contract named ORA
  • Regression: verify contracts where file name matches contract name still resolve (fast path).

Test commands

yarn build:dev
yarn cli -e https://github.com/scaffold-eth/se-2-challenges/tree/challenge-oracles-foundry-v2 -s foundry --dev

Related #411

Copy link
Copy Markdown
Member

@damianmarti damianmarti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rin-st!!

Working great and code looks good!

Small comment:

yarn cli -e https://github.com/scaffold-eth/se-2-challenges/tree/challenge-oracles-foundry-v2 -s foundry --dev

dev flag doesn't work with URL (makes sense).

@technophile-04
Copy link
Copy Markdown
Collaborator

Thanks @rin-st! Working great!

@technophile-04 technophile-04 merged commit b77e016 into main May 19, 2026
7 checks passed
@technophile-04 technophile-04 deleted the fix-foundry-debug-diff-file-contract branch May 19, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants