Explore-Beyond-Innovations/ZeroXBridge_Contracts
GitHub で見るAdd interactive TS script to register tokens
Open
#114 opened on 2025年8月21日
3 Days ETAenhancementgood first issue
Repository metrics
- Stars
- (4 stars)
- PR merge metrics
- (PR metrics pending)
説明
Summary
Create a Node/TypeScript interactive script that lets an admin register tokens via the contract function:
function registerToken(AssetType assetType, address tokenAddress, address priceFeed, uint8 decimals)
enum AssetType { ETH, ERC20 }
Requirements
-
File path:
scripts/registertoken.ts -
Prompts the admin for:
- Asset Type (
ETHorERC20) - Token Address (skip/zero address if
ETH) - Price Feed Address (Chainlink Sepolia; link in script help)
- Decimals (e.g., 18 for ETH/ERC20)
- Asset Type (
-
Validates inputs (addresses, decimals range, etc.)
-
Loads config from env:
RPC_URL(Sepolia)PRIVATE_KEY(admin)CONTRACT_ADDRESS(ZeroXBridge or Registry contract exposingregisterToken)
-
Displays a full transaction preview and asks for confirmation
-
Sends the tx and prints:
- hash
- mined block number
- gas used
-
Clean exit codes (non-zero on failure)
-
Include minimal ABI for
registerToken+AssetType
Reference
-
Chainlink Sepolia price feeds: (use to pick feed addresses)
Acceptance Criteria
- Running
ts-node scripts/registertoken.ts(orpnpm ts-node …) launches an interactive flow - Successful registration logs tx details; failures provide actionable errors
- Input validation prevents obvious misconfigs (bad address, decimals, etc.)
- Script is documented with a short header comment and usage notes