This project supports automatic switching between Polygon Mainnet and Polygon Amoy Testnet using a single environment variable.
Leave VITE_USE_TESTNET empty or set to false in your .env file:
VITE_USE_TESTNET=""
# or
VITE_USE_TESTNET="false"Set VITE_USE_TESTNET to true in your .env file:
VITE_USE_TESTNET="true"That's it! The application will automatically use the correct contract addresses and chain configuration.
When VITE_USE_TESTNET is false or empty:
- Chain ID: 137 (0x89)
- Network: Polygon Mainnet
- PLR Token:
0xa6b37fC85d870711C56FbcB8afe2f8dB049AE774 - DAO Contract:
0xc380f15Db7be87441d0723F19fBb440AEaa734aB - Stake Amount: 10,000 PLR
- Explorer: https://polygonscan.com/tx/
When VITE_USE_TESTNET is true:
- Chain ID: 80002 (0x13882)
- Network: Polygon Amoy Testnet
- Test DAO Contract:
0xf1a8685519D456f47a9F3505035F4Bad5d9a9ce0 - Test Token (with airdrop function):
0x3cb29AAC77693A0784380Fb664Ec443Ce1079882 - Stake Amount: 10 tokens (for testing)
- Min Stake Time: 0.1 min (6 seconds)
- Test NFT Contract:
0x0901f5aBd34A9080Dded6dad72188aAbee8a976F - Explorer: https://www.oklink.com/amoy/tx/
You can still manually override individual contract addresses if needed. Manual overrides take precedence over the automatic configuration:
VITE_USE_TESTNET="true"
VITE_DAO_CONTRACT="0xYourCustomAddress" # This will override the testnet defaultThe configuration is managed by config/contracts.js, which:
- Checks the
VITE_USE_TESTNETenvironment variable - Loads the appropriate network configuration (mainnet or testnet)
- Allows manual overrides via individual environment variables
- Exports the final configuration for use throughout the application
The following components automatically use the correct network configuration:
components/dao/nft-transaction.js- NFT membership transactionscomponents/dao/unstake-gov-nft-flow.js- Unstaking flowcomponents/staking-hero.js- Staking hero section
-
Create/update
.env:VITE_USE_TESTNET="true" -
Restart the development server:
npm run dev
-
The app will now use Polygon Amoy testnet contracts
-
Get test tokens from the airdrop function:
- Contract:
0x3cb29AAC77693A0784380Fb664Ec443Ce1079882 - Use the airdrop function to get test PLR tokens
- Contract:
-
Ensure
.envhas testnet mode disabled:VITE_USE_TESTNET="false" -
Or simply leave it empty (default is mainnet)
Make sure to restart your development server after changing VITE_USE_TESTNET:
# Stop the server (Ctrl+C)
npm run dev # Start againCheck if you have manual overrides in your .env file. Manual overrides take precedence over automatic configuration.
Tests use mainnet configuration by default. If you need to test with testnet config, update jest.setup.js:
process.env.VITE_USE_TESTNET = 'true'See config/contracts.js for the complete configuration structure and available options.
VITE_USE_TESTNET- Set to "true" for testnet, "false" or empty for mainnet
VITE_POLYGON_CHAIN_ID- Chain ID (137 for mainnet, 80002 for testnet)VITE_DAO_CONTRACT- DAO contract addressVITE_TOKEN- PLR token contract addressVITE_STAKE_AMOUNT- Required stake amountVITE_CHAIN_EXPLORER- Block explorer base URL
VITE_WALLET_CONNECT_PROJECT_ID- WalletConnect project ID for ConnectKitVITE_INFURA_ID- Infura project ID for RPC endpointsNOTION_DATABASE- Notion database IDNOTION_SECRET_KEY- Notion API secret key