Skip to content

Comments

Added support for multiple blockchains#64

Closed
shivambisen wants to merge 6 commits intoStabilityNexus:mainfrom
shivambisen:main
Closed

Added support for multiple blockchains#64
shivambisen wants to merge 6 commits intoStabilityNexus:mainfrom
shivambisen:main

Conversation

@shivambisen
Copy link
Contributor

@shivambisen shivambisen commented Jan 21, 2025

Related Issue:
Fixes #45.

Overview
Previously, FairFund smart contracts and the frontend were deployed and configured only for Polygon. To reach a wider audience, this update adds support for an additional EVM-compatible network—Ethereum Classic Testnet—by updating both the deployment process and frontend integration.

Changes Made:

Ethereum Classic Testnet Deployment:
Updated deployment scripts to deploy and verify the FairFund smart contracts on Ethereum Modor and verification trough Blockscout.

Contract Registry:
Implemented a registry mapping that maps each supported chain (currently Polygon and Ethereum Classic Testnet) to its corresponding deployed contract address. This registry is maintained in production/FairFunddeployment.json file for frontend consumption.(Deployfaifund.s.sol)

Frontend Architecture Updates:

Dynamic Contract Address Mapping:
Refactored the constants.ts file and vault-form.tsx to implement a chain-to-contract-address mapping system. The frontend now dynamically selects the correct contract address based on the connected chain.

Networks:
added a networks file to configure addition networks which are not included into @reown/appkit/networks

Updated Wagmi Configuration:
Modified the Wagmi configuration to support multiple networks.

Testing

Smart Contract Testing:
The contract functions have been verified on both Polygon amoy and Ethereum Classic Testnets.

Frontend Testing:
Dynamic contract address selection and network-specific configurations were tested by creating test vaults and adding funds into vault

@adityabhattad2021
Copy link
Contributor

Polygon Mumbai is depricated, Binance Smart Chain is not needed.
Also Milkomeda would be a nice addition.

@shivambisen
Copy link
Contributor Author

I have made the suggested changes please review

Copy link
Contributor

@adityabhattad2021 adityabhattad2021 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please go through the comments.

import { foundry, polygonAmoy, sepolia, goerli, AppKitNetwork } from '@reown/appkit/networks';


const milkomedaTestnet: AppKitNetwork = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is repeated code (used in siwe/index.ts as well, could you put in a seperate file and import it from there?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will create a networks file and export milkomedaTestnet as Bruno mentioned in the community. I referred to Clowder for guidance, and this network configuration should work as expected.

package.json Outdated
},
"dependencies": {
"@wagmi/chains": "^1.8.0",
"@wagmi/core": "^2.16.3",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's not required. I might have accidentally installed it. I will be careful from next time

@adityabhattad2021
Copy link
Contributor

adityabhattad2021 commented Feb 2, 2025

Ethereum Goerli is also deprecated.

@shivambisen
Copy link
Contributor Author

made required changes

@shivambisen shivambisen reopened this Feb 25, 2025

function getOrCreateAnvilEthConfig() public view returns (NetworkConfig memory anvilNetworkConfig) {
anvilNetworkConfig = NetworkConfig({deployerKey: DEFAULT_ANVIL_PRIVATE_KEY});
function getSepoliaConfig() public view returns (NetworkConfig memory) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see the latest commit.

@@ -1 +1 @@
{"fairFund":"0x5FbDB2315678afecb367f032d93F642f64180aa3"} No newline at end of file
{"ethereumMordor": "0x3B081a1a7aE4d8C7247d65BB669CF55a65F1A870","polygonTestnet": "0xF4aaAaD23abE965Ae584D98a95F5802dC142F32d"} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the address for polygon mainnet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added now

@adityabhattad2021
Copy link
Contributor

Please make a PR on develop branch and also if possible, please include a video of this working as expected.

@shivambisen
Copy link
Contributor Author

@adityabhattad2021 i have raised a PR on develop branch and provided a video too

@adityabhattad2021
Copy link
Contributor

completed with #76

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.

2 participants