[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M787756KX2BKRC119KJSXDBS":3,"skill-same:01M787756KX2BKRC119KJSXDBS":62},{"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":14,"repositoryHtmlUrl":32,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":35,"ownerDescription":36,"updatedAt":37,"install":38,"resources":51},"01M787756KX2BKRC119KJSXDBS","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.","Solizardking\u002Fskillhub-main","Solizardking","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F108096810?v=4","01M786KDB10AYV042N0F9BD5B5","Clawd","01M786NYYXSZK1D05WM8JQPC48",0,"MIT","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fpublic\u002Fapi\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","be3de0244dc1a57e323d8160787ebb40fb64930e","public\u002Fapi\u002Fskills\u002Fdeployer","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main","https:\u002F\u002Fskills.x402.wtf","https:\u002F\u002Fgithub.com\u002FSolizardking","https:\u002F\u002Fmusebook.trade","Got a mile high and never came down","2026-10-08 23:20:13",{"source":8,"skillName":5,"commands":39,"prompt":49,"zipAvailable":50},[40,43,46],{"tool":41,"command":42},"npx","npx skills add Solizardking\u002Fskillhub-main --skill deployer",{"tool":44,"command":45},"bunx","bunx skills add Solizardking\u002Fskillhub-main --skill deployer",{"tool":47,"command":48},"pnpm","pnpm dlx skills add Solizardking\u002Fskillhub-main --skill deployer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fpublic\u002Fapi\u002Fskills\u002Fdeployer\u002FSKILL.md",true,[52,58],{"path":53,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":56,"sourceHtmlUrl":57},"metadata.json","REFERENCE","参考文档",342,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fpublic\u002Fapi\u002Fskills\u002Fdeployer\u002Fmetadata.json",{"path":59,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":60,"sourceHtmlUrl":61},"verification.json",1024,"https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fpublic\u002Fapi\u002Fskills\u002Fdeployer\u002Fverification.json",[63,70,77,84,91,99],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M78E0TGCAMNPS207BA3G07S7","zkrouter","Self-hosted OpenAI-compatible LLM router — smart tier-based routing, ZK-stamped routing decisions, mode overrides, free OpenRouter at install via the Birth bot. Save 60-80% on inference costs by routing to the cheapest capable model across 12+ OpenRouter models.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzkrouter\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M78E0R1Z8BDT6EDTHY17MTNB","zk","For custom ZK Solana programs and privacy-preserving applications to prevent double spending. Guide to integrate rent-free nullifier PDAs for double-spend prevention.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzk\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M78E0P3ZTZ1YWF8MD5MM23QE","zk-omni-messaging","Zero-knowledge omnichain messaging between Robinhood Chain and Solana using CheshireZkOmniMessenger (msgType 4) with nullifier anti-replay and the zk-omni-relayer service.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzk-omni-messaging\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M78E0JXZ2PNB1896VXAGDBWD","zerion-wallet-data","Use when the user asks to check a wallet's portfolio, token balances, DeFi positions, PnL, transaction history, or NFTs. Provides interpreted on-chain data across 40+ EVM chains and Solana via x402 pay-per-request or API key — no raw RPC decoding needed.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzerion-wallet-data\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":95,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M78E0G14FH9GRRTQYMKD5E59","youtube-clipper","YouTube 视频智能剪辑工具。下载视频和字幕，AI 分析生成精细章节（几分钟级别）， 用户选择片段后自动剪辑、翻译字幕为中英双语、烧录字幕到视频，并生成总结文案。 使用场景：当用户需要剪辑 YouTube 视频、生成短视频片段、制作双语字幕版本时。 关键词：视频剪辑、YouTube、字幕翻译、双语字幕、视频下载、clip video","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube-clipper\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube-clipper\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":19},"01M78E0C2ZYA99CFFDNB7ZMK5S","yield-optimization","Multi-chain yield optimization via yield.xyz (StakeKit). Discover 2,988+ yield opportunities across 75+ blockchains, build deposit\u002Fwithdrawal transactions with shell scripts, and sign them with a MoonPay wallet. Use when the user wants to earn yield, find the best lending or staking rate, enter\u002Fexit a position, or check portfolio balances.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fyield-optimization\u002FSKILL.md",[],[]]