Explore-Beyond-Innovations / Explore-Beyond-Innovations/ZeroXBridge_Contracts
Add interactive TS script to register tokens
- Dominant language
- Cairo
- Stars
- 4
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
### Summary
Create a **Node/TypeScript interactive script** that lets an admin register tokens via the contract function:
```solidity
function registerToken(AssetType assetType, address tokenAddress, address priceFeed, uint8 decimals)
```
```solidity
enum AssetType { ETH, ERC20 }
```
### Requirements
* File path: `scripts/registertoken.ts`
* Prompts the admin for:
* **Asset Type** (`ETH` or `ERC20`)
* **Token Address** (skip/zero address if `ETH`)
* **Price Feed Address** (Chainlink Sepolia; link in script help)
* **Decimals** (e.g., 18 for ETH/ERC20)
* Validates inputs (addresses, decimals range, etc.)
* Loads config from env:
* `RPC_URL` (Sepolia)
* `PRIVATE_KEY` (admin)
* `CONTRACT_ADDRESS` (ZeroXBridge or Registry contract exposing `registerToken`)
* 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)
* [https://docs.chain.link/data-feeds/price-feeds/addresses?page=1\&testnetPage=1\&network=ethereum#sepolia-testnet](https://docs.chain.link/data-feeds/price-feeds/addresses?page=1&testnetPage=1&network=ethereum#sepolia-testnet)
### Acceptance Criteria
* Running `ts-node scripts/registertoken.ts` (or `pnpm 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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.