Open
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.