Skip to content

Latest commit

 

History

History
203 lines (131 loc) · 4.54 KB

File metadata and controls

203 lines (131 loc) · 4.54 KB

INSTALL.md

Installation and Deployment Instructions

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.

Table of Contents


Prerequisites

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

Installation Steps

1. Clone the Repository

git clone https://github.com/yourusername/fdic-dapp.git
cd fdic-dapp

2. Set Up the Smart Contract

a. Initialize npm and Install Truffle

npm init -y
npm install truffle --save-dev

4. Set Up the Frontend DApp

b. Install Dependencies

Navigate to the frontend directory:

cd frontend
yarn install

Deployment Instructions

1. Deploy to Local Blockchain (Ganache)

a. Start Local Blockchain

If using Ganache CLI:

npm install -g ganache-cli
ganache-cli

If using Ganache GUI:

  • Start a new workspace.

b. Compile and Deploy Smart Contract

In the root directory:

npx truffle compile
npx truffle migrate --network development

2. Deploy to Sepolia Testnet

a. Set Up Environment Variables

Create 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.

b. Compile and Deploy

npx truffle compile
npx truffle migrate --network sepolia

Once deployed, copy the contract address.

3. Update Frontend Configuration

a. Copy ABI to Frontend

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/

b. Update Contract Address in Frontend

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 Amoy

4. Run the Frontend DApp

In the frontend directory:

cd frontend
yarn start

Open http://localhost:5174 in your browser.


MetaMask Configuration

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/

Regulator Actions

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_amoy

In 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' });

Troubleshooting

  • 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.