Skip to content

DEVREL-155: Auto populate Register.sol#51

Merged
andrejrakic merged 4 commits intodevelopfrom
feat/ccip-register-seeding
Jan 14, 2026
Merged

DEVREL-155: Auto populate Register.sol#51
andrejrakic merged 4 commits intodevelopfrom
feat/ccip-register-seeding

Conversation

@Nalon
Copy link
Copy Markdown
Collaborator

@Nalon Nalon commented Jan 10, 2026

Summary

This PR adds automated tooling to fetch and update CCIP network details from Chainlink's API, ensuring the Register.sol contract always contains the latest network configurations.

Changes

1. Added CCIP Network Details Update Script (scripts/ccip/updateRegisterContract.js)

  • Created a new script that queries Chainlink's CCIP API endpoints to fetch network configuration details
  • Fetches chain information (routers, selectors, fee tokens) and token information (CCIP-BnM and CCIP-LnM addresses)
  • Supports both testnet and mainnet environments
  • Automatically updates Register.sol with hardcoded network details in the constructor
  • Replaces the constructor body while preserving the contract structure

2. Added NPM Scripts (package.json)

  • update-register - Updates Register.sol with testnet data (default)
  • update-register:testnet - Explicitly updates with testnet data
  • update-register:mainnet - Updates with mainnet data
  • pregenerate-docs - Automatically runs update-register:testnet before generating documentation

3. Updated Register.sol

  • Updated with latest network details from the CCIP API

Benefits

  • Automated Updates: Network details are automatically fetched from Chainlink's API instead of being manually maintained
  • Documentation Integration: Register.sol is automatically updated before generating docs, ensuring documentation reflects the latest network configurations
  • Flexibility: Supports both testnet and mainnet environments
  • Consistency: Ensures all network details are up-to-date and consistent across the codebase

Usage

Update Register.sol with testnet data (default)

npm run update-register

Update with testnet data explicitly

npm run update-register:testnet

Update with mainnet data

npm run update-register:mainnet

Generate docs (automatically updates Register.sol first)

npm run generate-docs

Testing

  • Script successfully fetches data from Chainlink's CCIP API
  • Register.sol is correctly generated with proper constructor formatting
  • NPM scripts execute without errors

- Added script to query CCIP API and update Register.sol constructor
- Updated Register.sol with latest contents
- Added npm script to update the register contract
- Added pre script that updates the register contract whenever generate-docs is called
@Nalon Nalon requested review from a team and andrejrakic as code owners January 10, 2026 13:59
package.json Outdated
"generate-docs": "npm run generate-solidity && npm run generate-jsdoc && npm run generate-index && npm run prettier",
"update-register": "node scripts/ccip/updateRegisterContract.js",
"update-register:testnet": "node scripts/ccip/updateRegisterContract.js testnet",
"update-register:mainnet": "node scripts/ccip/updateRegisterContract.js mainnet"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

running this overwrites testnets' details. i think it should keep both

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I have updated the script to grab both testnet and mainnet on execute

- Updated updateRegisterContract.js to include both mainnet and testnet networks in Register.sol
- Updated Register.sol with latest contents for both mainnet and testnet networks
- Updated package.json scripts to reflect the changes
@Nalon Nalon requested a review from andrejrakic January 12, 2026 23:42
Copy link
Copy Markdown
Collaborator

@andrejrakic andrejrakic left a comment

Choose a reason for hiding this comment

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

nicely done 👏🏻

@andrejrakic andrejrakic merged commit 382c10a into develop Jan 14, 2026
@andrejrakic andrejrakic deleted the feat/ccip-register-seeding branch January 14, 2026 14:43
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.

2 participants