Skip to content

Feature/polygon arbitrum support#5

Open
EAbdelilah wants to merge 2 commits intoParasgr7:mainfrom
EAbdelilah:feature/polygon-arbitrum-support
Open

Feature/polygon arbitrum support#5
EAbdelilah wants to merge 2 commits intoParasgr7:mainfrom
EAbdelilah:feature/polygon-arbitrum-support

Conversation

@EAbdelilah
Copy link

No description provided.

This commit introduces the necessary configurations and script modifications
to enable deployment and interaction with the lending and borrowing platform
on Polygon and Arbitrum networks.

Key changes include:

1.  **Truffle Configuration (`truffle-config.js`):**
    *   I added network configurations for Polygon mainnet/mumbai and
        Arbitrum mainnet/goerli, including RPC setup via environment
        variables and chain IDs.

2.  **Helper Scripts (`scripts/helpful_scripts.js`):**
    *   I refactored these to support network-specific contract addresses.
    *   I added placeholder addresses for DAI, WETH, LINK, FAU, and their
        respective price feeds for Polygon and Arbitrum. These require
        your manual updating with actual addresses before deployment.
    *   I modified `get_contract` to retrieve addresses based on the
        current network.

3.  **Deployment Scripts (`migrations/2_deploy_contracts.js`):**
    *   I verified that the network parameter is correctly passed to
        `helpful_scripts.js` to fetch appropriate addresses.

4.  **Frontend Adjustments:**
    *   I reviewed UI components for network awareness.
    *   I applied minor fixes to transaction explorer links in modals,
        adding warnings that dynamic links are needed.
    *   I highlighted critical areas needing your attention:
        *   Refactoring `convertToDollar` to correctly use contract data.
        *   Implementing a robust `getExplorerLink` utility.

5.  **Documentation (`README.md`):**
    *   I updated this with detailed instructions for setting up environment
        variables, deploying to Polygon/Arbitrum, and running tests on
        these networks.
    *   I emphasized the need for you to update placeholder contract addresses.

6.  **Testing and Deployment Outline:**
    *   I confirmed unit tests are largely network-agnostic.
    *   I noted the absence of integration tests and the need for them.
    *   I outlined procedures for running tests on testnets.
    *   I described the manual deployment process and how to verify
        ABI file updates.

**Action Required by You:**
*   Populate placeholder contract addresses in `scripts/helpful_scripts.js`.
*   Write integration tests.
*   Implement identified frontend improvements (USD conversion, explorer links).
*   Thoroughly test on testnets before mainnet deployments.
This commit addresses several frontend issues to improve usability and
correctness when interacting with multiple blockchain networks (Polygon,
Arbitrum, and Ethereum).

Key changes include:

1.  **Refactored USD Conversion:**
    *   Removed the flawed `utils/convertToDollar.js` utility which
        incorrectly used React hooks.
    *   Updated components (e.g., `pages/reserve-overview/[slug].js`,
        `components/ui/ModalBorrow.js`) to rely on USD values and
        conversion rates (`oneTokenToDollar`) passed via props. This data
        is expected to be derived directly from the smart contract's
        `getAmountInDollars` method by upstream data fetching logic.

2.  **Dynamic Block Explorer Links:**
    *   Created a new utility `utils/networkUtils.js` with a
        `getExplorerLink(networkId, txHash)` function.
    *   This function generates correct block explorer URLs (Etherscan,
        PolygonScan, Arbiscan) for various mainnets and testnets.
    *   Updated `ModalSupply.js` and `ModalBorrow.js` to use this utility,
        replacing previously hardcoded or incorrect links.

3.  **Display Current Network Name:**
    *   Enhanced `components/ui/Navbar.js` to display the human-readable
        name of the currently connected blockchain network (e.g., "Ethereum",
        "Polygon", "Local Dev").
    *   The network name updates dynamically when you switch
        networks in your wallet.

4.  **Network-Aware "Add to Metamask" for WETH on Polygon:**
    *   Modified `components/ui/TokenInfo.js` so that when adding WETH
        to MetaMask while connected to Polygon (Mainnet or Mumbai), it
        suggests "WMATIC" as the token symbol.
    *   Includes an image fallback to the WETH image if a WMATIC-specific
        image is not configured.

These changes significantly improve the DApp's multi-chain capabilities
and provide a more accurate and user-friendly experience.
@vercel
Copy link

vercel bot commented Jun 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
defi-blockchain-prgl ❌ Failed (Inspect) Jun 6, 2025 9:12pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant