[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7A8D1FXDFWP5WNT6P8NNA2P":3,"skill-same:01M7A8D1FXDFWP5WNT6P8NNA2P":53},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":32,"repositoryHtmlUrl":33,"repositoryHomepageUrl":34,"ownerHtmlUrl":35,"ownerBlogUrl":36,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M7A8D1FXDFWP5WNT6P8NNA2P","deployer",null,"Deploy CCA (Continuous Clearing Auction) smart contracts using the Factory pattern. Use when user says \"deploy auction\", \"deploy cca\", \"factory deployment\", or wants to deploy a configured auction.","themusebook\u002Fskills","themusebook","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F349927247?v=4","01M7A5C1RV5S3V5FF6ZACVDNRN","musebook","01M7A5C1SFC3KRZAXNN60XJ7KM",0,"MIT","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdeployer\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: deployer\ndescription: Deploy CCA (Continuous Clearing Auction) smart contracts using the Factory pattern. Use when user says \"deploy auction\", \"deploy cca\", \"factory deployment\", or wants to deploy a configured auction.\nallowed-tools: Read, Glob, Grep, Bash(forge:*), Bash(cast:*), Bash(curl:*), AskUserQuestion\nmodel: opus\nlicense: MIT\nmetadata:\n  author: uniswap\n  version: '1.0.0'\n---\n\n# CCA Deployment\n\nDeploy Continuous Clearing Auction (CCA) smart contracts using the `ContinuousClearingAuctionFactory` with CREATE2 for consistent addresses across chains.\n\n> **Runtime Compatibility:** This skill uses `AskUserQuestion` for interactive prompts. If `AskUserQuestion` is not available in your runtime, collect the same parameters through natural language conversation instead.\n\n## Instructions for Claude Code\n\nWhen the user invokes this skill, guide them through the CCA deployment process with appropriate safety warnings and validation.\n\n### Pre-Deployment Requirements\n\nBefore proceeding with deployment, you MUST:\n\n1. **Show educational disclaimer** and get user acknowledgment\n2. **Validate configuration file** if provided\n3. **Verify factory address** for the target network\n4. **Confirm deployment parameters** with user\n\n### Deployment Workflow\n\n1. **Show Educational Disclaimer** (REQUIRED)\n2. **Load or Request Configuration**\n3. **Validate Configuration**\n4. **Display Deployment Plan**\n5. **Get User Confirmation**\n6. **Provide Deployment Commands**\n7. **Post-Deployment Steps**\n\n---\n\n## ⚠️ Educational Use Disclaimer\n\n**IMPORTANT: Before proceeding with deployment, you must acknowledge:**\n\nThis tool and all deployment instructions are provided **for educational purposes only**. AI-generated deployment commands may contain errors or security vulnerabilities.\n\n**You must:**\n\n1. ✅ **Review all configurations carefully** before deploying\n2. ✅ **Verify all parameters** (addresses, pricing, schedules) are correct\n3. ✅ **Test on testnets first** before deploying to mainnet\n4. ✅ **Audit your contracts** before deploying with real funds\n\n**Use AskUserQuestion to confirm the user acknowledges these warnings before proceeding with deployment steps.**\n\n### Input Validation Rules\n\nBefore interpolating ANY user-provided value into forge\u002Fcast commands or deployment scripts:\n\n- **Ethereum addresses**: MUST match `^0x[a-fA-F0-9]{40}$` — reject otherwise\n- **Chain IDs**: MUST be from the supported chains list (1, 130, 143, 1301, 8453, 42161, 11155111)\n- **Numeric values** (supply, prices, blocks, chain IDs): MUST be non-negative and match `^[0-9]+\\.?[0-9]*$`\n- **REJECT** any input containing shell metacharacters: `;`, `|`, `&`, `$`, `` ` ``, `(`, `)`, `>`, `\u003C`, `\\`, `'`, `\"`, newlines\n- **Never** pass raw user input directly to shell commands without validation\n\n### ⚠️ Permission Safety\n\n**Do NOT auto-approve `Bash(forge:*)` or `Bash(cast:*)` in your Claude Code settings.** Always require per-invocation approval for commands that spend gas or broadcast transactions. The PreToolUse hooks in `.claude\u002Fhooks\u002F` provide programmatic validation as a safety net, but user approval per command is the primary control.\n\n---\n\n## 🔐 Private Key Security\n\n**CRITICAL: Handling private keys safely is essential for secure deployments.**\n\n### ⚠️ Never Do These\n\n- ❌ **Never** store private keys in git repositories or config files\n- ❌ **Never** paste private keys directly in command line (visible in shell history)\n- ❌ **Never** share private keys or store them in shared environments\n- ❌ **Never** use mainnet private keys on untrusted computers\n- ❌ **Never** use `--private-key` flag (blocked by PreToolUse hook)\n\n### ✅ Recommended Practices\n\n#### Option 1: Hardware Wallets (Most Secure)\n\nUse Ledger or Trezor hardware wallets with the `--ledger` flag:\n\n```bash\nforge script script\u002FExample.s.sol:ExampleScript \\\n  --rpc-url $RPC_URL \\\n  --broadcast \\\n  --ledger\n```\n\n#### Option 2: Encrypted Keystore\n\nCreate an encrypted keystore with `cast wallet import`:\n\n```bash\n# Import private key to encrypted keystore (one-time setup)\ncast wallet import deployer --interactive\n\n# Use keystore for deployment\nforge script script\u002FExample.s.sol:ExampleScript \\\n  --rpc-url $RPC_URL \\\n  --broadcast \\\n  --account deployer \\\n  --sender $DEPLOYER_ADDRESS\n```\n\n#### Option 3: Environment Variables (For Testing Only)\n\nIf using environment variables, ensure they are:\n\n- Set in a secure `.env` file (never committed to git)\n- Loaded via `source .env` or `dotenv`\n- Only used on trusted, secure computers\n- Use testnet keys for development\n\n**Example:**\n\n```bash\n# .env file (add to .gitignore)\nPRIVATE_KEY=0x...\nRPC_URL=https:\u002F\u002F...\n\n# Load environment\nsource .env\n\n# Deploy (use encrypted keystore instead of --private-key)\ncast wallet import deployer --interactive\nforge script ... --account deployer --sender $DEPLOYER_ADDRESS\n```\n\n### Testnet First\n\n**Always test on testnets before mainnet:**\n\n- Sepolia (testnet): Get free ETH from faucets\n- Base Sepolia: Free ETH for testing on Base\n- Deploy and verify full workflow on testnet\n- Only deploy to mainnet after thorough testing\n\n---\n\n## Deployment Guide\n\n### Factory Deployment\n\nCCA instances are deployed via the `ContinuousClearingAuctionFactory` contract, which uses CREATE2 for consistent addresses across chains.\n\n#### Factory Addresses\n\n| Version | Address                                      | Status          |\n| ------- | -------------------------------------------- | --------------- |\n| v1.1.0  | `0xCCccCcCAE7503Cac057829BF2811De42E16e0bD5` | **Recommended** |\n\n### Deploying an Auction Instance\n\n#### Step 0: Clone the CCA Repository\n\nIf you don't already have the CCA contracts locally, clone the repository and install dependencies:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FUniswap\u002Fcontinuous-clearing-auction.git\ncd continuous-clearing-auction\nforge install\n```\n\nThis gives you access to the deployment scripts, contract ABIs, and test helpers referenced in later steps.\n\n#### Step 1: Prepare Configuration\n\nEnsure you have a valid configuration file (generated via the `configurator` skill or manually created).\n\nExample configuration file structure:\n\n```json\n{\n  \"1\": {\n    \"token\": \"0x...\",\n    \"totalSupply\": 1e29,\n    \"currency\": \"0x0000000000000000000000000000000000000000\",\n    \"tokensRecipient\": \"0x...\",\n    \"fundsRecipient\": \"0x...\",\n    \"startBlock\": 24321000,\n    \"endBlock\": 24327001,\n    \"claimBlock\": 24327001,\n    \"tickSpacing\": 79228162514264337593543950,\n    \"validationHook\": \"0x0000000000000000000000000000000000000000\",\n    \"floorPrice\": 7922816251426433759354395000,\n    \"requiredCurrencyRaised\": 0,\n    \"supplySchedule\": [\n      { \"mps\": 1000, \"blockDelta\": 6000 },\n      { \"mps\": 4000000, \"blockDelta\": 1 }\n    ]\n  }\n}\n```\n\n#### Step 2: Validate Configuration\n\nBefore deployment, verify the configuration passes all validation rules (see Validation Rules section).\n\n#### Step 3: Deploy via Factory\n\nThe factory has a simple interface:\n\n```solidity\nfunction initializeDistribution(\n    address token,\n    uint256 amount,\n    bytes calldata configData,\n    bytes32 salt\n) external returns (IDistributionContract);\n```\n\nWhere:\n\n- `token`: Address of the token to be sold\n- `amount`: Amount of tokens to sell in the auction\n- `configData`: ABI-encoded `AuctionParameters` struct\n- `salt`: Optional bytes32 value for vanity address mining\n\n#### Step 3.5: Encode Configuration to configData\n\nThe factory's `initializeDistribution` expects `configData` as ABI-encoded `AuctionParameters`. Convert your JSON config to encoded bytes:\n\n**Using cast (Foundry CLI):**\n\n```bash\n# Encode the AuctionParameters struct\ncast abi-encode \"initializeDistribution(address,uint256,bytes,bytes32)\" \\\n  \"$TOKEN_ADDRESS\" \\\n  \"$TOTAL_SUPPLY\" \\\n  \"$(cast abi-encode \"(address,address,address,uint64,uint64,uint64,uint256,address,uint256,uint128,bytes)\" \\\n    \"$CURRENCY\" \\\n    \"$TOKENS_RECIPIENT\" \\\n    \"$FUNDS_RECIPIENT\" \\\n    \"$START_BLOCK\" \\\n    \"$END_BLOCK\" \\\n    \"$CLAIM_BLOCK\" \\\n    \"$TICK_SPACING\" \\\n    \"$VALIDATION_HOOK\" \\\n    \"$FLOOR_PRICE\" \\\n    \"$REQUIRED_CURRENCY_RAISED\" \\\n    \"$ENCODED_SUPPLY_SCHEDULE\")\" \\\n  \"0x0000000000000000000000000000000000000000000000000000000000000000\"\n```\n\n**Using a Foundry Script:**\n\n```solidity\n\u002F\u002F script\u002FDeployAuction.s.sol\npragma solidity ^0.8.24;\n\nimport \"forge-std\u002FScript.sol\";\n\ninterface ICCAFactory {\n    function initializeDistribution(\n        address token,\n        uint256 amount,\n        bytes calldata configData,\n        bytes32 salt\n    ) external returns (address);\n}\n\ncontract DeployAuction is Script {\n    function run() external {\n        \u002F\u002F Load config values\n        address token = vm.envAddress(\"TOKEN\");\n        uint256 amount = vm.envUint(\"TOTAL_SUPPLY\");\n\n        \u002F\u002F Encode AuctionParameters\n        bytes memory configData = abi.encode(\n            vm.envAddress(\"CURRENCY\"),\n            vm.envAddress(\"TOKENS_RECIPIENT\"),\n            vm.envAddress(\"FUNDS_RECIPIENT\"),\n            uint64(vm.envUint(\"START_BLOCK\")),\n            uint64(vm.envUint(\"END_BLOCK\")),\n            uint64(vm.envUint(\"CLAIM_BLOCK\")),\n            vm.envUint(\"TICK_SPACING\"),\n            vm.envAddress(\"VALIDATION_HOOK\"),\n            vm.envUint(\"FLOOR_PRICE\"),\n            uint128(vm.envUint(\"REQUIRED_CURRENCY_RAISED\")),\n            vm.envBytes(\"ENCODED_SUPPLY_SCHEDULE\")\n        );\n\n        vm.startBroadcast();\n\n        \u002F\u002F Approve token transfer to factory\n        IERC20(token).approve(\n            0xCCccCcCAE7503Cac057829BF2811De42E16e0bD5,\n            amount\n        );\n\n        \u002F\u002F Deploy auction\n        address auction = ICCAFactory(\n            0xCCccCcCAE7503Cac057829BF2811De42E16e0bD5\n        ).initializeDistribution(\n            token,\n            amount,\n            configData,\n            bytes32(0) \u002F\u002F salt\n        );\n\n        vm.stopBroadcast();\n\n        console.log(\"Auction deployed at:\", auction);\n    }\n}\n```\n\n**Important:** You must approve the token transfer to the factory before calling `initializeDistribution`. The factory will transfer `amount` tokens from your address to the newly created auction contract.\n\n#### Step 4: Using Foundry Script\n\n```bash\n# Deploy factory (if needed on new network)\nforge script script\u002Fdeploy\u002FDeployContinuousAuctionFactory.s.sol:DeployContinuousAuctionFactoryScript \\\n  --rpc-url $RPC_URL \\\n  --broadcast \\\n  --account deployer --sender $DEPLOYER_ADDRESS\n\n# Deploy auction instance\nforge script script\u002FExample.s.sol:ExampleScript \\\n  --rpc-url $RPC_URL \\\n  --broadcast \\\n  --account deployer --sender $DEPLOYER_ADDRESS\n```\n\n#### Step 5: Post-Deployment\n\nAfter deployment, you **must** call `onTokensReceived()` to notify the auction that tokens have been transferred:\n\n```bash\ncast send $AUCTION_ADDRESS \"onTokensReceived()\" --rpc-url $RPC_URL --account deployer --sender $DEPLOYER_ADDRESS\n```\n\nThis is a required prerequisite before the auction can accept bids.\n\n### Alternative: Deploy via Constructor\n\nYou can also deploy directly via the constructor:\n\n```solidity\nconstructor(\n    address token,\n    uint128 amount,\n    AuctionParameters memory parameters\n) {}\n```\n\nThis approach doesn't require a salt parameter but won't benefit from CREATE2's deterministic addressing.\n\n### Verification on Block Explorers\n\nGenerate standard JSON input for verification:\n\n```bash\nforge verify-contract $AUCTION_ADDRESS \\\n  src\u002FContinuousClearingAuction.sol:ContinuousClearingAuction \\\n  --rpc-url $RPC_URL \\\n  --show-standard-json-input > standard-json-input.json\n```\n\nUpload this file to block explorers for verification.\n\n---\n\n## Validation Rules\n\nBefore deployment, ensure:\n\n1. **Block constraints**: `startBlock \u003C endBlock \u003C= claimBlock`\n2. **Valid addresses**: All addresses are valid Ethereum addresses (0x + 40 hex chars)\n3. **Non-negative values**: All numeric values >= 0\n4. **Floor price alignment**: Floor price must be a multiple of tick spacing\n5. **Tick spacing**: At least 1 basis point of floor price (1%, 10% recommended)\n6. **Supply schedule**: Last block sells significant tokens (~30%+)\n7. **Total supply bounds**: Max 1e30 wei (1 trillion 18-decimal tokens)\n8. **No FoT tokens**: Fee-on-transfer tokens not supported\n9. **Minimum decimals**: Do not use tokens with \u003C 6 decimals\n\n---\n\n## Technical Overview\n\n### Q96 Fixed-Point Math\n\nThe auction uses Q96 fixed-point arithmetic:\n\n```solidity\nlibrary FixedPoint96 {\n    uint8 internal constant RESOLUTION = 96;\n    uint256 internal constant Q96 = 0x1000000000000000000000000; \u002F\u002F 2^96\n}\n```\n\n- **Price**: Q96 fixed-point number for fractional price ratios\n- **Demand**: Currency amounts scaled by Q96\n\n### Auction Steps (Supply Issuance)\n\nSteps are packed into bytes, where each step is a `uint64`:\n\n- First 24 bits: `mps` (per-block issuance rate in MPS)\n- Last 40 bits: `blockDelta` (number of blocks)\n\n```solidity\nfunction parse(bytes8 data) internal pure returns (uint24 mps, uint40 blockDelta) {\n    mps = uint24(bytes3(data));\n    blockDelta = uint40(uint64(data));\n}\n```\n\nThe data is deployed to an external SSTORE2 contract for cheaper reads.\n\n### Key Contract Functions\n\n#### submitBid()\n\nUsers submit bids with:\n\n- `maxPrice`: Maximum price willing to pay (Q96)\n- `amount`: Currency amount to bid\n- `owner`: Address to receive tokens\u002Frefunds\n- `prevTickPrice`: Hint for gas optimization\n- `hookData`: Optional data for validation hooks\n\n#### checkpoint()\n\nAuction is checkpointed once per block with a new bid. Checkpoints determine token allocations.\n\n#### exitBid() \u002F exitPartiallyFilledBid()\n\nBids can be exited when outbid or when auction ends (only after graduation).\n\n#### isGraduated()\n\nReturns true if `currencyRaised >= requiredCurrencyRaised`. No bids can exit before graduation.\n\n#### claimTokens()\n\nUsers claim purchased tokens after `claimBlock` (only for graduated auctions).\n\n#### sweepCurrency() \u002F sweepUnsoldTokens()\n\nAfter auction ends:\n\n- `sweepCurrency()`: Withdraw raised currency (graduated only)\n- `sweepUnsoldTokens()`: Withdraw unsold tokens\n\n---\n\n## Supported Chains\n\nCCA is deployed to canonical addresses across select EVM chains:\n\n| Chain ID | Network          | Block Time |\n| -------- | ---------------- | ---------- |\n| 1        | Mainnet          | 12s        |\n| 130      | Unichain         | 1s         |\n| 1301     | Unichain Sepolia | 2s         |\n| 8453     | Base             | 2s         |\n| 42161    | Arbitrum         | 2s         |\n| 11155111 | Sepolia          | 12s        |\n\n---\n\n## Troubleshooting\n\n### Common Issues\n\n| Issue                     | Solution                                            |\n| ------------------------- | --------------------------------------------------- |\n| \"Invalid block sequence\"  | Ensure startBlock \u003C endBlock \u003C= claimBlock          |\n| \"Floor price not aligned\" | Round floor price to multiple of tick spacing       |\n| \"Tick spacing too small\"  | Use at least 1% of floor price                      |\n| \"Total supply too large\"  | Max 1e30 wei (1 trillion 18-decimal tokens)         |\n| \"Gas inefficiency\"        | Increase tick spacing                               |\n| \"Invalid address\"         | Verify addresses are 42 characters starting with 0x |\n\n### Validation Checklist\n\nBefore deployment:\n\n- [ ] Block sequence is valid (start \u003C end \u003C= claim)\n- [ ] Floor price is multiple of tick spacing\n- [ ] Tick spacing >= 1% of floor price\n- [ ] All addresses are valid Ethereum addresses\n- [ ] Total supply \u003C= 1e30 wei\n- [ ] Currency is more valuable than token\n- [ ] Block times match network (12s mainnet, 2s L2s)\n- [ ] Recipients addresses are set (not placeholders)\n- [ ] Currency address is correct for network\n- [ ] Last supply step sells ~30%+ of tokens\n- [ ] No fee-on-transfer tokens used\n- [ ] Token decimals >= 6\n- [ ] `onTokensReceived()` called post-deployment\n\n---\n\n## Additional Resources\n\n- **CCA Repository**: \u003Chttps:\u002F\u002Fgithub.com\u002FUniswap\u002Fcontinuous-clearing-auction>\n- **Technical Documentation**: See `docs\u002FTechnicalDocumentation.md` in repo\n- **Deployment Guide**: See `docs\u002FDeploymentGuide.md` in repo\n- **Whitepaper**: See `docs\u002Fassets\u002Fwhitepaper.pdf` in repo\n- **Audits**: See `docs\u002Faudits\u002FREADME.md` in repo\n- **Uniswap Docs**: \u003Chttps:\u002F\u002Fdocs.uniswap.org\u002Fcontracts\u002Fliquidity-launchpad\u002FCCA>\n- **Bug Bounty**: \u003Chttps:\u002F\u002Fcantina.xyz\u002Fcode\u002Ff9df94db-c7b1-434b-bb06-d1360abdd1be\u002Foverview>\n","# CCA Deployment\n\nDeploy Continuous Clearing Auction (CCA) smart contracts using the `ContinuousClearingAuctionFactory` with CREATE2 for consistent addresses across chains.\n\n> **Runtime Compatibility:** This skill uses `AskUserQuestion` for interactive prompts. If `AskUserQuestion` is not available in your runtime, collect the same parameters through natural language conversation instead.\n\n## Instructions for Claude Code\n\nWhen the user invokes this skill, guide them through the CCA deployment process with appropriate safety warnings and validation.\n\n### Pre-Deployment Requirements\n\nBefore proceeding with deployment, you MUST:\n\n1. **Show educational disclaimer** and get user acknowledgment\n2. **Validate configuration file** if provided\n3. **Verify factory address** for the target network\n4. **Confirm deployment parameters** with user\n\n### Deployment Workflow\n\n1. **Show Educational Disclaimer** (REQUIRED)\n2. **Load or Request Configuration**\n3. **Validate Configuration**\n4. **Display Deployment Plan**\n5. **Get User Confirmation**\n6. **Provide Deployment Commands**\n7. **Post-Deployment Steps**\n\n---\n\n## ⚠️ Educational Use Disclaimer\n\n**IMPORTANT: Before proceeding with deployment, you must acknowledge:**\n\nThis tool and all deployment instructions are provided **for educational purposes only**. AI-generated deployment commands may contain errors or security vulnerabilities.\n\n**You must:**\n\n1. ✅ **Review all configurations carefully** before deploying\n2. ✅ **Verify all parameters** (addresses, pricing, schedules) are correct\n3. ✅ **Test on testnets first** before deploying to mainnet\n4. ✅ **Audit your contracts** before deploying with real funds\n\n**Use AskUserQuestion to confirm the user acknowledges these warnings before proceeding with deployment steps.**\n\n### Input Validation Rules\n\nBefore interpolating ANY user-provided value into forge\u002Fcast commands or deployment scripts:\n\n- **Ethereum addresses**: MUST match `^0x[a-fA-F0-9]{40}$` — reject otherwise\n- **Chain IDs**: MUST be from the supported chains list (1, 130, 143, 1301, 8453, 42161, 11155111)\n- **Numeric values** (supply, prices, blocks, chain IDs): MUST be non-negative and match `^[0-9]+\\.?[0-9]*$`\n- **REJECT** any input containing shell metacharacters: `;`, `|`, `&`, `$`, `` ` ``, `(`, `)`, `>`, `\u003C`, `\\`, `'`, `\"`, newlines\n- **Never** pass raw user input directly to shell commands without validation\n\n### ⚠️ Permission Safety\n\n**Do NOT auto-approve `Bash(forge:*)` or `Bash(cast:*)` in your Claude Code settings.** Always require per-invocation approval for commands that spend gas or broadcast transactions. The PreToolUse hooks in `.claude\u002Fhooks\u002F` provide programmatic validation as a safety net, but user approval per command is the primary control.\n\n---\n\n## 🔐 Private Key Security\n\n**CRITICAL: Handling private keys safely is essential for secure deployments.**\n\n### ⚠️ Never Do These\n\n- ❌ **Never** store private keys in git repositories or config files\n- ❌ **Never** paste private keys directly in command line (visible in shell history)\n- ❌ **Never** share private keys or store them in shared environments\n- ❌ **Never** use mainnet private keys on untrusted computers\n- ❌ **Never** use `--private-key` flag (blocked by PreToolUse hook)\n\n### ✅ Recommended Practices\n\n#### Option 1: Hardware Wallets (Most Secure)\n\nUse Ledger or Trezor hardware wallets with the `--ledger` flag:\n\n```bash\nforge script script\u002FExample.s.sol:ExampleScript \\\n  --rpc-url $RPC_URL \\\n  --broadcast \\\n  --ledger\n```\n\n#### Option 2: Encrypted Keystore\n\nCreate an encrypted keystore with `cast wallet import`:\n\n```bash\n# Import private key to encrypted keystore (one-time setup)\ncast wallet import deployer --interactive\n\n# Use keystore for deployment\nforge script script\u002FExample.s.sol:ExampleScript \\\n  --rpc-url $RPC_URL \\\n  --broadcast \\\n  --account deployer \\\n  --sender $DEPLOYER_ADDRESS\n```\n\n#### Option 3: Environment Variables (For Testing Only)\n\nIf using environment variables, ensure they are:\n\n- Set in a secure `.env` file (never committed to git)\n- Loaded via `source .env` or `dotenv`\n- Only used on trusted, secure computers\n- Use testnet keys for development\n\n**Example:**\n\n```bash\n# .env file (add to .gitignore)\nPRIVATE_KEY=0x...\nRPC_URL=https:\u002F\u002F...\n\n# Load environment\nsource .env\n\n# Deploy (use encrypted keystore instead of --private-key)\ncast wallet import deployer --interactive\nforge script ... --account deployer --sender $DEPLOYER_ADDRESS\n```\n\n### Testnet First\n\n**Always test on testnets before mainnet:**\n\n- Sepolia (testnet): Get free ETH from faucets\n- Base Sepolia: Free ETH for testing on Base\n- Deploy and verify full workflow on testnet\n- Only deploy to mainnet after thorough testing\n\n---\n\n## Deployment Guide\n\n### Factory Deployment\n\nCCA instances are deployed via the `ContinuousClearingAuctionFactory` contract, which uses CREATE2 for consistent addresses across chains.\n\n#### Factory Addresses\n\n| Version | Address                                      | Status          |\n| ------- | -------------------------------------------- | --------------- |\n| v1.1.0  | `0xCCccCcCAE7503Cac057829BF2811De42E16e0bD5` | **Recommended** |\n\n### Deploying an Auction Instance\n\n#### Step 0: Clone the CCA Repository\n\nIf you don't already have the CCA contracts locally, clone the repository and install dependencies:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FUniswap\u002Fcontinuous-clearing-auction.git\ncd continuous-clearing-auction\nforge install\n```\n\nThis gives you access to the deployment scripts, contract ABIs, and test helpers referenced in later steps.\n\n#### Step 1: Prepare Configuration\n\nEnsure you have a valid configuration file (generated via the `configurator` skill or manually created).\n\nExample configuration file structure:\n\n```json\n{\n  \"1\": {\n    \"token\": \"0x...\",\n    \"totalSupply\": 1e29,\n    \"currency\": \"0x0000000000000000000000000000000000000000\",\n    \"tokensRecipient\": \"0x...\",\n    \"fundsRecipient\": \"0x...\",\n    \"startBlock\": 24321000,\n    \"endBlock\": 24327001,\n    \"claimBlock\": 24327001,\n    \"tickSpacing\": 79228162514264337593543950,\n    \"validationHook\": \"0x0000000000000000000000000000000000000000\",\n    \"floorPrice\": 7922816251426433759354395000,\n    \"requiredCurrencyRaised\": 0,\n    \"supplySchedule\": [\n      { \"mps\": 1000, \"blockDelta\": 6000 },\n      { \"mps\": 4000000, \"blockDelta\": 1 }\n    ]\n  }\n}\n```\n\n#### Step 2: Validate Configuration\n\nBefore deployment, verify the configuration passes all validation rules (see Validation Rules section).\n\n#### Step 3: Deploy via Factory\n\nThe factory has a simple interface:\n\n```solidity\nfunction initializeDistribution(\n    address token,\n    uint256 amount,\n    bytes calldata configData,\n    bytes32 salt\n) external returns (IDistributionContract);\n```\n\nWhere:\n\n- `token`: Address of the token to be sold\n- `amount`: Amount of tokens to sell in the auction\n- `configData`: ABI-encoded `AuctionParameters` struct\n- `salt`: Optional bytes32 value for vanity address mining\n\n#### Step 3.5: Encode Configuration to configData\n\nThe factory's `initializeDistribution` expects `configData` as ABI-encoded `AuctionParameters`. Convert your JSON config to encoded bytes:\n\n**Using cast (Foundry CLI):**\n\n```bash\n# Encode the AuctionParameters struct\ncast abi-encode \"initializeDistribution(address,uint256,bytes,bytes32)\" \\\n  \"$TOKEN_ADDRESS\" \\\n  \"$TOTAL_SUPPLY\" \\\n  \"$(cast abi-encode \"(address,address,address,uint64,uint64,uint64,uint256,address,uint256,uint128,bytes)\" \\\n    \"$CURRENCY\" \\\n    \"$TOKENS_RECIPIENT\" \\\n    \"$FUNDS_RECIPIENT\" \\\n    \"$START_BLOCK\" \\\n    \"$END_BLOCK\" \\\n    \"$CLAIM_BLOCK\" \\\n    \"$TICK_SPACING\" \\\n    \"$VALIDATION_HOOK\" \\\n    \"$FLOOR_PRICE\" \\\n    \"$REQUIRED_CURRENCY_RAISED\" \\\n    \"$ENCODED_SUPPLY_SCHEDULE\")\" \\\n  \"0x0000000000000000000000000000000000000000000000000000000000000000\"\n```\n\n**Using a Foundry Script:**\n\n```solidity\n\u002F\u002F script\u002FDeployAuction.s.sol\npragma solidity ^0.8.24;\n\nimport \"forge-std\u002FScript.sol\";\n\ninterface ICCAFactory {\n    function initializeDistribution(\n        address token,\n        uint256 amount,\n        bytes calldata configData,\n        bytes32 salt\n    ) external returns (address);\n}\n\ncontract DeployAuction is Script {\n    function run() external {\n        \u002F\u002F Load config values\n        address token = vm.envAddress(\"TOKEN\");\n        uint256 amount = vm.envUint(\"TOTAL_SUPPLY\");\n\n        \u002F\u002F Encode AuctionParameters\n        bytes memory configData = abi.encode(\n            vm.envAddress(\"CURRENCY\"),\n            vm.envAddress(\"TOKENS_RECIPIENT\"),\n            vm.envAddress(\"FUNDS_RECIPIENT\"),\n            uint64(vm.envUint(\"START_BLOCK\")),\n            uint64(vm.envUint(\"END_BLOCK\")),\n            uint64(vm.envUint(\"CLAIM_BLOCK\")),\n            vm.envUint(\"TICK_SPACING\"),\n            vm.envAddress(\"VALIDATION_HOOK\"),\n            vm.envUint(\"FLOOR_PRICE\"),\n            uint128(vm.envUint(\"REQUIRED_CURRENCY_RAISED\")),\n            vm.envBytes(\"ENCODED_SUPPLY_SCHEDULE\")\n        );\n\n        vm.startBroadcast();\n\n        \u002F\u002F Approve token transfer to factory\n        IERC20(token).approve(\n            0xCCccCcCAE7503Cac057829BF2811De42E16e0bD5,\n            amount\n        );\n\n        \u002F\u002F Deploy auction\n        address auction = ICCAFactory(\n            0xCCccCcCAE7503Cac057829BF2811De42E16e0bD5\n        ).initializeDistribution(\n            token,\n            amount,\n            configData,\n            bytes32(0) \u002F\u002F salt\n        );\n\n        vm.stopBroadcast();\n\n        console.log(\"Auction deployed at:\", auction);\n    }\n}\n```\n\n**Important:** You must approve the token transfer to the factory before calling `initializeDistribution`. The factory will transfer `amount` tokens from your address to the newly created auction contract.\n\n#### Step 4: Using Foundry Script\n\n```bash\n# Deploy factory (if needed on new network)\nforge script script\u002Fdeploy\u002FDeployContinuousAuctionFactory.s.sol:DeployContinuousAuctionFactoryScript \\\n  --rpc-url $RPC_URL \\\n  --broadcast \\\n  --account deployer --sender $DEPLOYER_ADDRESS\n\n# Deploy auction instance\nforge script script\u002FExample.s.sol:ExampleScript \\\n  --rpc-url $RPC_URL \\\n  --broadcast \\\n  --account deployer --sender $DEPLOYER_ADDRESS\n```\n\n#### Step 5: Post-Deployment\n\nAfter deployment, you **must** call `onTokensReceived()` to notify the auction that tokens have been transferred:\n\n```bash\ncast send $AUCTION_ADDRESS \"onTokensReceived()\" --rpc-url $RPC_URL --account deployer --sender $DEPLOYER_ADDRESS\n```\n\nThis is a required prerequisite before the auction can accept bids.\n\n### Alternative: Deploy via Constructor\n\nYou can also deploy directly via the constructor:\n\n```solidity\nconstructor(\n    address token,\n    uint128 amount,\n    AuctionParameters memory parameters\n) {}\n```\n\nThis approach doesn't require a salt parameter but won't benefit from CREATE2's deterministic addressing.\n\n### Verification on Block Explorers\n\nGenerate standard JSON input for verification:\n\n```bash\nforge verify-contract $AUCTION_ADDRESS \\\n  src\u002FContinuousClearingAuction.sol:ContinuousClearingAuction \\\n  --rpc-url $RPC_URL \\\n  --show-standard-json-input > standard-json-input.json\n```\n\nUpload this file to block explorers for verification.\n\n---\n\n## Validation Rules\n\nBefore deployment, ensure:\n\n1. **Block constraints**: `startBlock \u003C endBlock \u003C= claimBlock`\n2. **Valid addresses**: All addresses are valid Ethereum addresses (0x + 40 hex chars)\n3. **Non-negative values**: All numeric values >= 0\n4. **Floor price alignment**: Floor price must be a multiple of tick spacing\n5. **Tick spacing**: At least 1 basis point of floor price (1%, 10% recommended)\n6. **Supply schedule**: Last block sells significant tokens (~30%+)\n7. **Total supply bounds**: Max 1e30 wei (1 trillion 18-decimal tokens)\n8. **No FoT tokens**: Fee-on-transfer tokens not supported\n9. **Minimum decimals**: Do not use tokens with \u003C 6 decimals\n\n---\n\n## Technical Overview\n\n### Q96 Fixed-Point Math\n\nThe auction uses Q96 fixed-point arithmetic:\n\n```solidity\nlibrary FixedPoint96 {\n    uint8 internal constant RESOLUTION = 96;\n    uint256 internal constant Q96 = 0x1000000000000000000000000; \u002F\u002F 2^96\n}\n```\n\n- **Price**: Q96 fixed-point number for fractional price ratios\n- **Demand**: Currency amounts scaled by Q96\n\n### Auction Steps (Supply Issuance)\n\nSteps are packed into bytes, where each step is a `uint64`:\n\n- First 24 bits: `mps` (per-block issuance rate in MPS)\n- Last 40 bits: `blockDelta` (number of blocks)\n\n```solidity\nfunction parse(bytes8 data) internal pure returns (uint24 mps, uint40 blockDelta) {\n    mps = uint24(bytes3(data));\n    blockDelta = uint40(uint64(data));\n}\n```\n\nThe data is deployed to an external SSTORE2 contract for cheaper reads.\n\n### Key Contract Functions\n\n#### submitBid()\n\nUsers submit bids with:\n\n- `maxPrice`: Maximum price willing to pay (Q96)\n- `amount`: Currency amount to bid\n- `owner`: Address to receive tokens\u002Frefunds\n- `prevTickPrice`: Hint for gas optimization\n- `hookData`: Optional data for validation hooks\n\n#### checkpoint()\n\nAuction is checkpointed once per block with a new bid. Checkpoints determine token allocations.\n\n#### exitBid() \u002F exitPartiallyFilledBid()\n\nBids can be exited when outbid or when auction ends (only after graduation).\n\n#### isGraduated()\n\nReturns true if `currencyRaised >= requiredCurrencyRaised`. No bids can exit before graduation.\n\n#### claimTokens()\n\nUsers claim purchased tokens after `claimBlock` (only for graduated auctions).\n\n#### sweepCurrency() \u002F sweepUnsoldTokens()\n\nAfter auction ends:\n\n- `sweepCurrency()`: Withdraw raised currency (graduated only)\n- `sweepUnsoldTokens()`: Withdraw unsold tokens\n\n---\n\n## Supported Chains\n\nCCA is deployed to canonical addresses across select EVM chains:\n\n| Chain ID | Network          | Block Time |\n| -------- | ---------------- | ---------- |\n| 1        | Mainnet          | 12s        |\n| 130      | Unichain         | 1s         |\n| 1301     | Unichain Sepolia | 2s         |\n| 8453     | Base             | 2s         |\n| 42161    | Arbitrum         | 2s         |\n| 11155111 | Sepolia          | 12s        |\n\n---\n\n## Troubleshooting\n\n### Common Issues\n\n| Issue                     | Solution                                            |\n| ------------------------- | --------------------------------------------------- |\n| \"Invalid block sequence\"  | Ensure startBlock \u003C endBlock \u003C= claimBlock          |\n| \"Floor price not aligned\" | Round floor price to multiple of tick spacing       |\n| \"Tick spacing too small\"  | Use at least 1% of floor price                      |\n| \"Total supply too large\"  | Max 1e30 wei (1 trillion 18-decimal tokens)         |\n| \"Gas inefficiency\"        | Increase tick spacing                               |\n| \"Invalid address\"         | Verify addresses are 42 characters starting with 0x |\n\n### Validation Checklist\n\nBefore deployment:\n\n- [ ] Block sequence is valid (start \u003C end \u003C= claim)\n- [ ] Floor price is multiple of tick spacing\n- [ ] Tick spacing >= 1% of floor price\n- [ ] All addresses are valid Ethereum addresses\n- [ ] Total supply \u003C= 1e30 wei\n- [ ] Currency is more valuable than token\n- [ ] Block times match network (12s mainnet, 2s L2s)\n- [ ] Recipients addresses are set (not placeholders)\n- [ ] Currency address is correct for network\n- [ ] Last supply step sells ~30%+ of tokens\n- [ ] No fee-on-transfer tokens used\n- [ ] Token decimals >= 6\n- [ ] `onTokensReceived()` called post-deployment\n\n---\n\n## Additional Resources\n\n- **CCA Repository**: \u003Chttps:\u002F\u002Fgithub.com\u002FUniswap\u002Fcontinuous-clearing-auction>\n- **Technical Documentation**: See `docs\u002FTechnicalDocumentation.md` in repo\n- **Deployment Guide**: See `docs\u002FDeploymentGuide.md` in repo\n- **Whitepaper**: See `docs\u002Fassets\u002Fwhitepaper.pdf` in repo\n- **Audits**: See `docs\u002Faudits\u002FREADME.md` in repo\n- **Uniswap Docs**: \u003Chttps:\u002F\u002Fdocs.uniswap.org\u002Fcontracts\u002Fliquidity-launchpad\u002FCCA>\n- **Bug Bounty**: \u003Chttps:\u002F\u002Fcantina.xyz\u002Fcode\u002Ff9df94db-c7b1-434b-bb06-d1360abdd1be\u002Foverview>\n",{"name":5,"model":24,"license":15,"metadata":25,"description":7,"allowed-tools":28},"opus",{"author":26,"version":27},"uniswap","1.0.0","Read, Glob, Grep, Bash(forge:*), Bash(cast:*), Bash(curl:*), AskUserQuestion","main","1c523aba5cdf867a79f078847075492d7778092a","skills\u002Fdeployer",1,"https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills","https:\u002F\u002Fskills.x402.wtf","https:\u002F\u002Fgithub.com\u002Fthemusebook","https:\u002F\u002Fmusebook.trade","The official Github of musebook","2026-11-02 23:42:26",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add themusebook\u002Fskills --skill deployer",{"tool":45,"command":46},"bunx","bunx skills add themusebook\u002Fskills --skill deployer",{"tool":48,"command":49},"pnpm","pnpm dlx skills add themusebook\u002Fskills --skill deployer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdeployer\u002FSKILL.md",true,[],[54,62,69,76,83,90],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":58,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M7AB34SPKVSDRRG009PM1CZH","youtube-clipper","YouTube 视频智能剪辑工具。下载视频和字幕，AI 分析生成精细章节（几分钟级别）， 用户选择片段后自动剪辑、翻译字幕为中英双语、烧录字幕到视频，并生成总结文案。 使用场景：当用户需要剪辑 YouTube 视频、生成短视频片段、制作双语字幕版本时。 关键词：视频剪辑、YouTube、字幕翻译、双语字幕、视频下载、clip video","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube-clipper\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube-clipper\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7AB18BH6N7KR7939HRNWVMQ","viem-integration","Integrate EVM blockchains using viem. Use when user says \"read blockchain data\", \"send transaction\", \"interact with smart contract\", \"connect to Ethereum\", \"use viem\", \"use wagmi\", \"wallet integration\", \"viem setup\", or mentions blockchain\u002FEVM development with TypeScript.","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fviem-integration\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7AB12GHGP48WCNXDQQ9222H","v4-security-foundations","Security-first Uniswap v4 hook development. Use when user mentions \"v4 hooks\", \"hook security\", \"PoolManager\", \"beforeSwap\", \"afterSwap\", or asks about V4 hook best practices, vulnerabilities, or audit requirements.","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fv4-security-foundations\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7AB0XM3PSR7V3Q2ZRR0Q0FB","v4-sdk-integration","App-layer SDK guide for building swap and liquidity experiences directly with the Uniswap v4 SDK. Use when user asks about \"v4 sdk\", \"uniswap v4\", \"v4 swap\", \"v4 liquidity\", \"PoolManager\", \"V4Planner\", \"StateView\", \"PositionManager\", \"pool state\", \"v4 position\", \"uniswap sdk\", or when building swap\u002Fliquidity UX directly with SDKs rather than via the Trading API.","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fv4-sdk-integration\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7AB0SGA93ASA588DJW4P9WT","v4-hook-generator","Generate Uniswap v4 hook contracts via OpenZeppelin MCP. Use when building custom swap logic, async swaps, hook-owned liquidity, custom curves, dynamic fees, MEV protection, limit orders, or oracle hooks.","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fv4-hook-generator\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M7AAZYH75H4CS03WSW2EZ8DM","testing","For testing with Light Protocol programs and clients on localnet, devnet, and mainnet validation.","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Ftesting\u002FSKILL.md",[],[]]