This document provides detailed instructions to set up, deploy, and run the On-Chain FDIC Insurance DApp on your machine and the Polygon Amoy Testnet.
- Prerequisites
- Installation Steps
- Deployment Instructions
- MetaMask Configuration
- Regulator Actions
- Troubleshooting
- Conclusion
Ensure you have the following installed:
- Node.js (v14 or later)
- npm (v6 or later)
- Truffle (v5 or later)
- Ganache CLI or Ganache GUI (for local testing)
- MetaMask browser extension
- Git
git clone https://github.com/yourusername/fdic-dapp.git
cd fdic-dappnpm init -y
npm install truffle --save-devNavigate to the frontend directory:
cd frontend
yarn installIf using Ganache CLI:
npm install -g ganache-cli
ganache-cliIf using Ganache GUI:
- Start a new workspace.
In the root directory:
npx truffle compile
npx truffle migrate --network developmentCreate a .env file in the root directory:
MNEMONIC="your_mnemonic_here"Ensure you replace your_mnemonic_here with the mnemonic of your MetaMask wallet that has access to the Polygon Amoy Testnet.
npx truffle compile
npx truffle migrate --network sepoliaOnce deployed, copy the contract address.
Copy the compiled contract's ABI to the frontend:
mkdir -p frontend/src/abis
cp build/contracts/ERC20FDIC.json frontend/src/abis/
cp build/contracts/USDCERC20.json frontend/src/abis/In frontend/src/RegulatorPanel.jsx and frontend/src/useFDICContract.js, update the contract address:
const fdicContractAddress = '0xYourDeployedContractAddress'; // Replace with the contract address deployed on Polygon AmoyIn the frontend directory:
cd frontend
yarn startOpen http://localhost:5174 in your browser.
To interact with the deployed contract on Polygon Amoy Testnet:
- Network Name: Sepolia Testnet
- RPC URL:
https://sepolia.infura.io/v3/YOUR_INFURA_PROJECT_ID - Chain ID:
11155111 - Currency Symbol: ETH
- Block Explorer URL:
https://sepolia.etherscan.io/
Once the contract is deployed and the frontend is set up, the regulator (contract creator) can perform actions via the Regulator Panel in the UI.
Alternatively, use the Truffle Console to register banks and mark them as failed:
npx truffle console --network polygon_amoyIn the console:
let fdic = await OnChainFDIC.deployed();
// Register a bank
await fdic.registerBank('0xBankAddress', { from: '0xYourRegulatorWalletAddress' });
// Mark a bank as failed
await fdic.failBank('0xBankAddress', { from: '0xYourRegulatorWalletAddress' });-
Contract Address Not Found: Retrieve it from the Truffle console using
fdic.address.let fdic = await OnChainFDIC.deployed(); fdic.address;
-
MetaMask Not Connecting: Ensure MetaMask is connected to the Polygon Amoy Testnet and has access to the correct wallet.
-
Frontend Issues: Check the browser console for errors, ensure the correct contract address is used, and verify the network configuration.