Skip to content

Conversation

devin-ai-integration[bot]
Copy link
Contributor

Summary

This PR migrates the contract_manager package from web3.js to viem, replacing all Web3 dependencies with viem's modern TypeScript-first API. The migration includes:

  • Core infrastructure: Updated EvmChain class to use viem's createPublicClient and createWalletClient
  • Contract interactions: Refactored all EVM contract classes to use viem's getContract with typed read/write methods
  • Transaction handling: Rewrote transaction estimation, sending, and receipt handling using viem patterns
  • Scripts migration: Updated all 13 scripts to use viem APIs for contract interactions and event parsing
  • Dependencies: Removed web3, web3-eth-contract, and @types/web3; retained viem ^2.23.5
  • Version bump: Incremented from 1.0.1 to 1.1.0 for this significant API change

Rationale

This migration provides:

  • Better TypeScript support: viem offers superior type safety and inference compared to web3.js
  • Modern APIs: More intuitive functional approach vs web3's callback-heavy patterns
  • Performance improvements: viem is generally faster and has smaller bundle sizes
  • Consistency: Aligns with patterns already established in the price_pusher application

How has this been tested?

  • Current tests cover my changes (TypeScript compilation successful)
  • Added new tests
  • Manually tested the code

Build verification:

  • pnpm turbo build - All 21 tasks successful including contract_manager compilation
  • pnpm run fix:lint - All linting errors resolved
  • pre-commit run --all-files - Core TypeScript checks passed

Review Focus Areas

🔴 Critical - Transaction Logic

  • Verify estiamteAndSendTransaction method signature changes don't break calling code
  • Test deploy method works correctly with gas estimation and contract creation
  • Validate gas price calculation produces reasonable values (especially the testnet 2x multiplier)

🟡 Important - Type Safety

  • Review eslint-disable-next-line comments with as any casts in contract methods
  • Ensure event parsing logic works correctly with new viem event structure
  • Check that utility function replacements (keccak256, formatEther, etc.) are equivalent

🟡 Important - Script Compatibility

  • Scripts now use different transaction sending patterns - verify they work with real networks
  • Event handling changed from event.returnValues to event.args - confirm this works across all contract types
  • Function encoding changed from encodeABI() to encodeFunctionData() - verify ABI compatibility

Link to Devin run: https://app.devin.ai/sessions/0ca65ffd62684f73ab3603e2d8fa75af
Requested by: Jayant ([email protected])

- Replace web3.js with viem for better TypeScript support and modern API
- Update EvmChain class methods to use viem's createPublicClient and createWalletClient
- Refactor all EVM contract classes to use viem's getContract and typed read/write methods
- Update all scripts to use viem APIs for transactions and contract interactions
- Remove web3, web3-eth-contract, and @types/web3 dependencies
- Bump version from 1.0.1 to 1.1.0
- Add proper type handling with eslint-disable comments where needed
- Format JSON store files with prettier

Following patterns established in the price_pusher application.

Co-Authored-By: Jayant <[email protected]>
@devin-ai-integration devin-ai-integration bot requested a review from a team as a code owner October 3, 2025 23:25
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link

vercel bot commented Oct 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
proposals Ready Ready Preview Comment Oct 3, 2025 11:36pm
staking Ready Ready Preview Comment Oct 3, 2025 11:36pm
5 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
api-reference Skipped Skipped Oct 3, 2025 11:36pm
component-library Skipped Skipped Oct 3, 2025 11:36pm
developer-hub Skipped Skipped Oct 3, 2025 11:36pm
entropy-explorer Skipped Skipped Oct 3, 2025 11:36pm
insights Skipped Skipped Oct 3, 2025 11:36pm

@vercel vercel bot temporarily deployed to Preview – developer-hub October 3, 2025 23:32 Inactive
@vercel vercel bot temporarily deployed to Preview – api-reference October 3, 2025 23:32 Inactive
@vercel vercel bot temporarily deployed to Preview – insights October 3, 2025 23:32 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-explorer October 3, 2025 23:32 Inactive
@vercel vercel bot temporarily deployed to Preview – component-library October 3, 2025 23:32 Inactive
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.

0 participants