Matsya is a decentralized exchange (DEX) frontend built with React, Redux, and ethers.js. It connects to on-chain Token and Exchange contracts using the ABIs in src/abis and the address map in src/config.json.
- MetaMask connection, account display, and balance lookup
- Network switching for localhost and Sepolia
- Market selector that loads token contracts per pair
- Hardhat setup for local blockchain development
- React 18 + Redux
- ethers.js
- Hardhat + Waffle/Chai
- Create React App tooling
contracts/Solidity contracts (currently onlyToken.sol)scripts/Hardhat deployment scriptssrc/React app, Redux store, ABIs, assets, stylessrc/config.jsonChain IDs mapped to contract addresses
- Node.js 16+ and npm
- MetaMask (or another injected wallet)
npm installnpm startOpen http://localhost:3000.
npx hardhat nodenpx hardhat run scripts/1_deploy.js --network localhostAfter deployment, update src/config.json with the new addresses before opening the UI.
src/config.json maps chain IDs to contract addresses used by the UI. For local development (chain ID 31337), set:
Exchange.address- Token addresses for each market (e.g.,
Chillar,Sukka,Morr)
If you redeploy contracts, update these values. The Sepolia entry currently only contains an explorer URL, so it will show "Not Deployed to Network" until you add addresses.
src/abis/Token.jsondescribes an ERC-20 interface.src/abis/Exchange.jsondescribes the exchange interface.
Important: contracts/Token.sol is currently a minimal placeholder and does not match src/abis/Token.json. The UI calls ERC-20 methods like symbol() and decimals(), so deploy an ERC-20-compatible token and keep the ABI and address map in sync.
If you want to deploy the Exchange contract, add its source to contracts/, compile and deploy it, then update src/abis/Exchange.json and src/config.json accordingly.
The current UI renders the Navbar and Market selector. Sections for orderbook, trades, balances, and charts are present in the layout but not yet implemented in components.
- "Not Deployed to Network": the active chain ID is missing from
src/config.json. - Token symbols fail to load: the token contract is not ERC-20 compatible with
src/abis/Token.json. - Stale addresses: redeploys require updated addresses in
src/config.json.
npm startRun the React appnpm testRun CRA testsnpm run buildCreate production buildnpx hardhat nodeStart a local blockchainnpx hardhat run scripts/1_deploy.js --network localhostDeploy contracts