|
| 1 | +export interface ConversationStarter { |
| 2 | + question: string; |
| 3 | + level: 'beginner' | 'intermediate' | 'expert'; |
| 4 | + category: string; |
| 5 | +} |
| 6 | + |
| 7 | +export const CONVERSATION_STARTERS: ConversationStarter[] = [ |
| 8 | + // Beginner Level (20 Questions) |
| 9 | + { question: "", level: "beginner", category: "programming" }, |
| 10 | + { question: "How to use blob storage?", level: "beginner", category: "Solidity" }, |
| 11 | + { question: "What is the difference between storage, memory, and calldata in Solidity?", level: "beginner", category: "Solidity" }, |
| 12 | + { question: "How are dynamic arrays stored in contract storage?", level: "beginner", category: "Solidity" }, |
| 13 | + { question: "How does delegatecall differ from call? ", level: "beginner", category: "Solidity" }, |
| 14 | + { question: "How to avoid using dynamic array in Solidity?", level: "beginner", category: "Solidity" }, |
| 15 | + { question: "List some gas saving techniques", level: "beginner", category: "Solidity" }, |
| 16 | + { question: "How do NFTs work?", level: "beginner", category: "blockchain" }, |
| 17 | + { question: "Debugging strategies?", level: "beginner", category: "development" }, |
| 18 | + |
| 19 | + // Intermediate Level (20 Questions) |
| 20 | + { question: "What’s a Uniswap hook?", level: "intermediate", category: "DeFi" }, |
| 21 | + { question: "How to use 1inch?", level: "intermediate", category: "DeFi" }, |
| 22 | + { question: "Show a contract that includes a flash loan", level: "intermediate", category: "DeFi" }, |
| 23 | + { question: "Show a smart contract that records carbon credits", level: "intermediate", category: "blockchain" }, |
| 24 | + { question: "Show a sybil-resistant voting contract", level: "intermediate", category: "programming" }, |
| 25 | + |
| 26 | + // Expert Level (20 Questions) |
| 27 | + { question: "Account abstraction impact on UX?", level: "expert", category: "blockchain" }, |
| 28 | + { question: "MEV protection strategies?", level: "expert", category: "DeFi" }, |
| 29 | + { question: "ZK-rollups vs optimistic rollups?", level: "expert", category: "blockchain" }, |
| 30 | + { question: "Formal verification tools worth it?", level: "expert", category: "development" }, |
| 31 | + { question: "What is the power of tau?", level: "expert", category: "ZK" }, |
| 32 | + { question: "Groth16 vs Plonk?", level: "expert", category: "ZK" }, |
| 33 | + { question: "Cross-chain messaging protocols?", level: "expert", category: "blockchain" }, |
| 34 | + { question: "EIP-4844 blob space economics?", level: "expert", category: "blockchain" }, |
| 35 | + { question: "Restaking security assumptions?", level: "expert", category: "blockchain" }, |
| 36 | + { question: "AI-assisted smart contract auditing?", level: "expert", category: "development" }, |
| 37 | + { question: "Maximal extractable value mitigation?", level: "expert", category: "blockchain" }, |
| 38 | + { question: "Explain a witness in a ZK circuit", level: "expert", category: "ZK" }, |
| 39 | + { question: "Explain a rate limiting nullifier", level: "expert", category: "blockchain" }, |
| 40 | + { question: "Proto-danksharding readiness?", level: "expert", category: "blockchain" }, |
| 41 | + { question: "Homomorphic encryption in web3?", level: "expert", category: "blockchain" }, |
| 42 | + { question: "Explain the UUPS upgradeable contract", level: "expert", category: "blockchain" }, |
| 43 | + { question: "Explain the Diamond Pattern", level: "expert", category: "blockchain" }, |
| 44 | + { question: "Explain an underflow in Solidity", level: "expert", category: "blockchain" }, |
| 45 | + { question: "What are some tools that can help with security?", level: "expert", category: "blockchain" }, |
| 46 | + { question: "Explain the Transparent upgradeable contract", level: "expert", category: "blockchain" }, |
| 47 | + { question: "What the difference between an ERC and an EIP?", level: "expert", category: "blockchain" }, |
| 48 | + { question: "How to work with EIP 7702?", level: "expert", category: "blockchain" }, |
| 49 | + { question: "How to work a EIP 4337 Smart Account", level: "expert", category: "blockchain" }, |
| 50 | +]; |
| 51 | + |
| 52 | +/** |
| 53 | + * Randomly samples one question from each difficulty level |
| 54 | + * @returns An array of 3 conversation starters (beginner, intermediate, expert) |
| 55 | + */ |
| 56 | +export function sampleConversationStarters(): ConversationStarter[] { |
| 57 | + const beginnerQuestions = CONVERSATION_STARTERS.filter(q => q.level === 'beginner'); |
| 58 | + const intermediateQuestions = CONVERSATION_STARTERS.filter(q => q.level === 'intermediate'); |
| 59 | + const expertQuestions = CONVERSATION_STARTERS.filter(q => q.level === 'expert'); |
| 60 | + |
| 61 | + const randomBeginner = beginnerQuestions[Math.floor(Math.random() * beginnerQuestions.length)]; |
| 62 | + const randomIntermediate = intermediateQuestions[Math.floor(Math.random() * intermediateQuestions.length)]; |
| 63 | + const randomExpert = expertQuestions[Math.floor(Math.random() * expertQuestions.length)]; |
| 64 | + |
| 65 | + return [randomBeginner, randomIntermediate, randomExpert]; |
| 66 | +} |
| 67 | + |
| 68 | +/** |
| 69 | + * Gets conversation starters with seeded randomization for consistent results in same session |
| 70 | + * @param seed Optional seed for reproducible randomization |
| 71 | + * @returns An array of 3 conversation starters (beginner, intermediate, expert) |
| 72 | + */ |
| 73 | +export function sampleConversationStartersWithSeed(seed?: number): ConversationStarter[] { |
| 74 | + const seededRandom = (seedValue: number) => { |
| 75 | + const x = Math.sin(seedValue) * 10000; |
| 76 | + return x - Math.floor(x); |
| 77 | + }; |
| 78 | + |
| 79 | + const actualSeed = seed ?? Date.now(); |
| 80 | + const beginnerQuestions = CONVERSATION_STARTERS.filter(q => q.level === 'beginner'); |
| 81 | + const intermediateQuestions = CONVERSATION_STARTERS.filter(q => q.level === 'intermediate'); |
| 82 | + const expertQuestions = CONVERSATION_STARTERS.filter(q => q.level === 'expert'); |
| 83 | + |
| 84 | + const randomBeginner = beginnerQuestions[Math.floor(seededRandom(actualSeed) * beginnerQuestions.length)]; |
| 85 | + const randomIntermediate = intermediateQuestions[Math.floor(seededRandom(actualSeed + 1) * intermediateQuestions.length)]; |
| 86 | + const randomExpert = expertQuestions[Math.floor(seededRandom(actualSeed + 2) * expertQuestions.length)]; |
| 87 | + |
| 88 | + return [randomBeginner, randomIntermediate, randomExpert]; |
| 89 | +} |
| 90 | + |
0 commit comments