{"workflow":null,"planning":null,"id":"76506bc8-6d8a-4fe0-95cb-6384a0801040","state":"completed","template":"skill:build-contract-project","objective":"Sorphera - contract hardening, integration tests and deployment preparation\n\nTagline: Weekly ETH & NFT lottery ball jackpots. Powered by FWA.\nRepo: Sorphera repository\nIMD launch: 961\nParent job: a3707b79-51b8-4d04-9e32-3e786d91c1d9\nReviewed commit: b06997d42012b7ad7ffe943b3acdd816b2092c4e\n\nContinue from the current repo head; check changes since the reviewed commit. Keep this contracts-only: implement contracts, tests, deployment scripts, docs and integration artifacts. Target Ethereum mainnet, testing FWA on a pinned mainnet fork. Do not broadcast mainnet transactions, spend real funds or enable public sales.\n\nPRESERVE PRODUCT RULES\n\nTwo separate weekly lottery-ball games:\n\nETH Jackpot: settle FWA acquisitions to ETH. Winning tickets split distributable ETH equally; no winners means rollover.\n\nNFT Jackpot: take the NFTs. No winners means inventory rollover; one winning ticket receives all inventory. Multiple winning tickets trigger a separate verifiable random tie-break selecting ONE winning ticket for all inventory.\n\nKeep three distinct unordered main numbers 1-20 plus bonus 1-5, existing ticket ownership, 0.005 ETH default tickets and 10% operator fee / 90% acquisition defaults.\n\nTotal ticket sales remain uncapped; transaction batches and processing remain bounded.\n\nCompany builder rewards stay separate from purchaser reward entitlements, prizes and refunds.\n\nPreserve custody/refund/claim/rollover guarantees and economics; explain necessary changes.\n\nUse verifiable randomness and expose draw/tie-break events for future animations. No website work.\n\nFIX THE FAILED DEPLOYMENT REHEARSAL\n\nLaunch was parked after 6/7 gates passed. protected_invariants failed with \"application constructor failed\" in setUp(), gas 0. Sorphera checks for code at the factory and VRF coordinator; the factory checks router code.\n\nCapture the failing contract, resolved constructor arguments, chain state and revert trace. Check dependency order, $owner/$contract substitutions and coordinator code. Match IMD compiler/optimizer/EVM settings. Local tests passed 64/64 on Forge 1.7.1; IMD reported 1.8.3. Investigate, rather than assume, the cause.\n\nFix the cause without weakening safeguards or mocking production dependencies. If IMD's private harness is unavailable, supply a public reproduction and exact platform follow-up. Never claim its gate passed without evidence.\n\nVERIFY MAINNET INTEGRATION AND NETWORK CONFIGURATION\n\nPrimary references:\n\nFWA deployments\n\nBuilder revenue\n\nFWA testing\n\nBuilder examples\n\nChainlink networks\n\nPublished mainnet pool: 0x958C41181182e76F221331b2755b77D9e1426A98\nPublished mainnet rewards: 0xA54b44C7a894AA19C49734A753D01f9B8C5f6516\n\nReviewed Sepolia lacked builder attribution. Mainnet source/ABI includes it; an explorer read reported builderRewardBps() = 1500. Reverify compatibility and current settings; the rate can change.\n\nRecord chain/block, bytecode, ABIs and pool/rewards/token/randomness bindings. Verify the transfer helper, Permit2, distributor/deposit permissions and liquidity. Prove router builder attribution as immediate acquire caller, with round vaults retaining purchaser rights.\n\nReplace the Sepolia-only restriction with validated network configuration: chain ID, dependencies, coordinator, key hash and subscription. Fail closed on wrong chains/incompatible dependencies. Separate production and test-only simulation.\n\nRead live quotes, VRF charges, gas-price assumptions, slippage limits and settlement windows. Do not hardcode 0.06 ETH pulls or source defaults.\n\nTEST COMPLETE LIFECYCLES AND FAILURE PATHS\n\nRun existing tests and add pinned mainnet-fork tests using deployed FWA code unchanged. Record commands/RPC requirements; disclose fork-only balances, impersonation and oracle simulation.\n\nCover both games: tickets -> FWA requests -> allocation -> ETH/NFT settlement -> draw -> finalization -> claims. Verify real builder allowance accounting, eligible acquisition/settlement credits, reward purchase, transfer-helper queueing and next-block treasury delivery. Test purchaser rewards separately.\n\nRequired coverage:\n\nETH prize splits, duplicate winning tickets, no-winner rollover and rounding dust.\n\nNFT single winner, multiwinner tie-break, rollover and bounded delivery/recovery.\n\nFailed/expired acquisitions, immediate/deferred refunds, stale/slipping quotes, unavailable inventory, delayed allocation and missed settlement windows.\n\nCross-round isolation, conservation of funds/inventory, locked liabilities, correct fee accounting and prevention of operator withdrawal of prizes/refunds/purchaser rewards.\n\nNumber validation/canonical ordering, quick-pick/draw sampling bias, bonus independence, cutoff boundaries and immutable terms for sold tickets.\n\nUnauthorized, duplicate, delayed and out-of-order VRF callbacks; request-to-round binding and separate tie-break requests.\n\nReentrancy, reverting recipients, NFT receiver failures, unauthorized administration, paused paths and changed dependency/helper permissions.\n\nLarge ticket/inventory counts: demonstrate bounded gas and progress without processing every ticket in one transaction.\n\nForks receive no automatic live Chainlink callbacks. Document test-only fulfillment for FWA and lottery VRF. Separately test lottery VRF on Sepolia with controlled FWA test dependencies and the real coordinator if test funding/access exists. Otherwise deliver scripts, exact prerequisites and a NOT RUN result. Never label simulation as live VRF verification.\n\nReview lockups from permanent VRF failure, pending acquisitions and missed settlement windows. Document fair recovery options; prohibit discretionary rerolls, winner replacement and post-sale rule changes.\n\nPREPARE DEPLOYMENT AND OPERATIONS\n\nDeliver build/deployment rehearsals, owner/treasury inputs, dependency order, factory binding, router setup, company VRF subscription/consumer setup and funding/preflight checks. Sales default to disabled.\n\nSeparate mainnet/Sepolia/fork artifacts. Check current IMD rules: a continuation may update code without redeploying or retargeting the parked Sepolia launch. Document the supported mainnet route and any new launch/platform action required.\n\nProvide keeper/operations scripts and a runbook for acquisitions, allocation processing, timely settlement, closing rounds, randomness requests, finalization and reward claims. Specify permissions, funding, monitoring and safe retries.\n\nDELIVER EVIDENCE\n\nCommit fixes/tests to the existing project and summarize the changes. Update dependency records, test reports, manifests, ABIs, events and configuration schemas. Leave undeployed addresses null and label simulated/example artifacts.\n\nReport:\n\nRoot cause, fix, files changed and protected-gate status.\n\nExact commands and passed/failed/skipped test counts.\n\nMainnet fork block/dependencies and real vs simulated oracle coverage.\n\nGas/scaling results and supported deployment procedure.\n\nRemaining blockers, each with the exact external input/action required.\n\nComplete all unblocked work. Distinguish verified, unrun and blocked steps. State readiness for independent security review/deployment rehearsal; passing tests is not an audit or approval for public sales.","blockedReason":null,"createdAt":"2026-10-08T04:15:44.059Z","updatedAt":"2026-10-08T05:00:57.663Z","paidBy":"0xea18227840e0b7de103a6756020168c5bb7b13d2","parentJobId":"a3707b79-51b8-4d04-9e32-3e786d91c1d9","project":{"id":"a3707b79-51b8-4d04-9e32-3e786d91c1d9","head":"76506bc8-6d8a-4fe0-95cb-6384a0801040","running":null,"versions":[{"jobId":"a3707b79-51b8-4d04-9e32-3e786d91c1d9","workflowId":null,"objective":"Build Sorphera smart contracts on Ethereum Sepolia.\nTagline: Weekly ETH & NFT lottery ball jackpots. Powered by FWA.\nUse Sorphera branding throughout. Deliver contracts, Foundry tests and docs; website later. No new ERC20 or liquidity pool.\n\nGAMES\n\nSorphera ETH Jackpot and Sorphera NFT Jackpot each draw weekly (two draws total), with separate rounds, tickets, schedules and accounting.\nEach nontransferable ticket enters one game/round. Default: 0.005 Sepolia ETH. Players pick 3 distinct unordered numbers from 1-20 and 1 bonus from 1-5. Duplicate combinations and multiple tickets per wallet are allowed.\nUncapped sales; bounded transaction batches. Configure seven-day windows, separate initial cutoffs and earliest draw-request times. Freeze price, fees, number format and deadlines before first sale; changes affect future rounds only.\n\nMONEY\n\nSplit new sales: 10% operator fee, 90% round-specific FWA acquisition budget, including FWA acquisition/VRF charges. Operator resources separately fund lottery VRF and gas.\nIsolate fees, budgets, pending requests, refunds, carryovers and winner liabilities by game/round. No cross-subsidies or spending reserved assets. Charge fees once on new sales, never on prizes, refunds or carryovers.\nBuilder rewards belong to the company. Purchaser rewards/refunds are prizes. Late recoveries follow the originating round's winner, rollover or refund entitlements. Operator withdrawals cannot consume player assets.\n\nFWA\n\nVerify Sepolia addresses, ABIs and dependencies using:\n[Sepolia](https://www.fwa.fun/docs/v2-sepolia)\n[Builder rewards](https://www.fwa.fun/docs/builder-revenue)\n[Settlement](https://www.fwa.fun/docs/winning)\n[Reference contracts](https://github.com/adamlizek/fwa-examples)\nMake a builder router the immediate caller of FWAV2.acquire and a separate prize vault the purchaser. Preserve builder attribution and purchaser rights.\nRead live quotes, fees, settings and settlement windows; never hardcode 0.06 ETH/spin. Enforce budgets, slippage limits and deadlines. Attribute all requests, allocations, settlements and recoveries to game/round.\nRecover expired requests and overpayments. Claim builder rewards only against actual allowances; assume no fixed emissions or guaranteed revenue.\nPermissionless settlement enforces the game's fixed outcome. Document keepers, deadlines, missed windows and pending delivery. Verify NFT custody, not just notifications.\n\nETH JACKPOT\n\nUse its acquisition budget for FWA pulls; settle successful allocations to ETH.\nPrize = actual cashouts + unused budget + refunds + ETH carryover. Prize value is not guaranteed.\nAfter cutoff and reconciliation, draw numbers. Match all 3 main numbers and the bonus to qualify.\nOne match wins everything. Multiple matches split equally per winning ticket, including repeats per wallet. No match rolls the prize into the next ETH round. Old tickets expire; never buy pulls with carryover.\nUse claim-based payouts, reserve unpaid winnings and carry division dust forward.\n\nNFT JACKPOT\n\nUse its acquisition budget for FWA pulls; always choose \"keep the NFT\" and secure assets promptly in the vault. No voluntary cashouts, sales, relisting, substitution or cherry-picking. Track collection, token ID, acquisition, round and custody.\nUse the same selected numbers and exact-match rule:\n\n- No match: roll all inventory and residual prize funds into the next NFT round; old tickets expire.\n- One match: that ticket wins all inventory and residual prize funds.\n- Multiple matches: uniformly select ONE matching ticket to win everything, using a domain-separated stream of verified round randomness. Each matching ticket has equal probability, including repeats per wallet. Disclose the tie-break.\n\nAdd acquisitions to carryover; never respin or re-fee carryover. Freeze secured inventory before requesting lottery randomness.\nAllow individual/batched claims to the winner's nominated compatible recipient. Isolate transfer failures, prevent double claims and reserve unclaimed assets.\nUnexpected ETH recoveries remain incidental NFT-round prize funds; never label them NFTs or guarantee resale value.\nIf no NFT, including carryover, is secured by the published settlement deadline, cancel BEFORE requesting lottery randomness. Refund available unspent/recovered funds plus reserved operator fees pro rata to ticket holders; preserve late-recovery entitlements. Do not guarantee full refunds after third-party charges/losses. Hold this round's operator fees until success/cancellation is established.\n\nRANDOMNESS AND REPLAY\n\nUse independent Chainlink VRF for lottery draws, separate from FWA randomness. Bind callbacks to game, round and request ID. Uniformly sample 3 distinct main balls and 1 bonus. Store ordered balls for replay and normalized combinations for matching.\nClose sales and reconcile required prize accounting before requesting randomness, never before the published earliest request time. Specify settlement/VRF delay handling.\nNo rerolls, replacement requests, admin-selected results, post-cutoff purchases or outcome-dependent cancellation. Store randomness in callbacks; finalize and claim separately.\nExpose persistent state/events for schedules, closure, prizes, randomness, ordered results, match counts, tie-breaks, rollovers and claims for replay/reconnection.\nFrontend globe-ball animations show recorded results, never determine outcomes. Document that onchain results may be readable before animation ends; no secret per-ball releases.\nWith zero tickets, skip randomness and retain carryover.\n\nSECURITY AND DELIVERY\n\nIndex combinations/matching tickets so finalization and selection never scan all sales. Never require transferring the full NFT inventory in one transaction.\nPrevent reentrancy, stale/duplicate callbacks, double claims, rejected-transfer losses and cross-round accounting errors. Admins cannot seize prizes or change active-round rules. Pausing sales preserves claims.\nTest zero/one/multiple matches, duplicates, both rollovers, NFT tie-break, large ticket/inventory counts, failed acquisitions, delayed settlement, custody recovery, late refunds, partial claims, rounding and conservation of funds.\nProvide reproducible mocks and separate FWA Sepolia integration tests. Distinguish verified behavior, assumptions and mocks; never silently substitute mocks.\nDeploy with sales disabled until dependencies, configuration and randomness funding are validated.\nExport source, ABIs, addresses, deployment blocks, configuration and frontend interfaces; document setup, remaining dependencies and both lifecycles.","baseCommit":"0243d7da4a4337ae8b16bcdf15bb4ead736fd68f","state":"completed","createdAt":"2026-10-08T01:35:15.425Z"},{"jobId":"76506bc8-6d8a-4fe0-95cb-6384a0801040","workflowId":null,"objective":"Sorphera - contract hardening, integration tests and deployment preparation\n\nTagline: Weekly ETH & NFT lottery ball jackpots. Powered by FWA.\nRepo: Sorphera repository\nIMD launch: 961\nParent job: a3707b79-51b8-4d04-9e32-3e786d91c1d9\nReviewed commit: b06997d42012b7ad7ffe943b3acdd816b2092c4e\n\nContinue from the current repo head; check changes since the reviewed commit. Keep this contracts-only: implement contracts, tests, deployment scripts, docs and integration artifacts. Target Ethereum mainnet, testing FWA on a pinned mainnet fork. Do not broadcast mainnet transactions, spend real funds or enable public sales.\n\nPRESERVE PRODUCT RULES\n\nTwo separate weekly lottery-ball games:\n\nETH Jackpot: settle FWA acquisitions to ETH. Winning tickets split distributable ETH equally; no winners means rollover.\n\nNFT Jackpot: take the NFTs. No winners means inventory rollover; one winning ticket receives all inventory. Multiple winning tickets trigger a separate verifiable random tie-break selecting ONE winning ticket for all inventory.\n\nKeep three distinct unordered main numbers 1-20 plus bonus 1-5, existing ticket ownership, 0.005 ETH default tickets and 10% operator fee / 90% acquisition defaults.\n\nTotal ticket sales remain uncapped; transaction batches and processing remain bounded.\n\nCompany builder rewards stay separate from purchaser reward entitlements, prizes and refunds.\n\nPreserve custody/refund/claim/rollover guarantees and economics; explain necessary changes.\n\nUse verifiable randomness and expose draw/tie-break events for future animations. No website work.\n\nFIX THE FAILED DEPLOYMENT REHEARSAL\n\nLaunch was parked after 6/7 gates passed. protected_invariants failed with \"application constructor failed\" in setUp(), gas 0. Sorphera checks for code at the factory and VRF coordinator; the factory checks router code.\n\nCapture the failing contract, resolved constructor arguments, chain state and revert trace. Check dependency order, $owner/$contract substitutions and coordinator code. Match IMD compiler/optimizer/EVM settings. Local tests passed 64/64 on Forge 1.7.1; IMD reported 1.8.3. Investigate, rather than assume, the cause.\n\nFix the cause without weakening safeguards or mocking production dependencies. If IMD's private harness is unavailable, supply a public reproduction and exact platform follow-up. Never claim its gate passed without evidence.\n\nVERIFY MAINNET INTEGRATION AND NETWORK CONFIGURATION\n\nPrimary references:\n\nFWA deployments\n\nBuilder revenue\n\nFWA testing\n\nBuilder examples\n\nChainlink networks\n\nPublished mainnet pool: 0x958C41181182e76F221331b2755b77D9e1426A98\nPublished mainnet rewards: 0xA54b44C7a894AA19C49734A753D01f9B8C5f6516\n\nReviewed Sepolia lacked builder attribution. Mainnet source/ABI includes it; an explorer read reported builderRewardBps() = 1500. Reverify compatibility and current settings; the rate can change.\n\nRecord chain/block, bytecode, ABIs and pool/rewards/token/randomness bindings. Verify the transfer helper, Permit2, distributor/deposit permissions and liquidity. Prove router builder attribution as immediate acquire caller, with round vaults retaining purchaser rights.\n\nReplace the Sepolia-only restriction with validated network configuration: chain ID, dependencies, coordinator, key hash and subscription. Fail closed on wrong chains/incompatible dependencies. Separate production and test-only simulation.\n\nRead live quotes, VRF charges, gas-price assumptions, slippage limits and settlement windows. Do not hardcode 0.06 ETH pulls or source defaults.\n\nTEST COMPLETE LIFECYCLES AND FAILURE PATHS\n\nRun existing tests and add pinned mainnet-fork tests using deployed FWA code unchanged. Record commands/RPC requirements; disclose fork-only balances, impersonation and oracle simulation.\n\nCover both games: tickets -> FWA requests -> allocation -> ETH/NFT settlement -> draw -> finalization -> claims. Verify real builder allowance accounting, eligible acquisition/settlement credits, reward purchase, transfer-helper queueing and next-block treasury delivery. Test purchaser rewards separately.\n\nRequired coverage:\n\nETH prize splits, duplicate winning tickets, no-winner rollover and rounding dust.\n\nNFT single winner, multiwinner tie-break, rollover and bounded delivery/recovery.\n\nFailed/expired acquisitions, immediate/deferred refunds, stale/slipping quotes, unavailable inventory, delayed allocation and missed settlement windows.\n\nCross-round isolation, conservation of funds/inventory, locked liabilities, correct fee accounting and prevention of operator withdrawal of prizes/refunds/purchaser rewards.\n\nNumber validation/canonical ordering, quick-pick/draw sampling bias, bonus independence, cutoff boundaries and immutable terms for sold tickets.\n\nUnauthorized, duplicate, delayed and out-of-order VRF callbacks; request-to-round binding and separate tie-break requests.\n\nReentrancy, reverting recipients, NFT receiver failures, unauthorized administration, paused paths and changed dependency/helper permissions.\n\nLarge ticket/inventory counts: demonstrate bounded gas and progress without processing every ticket in one transaction.\n\nForks receive no automatic live Chainlink callbacks. Document test-only fulfillment for FWA and lottery VRF. Separately test lottery VRF on Sepolia with controlled FWA test dependencies and the real coordinator if test funding/access exists. Otherwise deliver scripts, exact prerequisites and a NOT RUN result. Never label simulation as live VRF verification.\n\nReview lockups from permanent VRF failure, pending acquisitions and missed settlement windows. Document fair recovery options; prohibit discretionary rerolls, winner replacement and post-sale rule changes.\n\nPREPARE DEPLOYMENT AND OPERATIONS\n\nDeliver build/deployment rehearsals, owner/treasury inputs, dependency order, factory binding, router setup, company VRF subscription/consumer setup and funding/preflight checks. Sales default to disabled.\n\nSeparate mainnet/Sepolia/fork artifacts. Check current IMD rules: a continuation may update code without redeploying or retargeting the parked Sepolia launch. Document the supported mainnet route and any new launch/platform action required.\n\nProvide keeper/operations scripts and a runbook for acquisitions, allocation processing, timely settlement, closing rounds, randomness requests, finalization and reward claims. Specify permissions, funding, monitoring and safe retries.\n\nDELIVER EVIDENCE\n\nCommit fixes/tests to the existing project and summarize the changes. Update dependency records, test reports, manifests, ABIs, events and configuration schemas. Leave undeployed addresses null and label simulated/example artifacts.\n\nReport:\n\nRoot cause, fix, files changed and protected-gate status.\n\nExact commands and passed/failed/skipped test counts.\n\nMainnet fork block/dependencies and real vs simulated oracle coverage.\n\nGas/scaling results and supported deployment procedure.\n\nRemaining blockers, each with the exact external input/action required.\n\nComplete all unblocked work. Distinguish verified, unrun and blocked steps. State readiness for independent security review/deployment rehearsal; passing tests is not an audit or approval for public sales.","baseCommit":"b06997d42012b7ad7ffe943b3acdd816b2092c4e","state":"completed","createdAt":"2026-10-08T04:15:44.059Z"}]},"deliver":true,"host":false,"site":null,"launch":{"requested":false,"kind":null,"id":null,"status":null,"chainId":null},"oracleRequestId":null,"delivery":{"repoUrl":"https://github.com/identity-md-launches/launch-961-build-sorphera-smart-contracts","pullRequestUrl":"https://github.com/identity-md-launches/launch-961-build-sorphera-smart-contracts/pull/2","commit":"6a6b3e57adcbfac8063aaa0d734c055c4fcff940","deliveredAt":"2026-10-08T05:01:31.156Z","media":null},"media":null,"nodes":[{"key":"build_contract_project","role":"implement","state":"accepted","attempt":1,"revisions":0,"judgeRevisions":0,"dependsOn":[],"allowedPaths":[],"failureReason":null,"dispatchNote":null,"dispatchNoteAt":null,"updatedAt":"2026-10-08T05:00:57.663Z","verdict":{"status":"accepted","profile":"foundry","evaluation":"checks","rejectionCode":null,"detail":"all checks passed","verifierVersion":"0.1.0+ad90ce4c","verifiedTreeHash":"aeab25608608f7786b37314529eeec51c4c3982c","at":"2026-10-08T05:00:57.665Z","failedChecks":[]},"seat":{"tokenId":"1799","agentId":"52208"},"live":null}],"reviews":[{"status":"queued","chainId":1,"txHash":null,"blockNumber":null,"sentAt":null,"entries":[{"nodeKey":"build_contract_project","agentId":"52208","value":1,"role":"verification:checks"}]}]}