{
  "schemaVersion": "1.0",
  "item": {
    "slug": "polygon-pos-dev",
    "name": "Polygon PoS Development",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/AkshatGada/polygon-pos-dev",
    "canonicalUrl": "https://clawhub.ai/AkshatGada/polygon-pos-dev",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/polygon-pos-dev",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=polygon-pos-dev",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "references/contract-verification.md",
      "references/testing-strategies.md",
      "references/foundry-deployment.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/polygon-pos-dev"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/polygon-pos-dev",
    "agentPageUrl": "https://openagent3.xyz/skills/polygon-pos-dev/agent",
    "manifestUrl": "https://openagent3.xyz/skills/polygon-pos-dev/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/polygon-pos-dev/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Polygon PoS Development",
        "body": "End-to-end guide for developing and deploying smart contracts on Polygon PoS blockchain using Foundry."
      },
      {
        "title": "Overview",
        "body": "Polygon PoS is an EVM-compatible Proof-of-Stake sidechain for Ethereum with:\n\nLow transaction costs (fraction of a cent)\nFast block times (~2 seconds)\nHigh throughput (65,000+ TPS theoretical)\nFull Ethereum tooling compatibility\nPOL token for gas fees\n\nDefault Network: Amoy Testnet (Chain ID: 80002) - Use for all testing before mainnet."
      },
      {
        "title": "🚀 Quick Navigation",
        "body": "For Agents/Fast Deployment: Jump to Quick Start Path (5-10 min)\n\nFor Production/Thorough Testing: Jump to Complete Development Path (30-60 min)\n\nFor Reference: See sections below for Network Configuration, Faucets, Troubleshooting"
      },
      {
        "title": "Two Development Paths",
        "body": "Choose based on your needs:\n\nAspectQuick Start PathComplete Development PathTime5-10 minutes30-60 minutesBest forPrototypes, demos, simple contractsProduction, complex systems, mainnetTestingBasic compilation checkUnit tests, integration tests, fork testsScripts UsedNone (direct forge commands)Direct forge commands with all optionsDocumentationMinimalFull reference guidesVerificationAutomatic during deployMultiple methods with troubleshootingAgent-Friendly✅ Optimized for speed⚠️ Comprehensive but slower"
      },
      {
        "title": "Path 1: Quick Start (Minimal Time - Agent-Friendly)",
        "body": "Best for: Fast deployment, simple contracts, prototyping\nTime: 5-10 minutes\nWhat you get: Contract deployed and verified on testnet\n\nSkip to Quick Start Path below."
      },
      {
        "title": "Path 2: Complete Guide (Full Development Workflow)",
        "body": "Best for: Production contracts, complex systems, thorough testing\nTime: 30-60 minutes\nWhat you get: Fully tested, optimized, and production-ready deployment\n\nSkip to Complete Development Path below."
      },
      {
        "title": "Quick Start Path",
        "body": "Goal: Deploy a contract to Polygon Amoy testnet in minimal steps."
      },
      {
        "title": "Prerequisites",
        "body": "Foundry installed: curl -L https://foundry.paradigm.xyz | bash && foundryup\nWallet with private key\nPolygonscan API key (get from https://polygonscan.com/myapikey)"
      },
      {
        "title": "Step 1: Create Project (30 seconds)",
        "body": "forge init my-polygon-project\ncd my-polygon-project"
      },
      {
        "title": "Step 2: Configure Environment (1 minute)",
        "body": "Create .env file:\n\nPRIVATE_KEY=your_private_key_without_0x_prefix"
      },
      {
        "title": "Step 3: Get Testnet Tokens (2 minutes)",
        "body": "Visit: https://www.alchemy.com/faucets/polygon-amoy\n\nPaste your wallet address\nClaim 0.2-0.5 POL (no signup needed)"
      },
      {
        "title": "Step 4: Deploy (1 minute)",
        "body": "# Deploy to Amoy testnet\nforge script script/Counter.s.sol:CounterScript \\\n    --rpc-url https://rpc-amoy.polygon.technology \\\n    --private-key $PRIVATE_KEY \\\n    --broadcast\n\nDone! Your contract is deployed and verified on Amoy testnet.\n\nView at: https://amoy.polygonscan.com/address/YOUR_CONTRACT_ADDRESS"
      },
      {
        "title": "Complete Development Path",
        "body": "Goal: Production-ready deployment with comprehensive testing and optimization."
      },
      {
        "title": "Phase 1: Setup (5 minutes)",
        "body": "Install Foundry:\n\ncurl -L https://foundry.paradigm.xyz | bash\nfoundryup\n\nInitialize Project:\n\nforge init my-polygon-project\ncd my-polygon-project\n\nConfigure for Polygon:\n\nUpdate foundry.toml with Polygon settings:\n\n[profile.default]\nsrc = \"src\"\nout = \"out\"\nlibs = [\"lib\"]\nsolc_version = \"0.8.24\"\noptimizer = true\noptimizer_runs = 200\n\n[rpc_endpoints]\namoy = \"https://rpc-amoy.polygon.technology\"\npolygon = \"https://polygon-rpc.com\"\n\n[etherscan]\namoy = { key = \"${POLYGONSCAN_API_KEY}\", url = \"https://api-amoy.polygonscan.com/api\" }\npolygon = { key = \"${POLYGONSCAN_API_KEY}\", url = \"https://api.polygonscan.com/api\" }\n\nSetup Environment:\n\nCreate .env file:\n\nPRIVATE_KEY=your_private_key\nWALLET_ADDRESS=0xYourAddress\nPOLYGONSCAN_API_KEY=your_api_key"
      },
      {
        "title": "Phase 2: Write & Test Contracts (10-20 minutes)",
        "body": "Write Contract (or use assets/sample-contracts/HelloWorld.sol as template)\n\n\nWrite Tests:\n\n// test/MyContract.t.sol\nimport \"forge-std/Test.sol\";\nimport \"../src/MyContract.sol\";\n\ncontract MyContractTest is Test {\n    MyContract public myContract;\n    \n    function setUp() public {\n        myContract = new MyContract();\n    }\n    \n    function testDeployment() public {\n        assertEq(myContract.owner(), address(this));\n    }\n}\n\nRun Tests:\n\nforge test -vvv                    # Run tests\nforge test --gas-report            # Check gas usage\nforge coverage                     # Check coverage\n\nFork Testing (optional):\n\n# Test against real Polygon state\nforge test --fork-url https://polygon-rpc.com\n\nSee references/testing-strategies.md for comprehensive testing patterns."
      },
      {
        "title": "Phase 3: Get Testnet Tokens (2-5 minutes)",
        "body": "Visit one of these faucets:\n\nAlchemy (recommended - no auth): https://www.alchemy.com/faucets/polygon-amoy\nQuickNode: https://faucet.quicknode.com/polygon/amoy\nGetBlock: https://getblock.io/faucet/matic-amoy/\nChainlink: https://faucets.chain.link/polygon-amoy\nLearnWeb3: https://learnweb3.io/faucets/polygon_amoy/"
      },
      {
        "title": "Phase 4: Deploy to Testnet (2-5 minutes)",
        "body": "forge script script/Deploy.s.sol \\\n    --rpc-url amoy \\\n    --private-key $PRIVATE_KEY \\\n    --broadcast \\\n    --verify \\\n    --etherscan-api-key $POLYGONSCAN_API_KEY\n\nCreate a deployment script in script/Deploy.s.sol:\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport \"forge-std/Script.sol\";\nimport \"../src/YourContract.sol\";\n\ncontract DeployScript is Script {\n    function run() external {\n        uint256 deployerPrivateKey = vm.envUint(\"PRIVATE_KEY\");\n        \n        vm.startBroadcast(deployerPrivateKey);\n        \n        // Deploy your contract\n        YourContract yourContract = new YourContract();\n        \n        vm.stopBroadcast();\n        \n        console.log(\"Contract deployed to:\", address(yourContract));\n    }\n}\n\nSee references/foundry-deployment.md for advanced deployment patterns."
      },
      {
        "title": "Phase 5: Verify Contract (1-2 minutes)",
        "body": "If not verified during deployment:\n\nforge verify-contract \\\n    CONTRACT_ADDRESS \\\n    src/MyContract.sol:MyContract \\\n    --chain-id 80002 \\\n    --etherscan-api-key $POLYGONSCAN_API_KEY\n\nSee references/contract-verification.md for troubleshooting verification issues."
      },
      {
        "title": "Phase 6: Test on Testnet (5-10 minutes)",
        "body": "View on Explorer: https://amoy.polygonscan.com/address/CONTRACT_ADDRESS\nInteract with Contract: Use cast or web interface\nTest All Functions: Verify behavior matches expectations\nMonitor Gas Costs: Check if optimization needed"
      },
      {
        "title": "Phase 7: Deploy to Mainnet (5 minutes)",
        "body": "⚠️ IMPORTANT: Complete mainnet deployment checklist first!\n\nSee Mainnet Deployment Checklist below.\n\nforge script script/Deploy.s.sol \\\n    --rpc-url polygon \\\n    --private-key $PRIVATE_KEY \\\n    --broadcast \\\n    --verify \\\n    --etherscan-api-key $POLYGONSCAN_API_KEY\n\nEnd of Complete Development Path ✅"
      },
      {
        "title": "Amoy Testnet (Recommended for Testing)",
        "body": "PropertyValueNetwork NamePolygon AmoyChain ID80002CurrencyPOLRPC URLhttps://rpc-amoy.polygon.technologyWebSocketwss://polygon-amoy.drpc.orgExplorerhttps://amoy.polygonscan.comFaucetsMultiple (see below)"
      },
      {
        "title": "Polygon Mainnet",
        "body": "PropertyValueNetwork NamePolygonChain ID137CurrencyPOLRPC URLhttps://polygon-rpc.comWebSocketwss://polygon.drpc.orgExplorerhttps://polygonscan.com"
      },
      {
        "title": "Getting Testnet Tokens",
        "body": "Multiple faucets available for Amoy testnet POL tokens."
      },
      {
        "title": "Quick Access",
        "body": "Run the faucet helper script:\n\n./scripts/get-testnet-tokens.sh"
      },
      {
        "title": "Available Faucets",
        "body": "Alchemy Faucet (Recommended - No auth required)\n\nURL: https://www.alchemy.com/faucets/polygon-amoy\nAmount: 0.5 POL/day (with account), 0.2 POL/day (without)\nRequirements: None\n\nQuickNode Faucet\n\nURL: https://faucet.quicknode.com/polygon/amoy\nAmount: 0.1 POL/day (2x with tweet)\nRequirements: Connect wallet\n\nGetBlock Faucet\n\nURL: https://getblock.io/faucet/matic-amoy/\nAmount: 0.1 POL/day\nRequirements: Login\n\nChainlink Faucet\n\nURL: https://faucets.chain.link/polygon-amoy\nAmount: 0.1 POL/day\nRequirements: GitHub auth\n\nLearnWeb3 Faucet\n\nURL: https://learnweb3.io/faucets/polygon_amoy/\nAmount: 0.1 POL/day\nRequirements: GitHub auth\n\nTips:\n\nMost faucets limit to 1 request per 24 hours\nIf rate-limited, try a different faucet\nSome offer bonus tokens for tweeting"
      },
      {
        "title": "Environment Setup",
        "body": "Create .env file (see assets/sample-contracts/.env.example):\n\nPRIVATE_KEY=your_private_key_here\nWALLET_ADDRESS=0xYourAddress\nPOLYGONSCAN_API_KEY=your_api_key_here\n\nAdd to .gitignore:\n\n.env\nbroadcast/\ndeployments/"
      },
      {
        "title": "Deploy to Testnet",
        "body": "Option 1: Use helper script (recommended)\n\n./scripts/deploy-foundry.sh\n\nOption 2: Manual deployment\n\nforge script script/Deploy.s.sol \\\n    --rpc-url amoy \\\n    --private-key $PRIVATE_KEY \\\n    --broadcast \\\n    --verify\n\nOption 3: Deploy without verification\n\nforge script script/Deploy.s.sol \\\n    --rpc-url amoy \\\n    --private-key $PRIVATE_KEY \\\n    --broadcast"
      },
      {
        "title": "Deploy to Mainnet",
        "body": "⚠️ IMPORTANT: Test thoroughly on Amoy first!\n\n# Use deployment script and select mainnet option\n./scripts/deploy-foundry.sh\n\nFor detailed deployment patterns, see references/foundry-deployment.md."
      },
      {
        "title": "Local Testing",
        "body": "Write tests in test/ directory:\n\n// test/MyContract.t.sol\nimport \"forge-std/Test.sol\";\nimport \"../src/MyContract.sol\";\n\ncontract MyContractTest is Test {\n    MyContract public myContract;\n    \n    function setUp() public {\n        myContract = new MyContract();\n    }\n    \n    function testFunction() public {\n        // Test logic\n    }\n}\n\nRun tests:\n\nforge test              # Run all tests\nforge test -vvv         # Verbose output\nforge test --gas-report # Show gas usage"
      },
      {
        "title": "Fork Testing",
        "body": "Test against real Polygon state:\n\nforge test --fork-url https://polygon-rpc.com"
      },
      {
        "title": "Testnet Testing",
        "body": "Deploy to Amoy and test with real transactions. See references/testing-strategies.md for comprehensive testing patterns."
      },
      {
        "title": "Contract Verification",
        "body": "Verification makes your contract code public and trustworthy."
      },
      {
        "title": "During Deployment (Recommended)",
        "body": "forge script script/Deploy.s.sol \\\n    --rpc-url amoy \\\n    --private-key $PRIVATE_KEY \\\n    --broadcast \\\n    --verify \\\n    --etherscan-api-key $POLYGONSCAN_API_KEY"
      },
      {
        "title": "After Deployment",
        "body": "Option 1: Use helper script\n\n./scripts/verify-contract.sh\n\nOption 2: Manual verification\n\nforge verify-contract \\\n    CONTRACT_ADDRESS \\\n    src/MyContract.sol:MyContract \\\n    --chain-id 80002 \\\n    --etherscan-api-key $POLYGONSCAN_API_KEY \\\n    --verifier-url https://api-amoy.polygonscan.com/api"
      },
      {
        "title": "With Constructor Arguments",
        "body": "forge verify-contract \\\n    CONTRACT_ADDRESS \\\n    src/MyContract.sol:MyContract \\\n    --chain-id 80002 \\\n    --etherscan-api-key $POLYGONSCAN_API_KEY \\\n    --constructor-args $(cast abi-encode \"constructor(address,uint256)\" 0x123... 1000)\n\nFor troubleshooting verification issues, see references/contract-verification.md."
      },
      {
        "title": "Which Path Should I Use?",
        "body": "Use Quick Start Path when:\n\nYou need fast deployment (prototyping, demos)\nContract is simple and low-risk\nYou're an AI agent with limited time\nTesting is minimal or done elsewhere\n\nUse Complete Development Path when:\n\nDeploying to mainnet\nContract handles real value\nComplex logic requiring thorough testing\nTeam collaboration and code review needed\nSecurity is critical"
      },
      {
        "title": "Mainnet Deployment Checklist",
        "body": "Before deploying to mainnet:\n\nAll tests passing (forge test)\n Deployed and tested on Amoy testnet\n Contract verified on Amoy\n Security review completed\n Gas optimization done\n Documentation complete\n Constructor arguments double-checked\n Sufficient POL in wallet for gas\n Deployment script tested\n Team notified of deployment"
      },
      {
        "title": "Sample Contract Pattern",
        "body": "Example smart contract structure for Polygon:\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract HelloWorld {\n    address public owner;\n    string public message;\n    uint256 public updateCount;\n    \n    event MessageUpdated(address indexed updater, string newMessage);\n    \n    error NotOwner();\n    error EmptyMessage();\n    \n    constructor(string memory initialMessage) {\n        owner = msg.sender;\n        message = initialMessage;\n    }\n    \n    modifier onlyOwner() {\n        if (msg.sender != owner) revert NotOwner();\n        _;\n    }\n    \n    function setMessage(string calldata newMessage) external {\n        if (bytes(newMessage).length == 0) revert EmptyMessage();\n        message = newMessage;\n        updateCount++;\n        emit MessageUpdated(msg.sender, newMessage);\n    }\n}\n\nKey patterns:\n\nUse custom errors instead of require strings (gas-efficient)\nEmit events for important state changes\nUse modifiers for access control\nOptimize for Polygon's low gas costs"
      },
      {
        "title": "Safety Rules",
        "body": "Test First: Always test on Amoy before mainnet\nNever Commit Keys: Add .env to .gitignore\nVerify Contracts: Always verify for transparency\nCheck Network: Double-check chain ID before deployment\nSufficient Balance: Ensure enough POL for gas\nSave Addresses: Document deployed contract addresses\nAudit Code: Security review before mainnet\nUse Scripts: Automate deployments to reduce errors\nBackup Keys: Securely backup private keys\nTest Verification: Verify contracts on testnet first"
      },
      {
        "title": "Insufficient Funds for Gas",
        "body": "Error: insufficient funds for gas * price + value\n\nSolution: Get testnet POL from faucets (run ./scripts/get-testnet-tokens.sh)"
      },
      {
        "title": "Contract Not Found",
        "body": "Error: src/MyContract.sol:MyContract not found\n\nSolution: Check file path and contract name match exactly"
      },
      {
        "title": "RPC Connection Issues",
        "body": "Error: failed to get chain id\n\nSolution:\n\nCheck internet connection\nTry alternative RPC URL\nUse dedicated RPC provider (Alchemy, QuickNode)"
      },
      {
        "title": "Verification Failed",
        "body": "Error: bytecode does not match\n\nSolution:\n\nWait 1-2 minutes for contract to be indexed\nCheck constructor arguments are correct\nVerify compiler settings match deployment"
      },
      {
        "title": "Gas Estimation Failed",
        "body": "Error: gas estimation failed\n\nSolution:\n\nCheck contract logic for reverts\nEnsure sufficient balance\nCheck function parameters"
      },
      {
        "title": "Resources",
        "body": "Foundry Documentation\n\nBook: https://book.getfoundry.sh/\nGitHub: https://github.com/foundry-rs/foundry\n\nPolygon Documentation\n\nDocs: https://docs.polygon.technology/\nGas Station: https://gasstation.polygon.technology/\nFaucets: https://faucet.polygon.technology/\n\nBlock Explorers\n\nAmoy: https://amoy.polygonscan.com\nMainnet: https://polygonscan.com\n\nRPC Providers\n\nAlchemy: https://www.alchemy.com/\nQuickNode: https://www.quicknode.com/\nInfura: https://infura.io/\n\nCommunity\n\nDiscord: https://discord.com/invite/0xPolygonCommunity\nTelegram: https://t.me/polygonhq"
      },
      {
        "title": "Reference Files",
        "body": "For detailed information:\n\nreferences/foundry-deployment.md - Complete deployment guide\nreferences/testing-strategies.md - Testing best practices\nreferences/contract-verification.md - Verification troubleshooting"
      }
    ],
    "body": "Polygon PoS Development\n\nEnd-to-end guide for developing and deploying smart contracts on Polygon PoS blockchain using Foundry.\n\nOverview\n\nPolygon PoS is an EVM-compatible Proof-of-Stake sidechain for Ethereum with:\n\nLow transaction costs (fraction of a cent)\nFast block times (~2 seconds)\nHigh throughput (65,000+ TPS theoretical)\nFull Ethereum tooling compatibility\nPOL token for gas fees\n\nDefault Network: Amoy Testnet (Chain ID: 80002) - Use for all testing before mainnet.\n\n🚀 Quick Navigation\n\nFor Agents/Fast Deployment: Jump to Quick Start Path (5-10 min)\n\nFor Production/Thorough Testing: Jump to Complete Development Path (30-60 min)\n\nFor Reference: See sections below for Network Configuration, Faucets, Troubleshooting\n\nTwo Development Paths\n\nChoose based on your needs:\n\nAspect\tQuick Start Path\tComplete Development Path\nTime\t5-10 minutes\t30-60 minutes\nBest for\tPrototypes, demos, simple contracts\tProduction, complex systems, mainnet\nTesting\tBasic compilation check\tUnit tests, integration tests, fork tests\nScripts Used\tNone (direct forge commands)\tDirect forge commands with all options\nDocumentation\tMinimal\tFull reference guides\nVerification\tAutomatic during deploy\tMultiple methods with troubleshooting\nAgent-Friendly\t✅ Optimized for speed\t⚠️ Comprehensive but slower\nPath 1: Quick Start (Minimal Time - Agent-Friendly)\n\nBest for: Fast deployment, simple contracts, prototyping Time: 5-10 minutes What you get: Contract deployed and verified on testnet\n\nSkip to Quick Start Path below.\n\nPath 2: Complete Guide (Full Development Workflow)\n\nBest for: Production contracts, complex systems, thorough testing Time: 30-60 minutes What you get: Fully tested, optimized, and production-ready deployment\n\nSkip to Complete Development Path below.\n\nQuick Start Path\n\nGoal: Deploy a contract to Polygon Amoy testnet in minimal steps.\n\nPrerequisites\nFoundry installed: curl -L https://foundry.paradigm.xyz | bash && foundryup\nWallet with private key\nPolygonscan API key (get from https://polygonscan.com/myapikey)\nStep 1: Create Project (30 seconds)\nforge init my-polygon-project\ncd my-polygon-project\n\nStep 2: Configure Environment (1 minute)\n\nCreate .env file:\n\nPRIVATE_KEY=your_private_key_without_0x_prefix\n\nStep 3: Get Testnet Tokens (2 minutes)\n\nVisit: https://www.alchemy.com/faucets/polygon-amoy\n\nPaste your wallet address\nClaim 0.2-0.5 POL (no signup needed)\nStep 4: Deploy (1 minute)\n# Deploy to Amoy testnet\nforge script script/Counter.s.sol:CounterScript \\\n    --rpc-url https://rpc-amoy.polygon.technology \\\n    --private-key $PRIVATE_KEY \\\n    --broadcast\n\n\nDone! Your contract is deployed and verified on Amoy testnet.\n\nView at: https://amoy.polygonscan.com/address/YOUR_CONTRACT_ADDRESS\n\nComplete Development Path\n\nGoal: Production-ready deployment with comprehensive testing and optimization.\n\nPhase 1: Setup (5 minutes)\nInstall Foundry:\ncurl -L https://foundry.paradigm.xyz | bash\nfoundryup\n\nInitialize Project:\nforge init my-polygon-project\ncd my-polygon-project\n\nConfigure for Polygon:\n\nUpdate foundry.toml with Polygon settings:\n\n[profile.default]\nsrc = \"src\"\nout = \"out\"\nlibs = [\"lib\"]\nsolc_version = \"0.8.24\"\noptimizer = true\noptimizer_runs = 200\n\n[rpc_endpoints]\namoy = \"https://rpc-amoy.polygon.technology\"\npolygon = \"https://polygon-rpc.com\"\n\n[etherscan]\namoy = { key = \"${POLYGONSCAN_API_KEY}\", url = \"https://api-amoy.polygonscan.com/api\" }\npolygon = { key = \"${POLYGONSCAN_API_KEY}\", url = \"https://api.polygonscan.com/api\" }\n\nSetup Environment:\n\nCreate .env file:\n\nPRIVATE_KEY=your_private_key\nWALLET_ADDRESS=0xYourAddress\nPOLYGONSCAN_API_KEY=your_api_key\n\nPhase 2: Write & Test Contracts (10-20 minutes)\n\nWrite Contract (or use assets/sample-contracts/HelloWorld.sol as template)\n\nWrite Tests:\n\n// test/MyContract.t.sol\nimport \"forge-std/Test.sol\";\nimport \"../src/MyContract.sol\";\n\ncontract MyContractTest is Test {\n    MyContract public myContract;\n    \n    function setUp() public {\n        myContract = new MyContract();\n    }\n    \n    function testDeployment() public {\n        assertEq(myContract.owner(), address(this));\n    }\n}\n\nRun Tests:\nforge test -vvv                    # Run tests\nforge test --gas-report            # Check gas usage\nforge coverage                     # Check coverage\n\nFork Testing (optional):\n# Test against real Polygon state\nforge test --fork-url https://polygon-rpc.com\n\n\nSee references/testing-strategies.md for comprehensive testing patterns.\n\nPhase 3: Get Testnet Tokens (2-5 minutes)\n\nVisit one of these faucets:\n\nAlchemy (recommended - no auth): https://www.alchemy.com/faucets/polygon-amoy QuickNode: https://faucet.quicknode.com/polygon/amoy GetBlock: https://getblock.io/faucet/matic-amoy/ Chainlink: https://faucets.chain.link/polygon-amoy LearnWeb3: https://learnweb3.io/faucets/polygon_amoy/\n\nPhase 4: Deploy to Testnet (2-5 minutes)\nforge script script/Deploy.s.sol \\\n    --rpc-url amoy \\\n    --private-key $PRIVATE_KEY \\\n    --broadcast \\\n    --verify \\\n    --etherscan-api-key $POLYGONSCAN_API_KEY\n\n\nCreate a deployment script in script/Deploy.s.sol:\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport \"forge-std/Script.sol\";\nimport \"../src/YourContract.sol\";\n\ncontract DeployScript is Script {\n    function run() external {\n        uint256 deployerPrivateKey = vm.envUint(\"PRIVATE_KEY\");\n        \n        vm.startBroadcast(deployerPrivateKey);\n        \n        // Deploy your contract\n        YourContract yourContract = new YourContract();\n        \n        vm.stopBroadcast();\n        \n        console.log(\"Contract deployed to:\", address(yourContract));\n    }\n}\n\n\nSee references/foundry-deployment.md for advanced deployment patterns.\n\nPhase 5: Verify Contract (1-2 minutes)\n\nIf not verified during deployment:\n\nforge verify-contract \\\n    CONTRACT_ADDRESS \\\n    src/MyContract.sol:MyContract \\\n    --chain-id 80002 \\\n    --etherscan-api-key $POLYGONSCAN_API_KEY\n\n\nSee references/contract-verification.md for troubleshooting verification issues.\n\nPhase 6: Test on Testnet (5-10 minutes)\nView on Explorer: https://amoy.polygonscan.com/address/CONTRACT_ADDRESS\nInteract with Contract: Use cast or web interface\nTest All Functions: Verify behavior matches expectations\nMonitor Gas Costs: Check if optimization needed\nPhase 7: Deploy to Mainnet (5 minutes)\n\n⚠️ IMPORTANT: Complete mainnet deployment checklist first!\n\nSee Mainnet Deployment Checklist below.\n\nforge script script/Deploy.s.sol \\\n    --rpc-url polygon \\\n    --private-key $PRIVATE_KEY \\\n    --broadcast \\\n    --verify \\\n    --etherscan-api-key $POLYGONSCAN_API_KEY\n\n\nEnd of Complete Development Path ✅\n\nNetwork Configuration\nAmoy Testnet (Recommended for Testing)\nProperty\tValue\nNetwork Name\tPolygon Amoy\nChain ID\t80002\nCurrency\tPOL\nRPC URL\thttps://rpc-amoy.polygon.technology\nWebSocket\twss://polygon-amoy.drpc.org\nExplorer\thttps://amoy.polygonscan.com\nFaucets\tMultiple (see below)\nPolygon Mainnet\nProperty\tValue\nNetwork Name\tPolygon\nChain ID\t137\nCurrency\tPOL\nRPC URL\thttps://polygon-rpc.com\nWebSocket\twss://polygon.drpc.org\nExplorer\thttps://polygonscan.com\nGetting Testnet Tokens\n\nMultiple faucets available for Amoy testnet POL tokens.\n\nQuick Access\n\nRun the faucet helper script:\n\n./scripts/get-testnet-tokens.sh\n\nAvailable Faucets\n\nAlchemy Faucet (Recommended - No auth required)\n\nURL: https://www.alchemy.com/faucets/polygon-amoy\nAmount: 0.5 POL/day (with account), 0.2 POL/day (without)\nRequirements: None\n\nQuickNode Faucet\n\nURL: https://faucet.quicknode.com/polygon/amoy\nAmount: 0.1 POL/day (2x with tweet)\nRequirements: Connect wallet\n\nGetBlock Faucet\n\nURL: https://getblock.io/faucet/matic-amoy/\nAmount: 0.1 POL/day\nRequirements: Login\n\nChainlink Faucet\n\nURL: https://faucets.chain.link/polygon-amoy\nAmount: 0.1 POL/day\nRequirements: GitHub auth\n\nLearnWeb3 Faucet\n\nURL: https://learnweb3.io/faucets/polygon_amoy/\nAmount: 0.1 POL/day\nRequirements: GitHub auth\n\nTips:\n\nMost faucets limit to 1 request per 24 hours\nIf rate-limited, try a different faucet\nSome offer bonus tokens for tweeting\nDeployment Workflow\nEnvironment Setup\n\nCreate .env file (see assets/sample-contracts/.env.example):\n\nPRIVATE_KEY=your_private_key_here\nWALLET_ADDRESS=0xYourAddress\nPOLYGONSCAN_API_KEY=your_api_key_here\n\n\nAdd to .gitignore:\n\n.env\nbroadcast/\ndeployments/\n\nDeploy to Testnet\n\nOption 1: Use helper script (recommended)\n\n./scripts/deploy-foundry.sh\n\n\nOption 2: Manual deployment\n\nforge script script/Deploy.s.sol \\\n    --rpc-url amoy \\\n    --private-key $PRIVATE_KEY \\\n    --broadcast \\\n    --verify\n\n\nOption 3: Deploy without verification\n\nforge script script/Deploy.s.sol \\\n    --rpc-url amoy \\\n    --private-key $PRIVATE_KEY \\\n    --broadcast\n\nDeploy to Mainnet\n\n⚠️ IMPORTANT: Test thoroughly on Amoy first!\n\n# Use deployment script and select mainnet option\n./scripts/deploy-foundry.sh\n\n\nFor detailed deployment patterns, see references/foundry-deployment.md.\n\nTesting Strategies\nLocal Testing\n\nWrite tests in test/ directory:\n\n// test/MyContract.t.sol\nimport \"forge-std/Test.sol\";\nimport \"../src/MyContract.sol\";\n\ncontract MyContractTest is Test {\n    MyContract public myContract;\n    \n    function setUp() public {\n        myContract = new MyContract();\n    }\n    \n    function testFunction() public {\n        // Test logic\n    }\n}\n\n\nRun tests:\n\nforge test              # Run all tests\nforge test -vvv         # Verbose output\nforge test --gas-report # Show gas usage\n\nFork Testing\n\nTest against real Polygon state:\n\nforge test --fork-url https://polygon-rpc.com\n\nTestnet Testing\n\nDeploy to Amoy and test with real transactions. See references/testing-strategies.md for comprehensive testing patterns.\n\nContract Verification\n\nVerification makes your contract code public and trustworthy.\n\nDuring Deployment (Recommended)\nforge script script/Deploy.s.sol \\\n    --rpc-url amoy \\\n    --private-key $PRIVATE_KEY \\\n    --broadcast \\\n    --verify \\\n    --etherscan-api-key $POLYGONSCAN_API_KEY\n\nAfter Deployment\n\nOption 1: Use helper script\n\n./scripts/verify-contract.sh\n\n\nOption 2: Manual verification\n\nforge verify-contract \\\n    CONTRACT_ADDRESS \\\n    src/MyContract.sol:MyContract \\\n    --chain-id 80002 \\\n    --etherscan-api-key $POLYGONSCAN_API_KEY \\\n    --verifier-url https://api-amoy.polygonscan.com/api\n\nWith Constructor Arguments\nforge verify-contract \\\n    CONTRACT_ADDRESS \\\n    src/MyContract.sol:MyContract \\\n    --chain-id 80002 \\\n    --etherscan-api-key $POLYGONSCAN_API_KEY \\\n    --constructor-args $(cast abi-encode \"constructor(address,uint256)\" 0x123... 1000)\n\n\nFor troubleshooting verification issues, see references/contract-verification.md.\n\nCommon Workflows\nWhich Path Should I Use?\n\nUse Quick Start Path when:\n\nYou need fast deployment (prototyping, demos)\nContract is simple and low-risk\nYou're an AI agent with limited time\nTesting is minimal or done elsewhere\n\nUse Complete Development Path when:\n\nDeploying to mainnet\nContract handles real value\nComplex logic requiring thorough testing\nTeam collaboration and code review needed\nSecurity is critical\nMainnet Deployment Checklist\n\nBefore deploying to mainnet:\n\n All tests passing (forge test)\n Deployed and tested on Amoy testnet\n Contract verified on Amoy\n Security review completed\n Gas optimization done\n Documentation complete\n Constructor arguments double-checked\n Sufficient POL in wallet for gas\n Deployment script tested\n Team notified of deployment\nSample Contract Pattern\n\nExample smart contract structure for Polygon:\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract HelloWorld {\n    address public owner;\n    string public message;\n    uint256 public updateCount;\n    \n    event MessageUpdated(address indexed updater, string newMessage);\n    \n    error NotOwner();\n    error EmptyMessage();\n    \n    constructor(string memory initialMessage) {\n        owner = msg.sender;\n        message = initialMessage;\n    }\n    \n    modifier onlyOwner() {\n        if (msg.sender != owner) revert NotOwner();\n        _;\n    }\n    \n    function setMessage(string calldata newMessage) external {\n        if (bytes(newMessage).length == 0) revert EmptyMessage();\n        message = newMessage;\n        updateCount++;\n        emit MessageUpdated(msg.sender, newMessage);\n    }\n}\n\n\nKey patterns:\n\nUse custom errors instead of require strings (gas-efficient)\nEmit events for important state changes\nUse modifiers for access control\nOptimize for Polygon's low gas costs\nSafety Rules\nTest First: Always test on Amoy before mainnet\nNever Commit Keys: Add .env to .gitignore\nVerify Contracts: Always verify for transparency\nCheck Network: Double-check chain ID before deployment\nSufficient Balance: Ensure enough POL for gas\nSave Addresses: Document deployed contract addresses\nAudit Code: Security review before mainnet\nUse Scripts: Automate deployments to reduce errors\nBackup Keys: Securely backup private keys\nTest Verification: Verify contracts on testnet first\nTroubleshooting\nInsufficient Funds for Gas\n\nError: insufficient funds for gas * price + value\n\nSolution: Get testnet POL from faucets (run ./scripts/get-testnet-tokens.sh)\n\nContract Not Found\n\nError: src/MyContract.sol:MyContract not found\n\nSolution: Check file path and contract name match exactly\n\nRPC Connection Issues\n\nError: failed to get chain id\n\nSolution:\n\nCheck internet connection\nTry alternative RPC URL\nUse dedicated RPC provider (Alchemy, QuickNode)\nVerification Failed\n\nError: bytecode does not match\n\nSolution:\n\nWait 1-2 minutes for contract to be indexed\nCheck constructor arguments are correct\nVerify compiler settings match deployment\nGas Estimation Failed\n\nError: gas estimation failed\n\nSolution:\n\nCheck contract logic for reverts\nEnsure sufficient balance\nCheck function parameters\nResources\n\nFoundry Documentation\n\nBook: https://book.getfoundry.sh/\nGitHub: https://github.com/foundry-rs/foundry\n\nPolygon Documentation\n\nDocs: https://docs.polygon.technology/\nGas Station: https://gasstation.polygon.technology/\nFaucets: https://faucet.polygon.technology/\n\nBlock Explorers\n\nAmoy: https://amoy.polygonscan.com\nMainnet: https://polygonscan.com\n\nRPC Providers\n\nAlchemy: https://www.alchemy.com/\nQuickNode: https://www.quicknode.com/\nInfura: https://infura.io/\n\nCommunity\n\nDiscord: https://discord.com/invite/0xPolygonCommunity\nTelegram: https://t.me/polygonhq\nReference Files\n\nFor detailed information:\n\nreferences/foundry-deployment.md - Complete deployment guide\nreferences/testing-strategies.md - Testing best practices\nreferences/contract-verification.md - Verification troubleshooting\nScripts"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/AkshatGada/polygon-pos-dev",
    "publisherUrl": "https://clawhub.ai/AkshatGada/polygon-pos-dev",
    "owner": "AkshatGada",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/polygon-pos-dev",
    "downloadUrl": "https://openagent3.xyz/downloads/polygon-pos-dev",
    "agentUrl": "https://openagent3.xyz/skills/polygon-pos-dev/agent",
    "manifestUrl": "https://openagent3.xyz/skills/polygon-pos-dev/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/polygon-pos-dev/agent.md"
  }
}