Skip to content

Commit 21becf4

Browse files
authored
Merge pull request #14162 from CryptoDelirium/dev
Add smart contract quiz fixes #13776
2 parents 56bf296 + 2a3a3e7 commit 21becf4

File tree

7 files changed

+69
-8
lines changed

7 files changed

+69
-8
lines changed

public/content/smart-contracts/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,7 @@ They can perform computations, create currency, store data, mint [NFTs](/glossar
8484
- [Smart contracts for developers](/developers/docs/smart-contracts/)
8585
- [Learn to write smart-contracts](/developers/learning-tools/)
8686
- [Mastering Ethereum - What is a Smart Contract?](https://github.com/ethereumbook/ethereumbook/blob/develop/07smart-contracts-solidity.asciidoc#what-is-a-smart-contract)
87+
88+
<Divider />
89+
90+
<QuizWidget quizKey="smart-contracts" />

src/components/FeedbackWidget/FixedDot.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const FixedDot = forwardRef<HTMLButtonElement, FixedDotProps>(
4444
>
4545
<span
4646
className={cn(
47-
"line-clamp-2 hidden h-full items-center font-bold text-white leading-5",
47+
"line-clamp-2 hidden h-full items-center font-bold leading-5 text-white",
4848
isExpanded && "lg:flex"
4949
)}
5050
>

src/components/Quiz/stories/QuizzesStats.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const meta = {
2121
web3: [false, 0],
2222
daos: [false, 0],
2323
stablecoins: [false, 0],
24+
"smart-contracts": [false, 0],
2425
defi: [false, 0],
2526
gas: [false, 0],
2627
},

src/data/quizzes/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ const quizzes = {
102102
title: "DeFi",
103103
questions: ["defi-1", "defi-2", "defi-3", "defi-4", "defi-5"],
104104
},
105+
"smart-contracts": {
106+
title: "smart-contracts",
107+
questions: [
108+
"smart-contracts-1",
109+
"smart-contracts-2",
110+
"smart-contracts-3",
111+
"smart-contracts-4",
112+
],
113+
},
105114
} satisfies RawQuizzes
106115

107116
const ethereumBasicsQuizzesRaw: QuizzesSection[] = [
@@ -125,6 +134,10 @@ const ethereumBasicsQuizzesRaw: QuizzesSection[] = [
125134
id: "security",
126135
level: "beginner",
127136
},
137+
{
138+
id: "smart-contracts",
139+
level: "beginner",
140+
},
128141
]
129142
export const ethereumBasicsQuizzes: QuizzesSection[] = addNextQuiz(
130143
ethereumBasicsQuizzesRaw

src/data/quizzes/questionBank.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ const questionBankConfig: QuestionBankConfig = {
159159
{ totalAnswers: 4, correctAnswer: 4 },
160160
{ totalAnswers: 4, correctAnswer: 1 },
161161
],
162+
"smart-contracts": [
163+
{ totalAnswers: 4, correctAnswer: 3 },
164+
{ totalAnswers: 4, correctAnswer: 2 },
165+
{ totalAnswers: 4, correctAnswer: 4 },
166+
{ totalAnswers: 4, correctAnswer: 2 },
167+
],
162168
}
163169

164170
const charFromIdx = (idx: number) => String.fromCharCode(97 + idx)

src/intl/en/learn-quizzes.json

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,5 +658,41 @@
658658
"defi-5-c-label": "Bitcoin",
659659
"defi-5-c-explanation": "This is incorrect. Bitcoin is a simple network for storing value, not for running advanced programs. DeFi requires a more flexible system, like Ethereum, that can run complex programs to handle loans and trades automatically.",
660660
"defi-5-d-label": "Traditional financial institutions",
661-
"defi-5-d-explanation": "This is incorrect. DeFi apps don’t need traditional financial institutions. They use blockchain programs called smart contracts to handle transactions automatically."
662-
}
661+
"defi-5-d-explanation": "This is incorrect. DeFi apps don’t need traditional financial institutions. They use blockchain programs called smart contracts to handle transactions automatically.",
662+
"smart-contracts-1-prompt": "How are smart contracts characterized?",
663+
"smart-contracts-1-a-label": "Smart contracts are just like legal contracts, but stored digitally on the blockchain to save the content securely.",
664+
"smart-contracts-1-a-explanation": "Smart contracts use a similar logic to traditional contracts, but otherwise have little in common.",
665+
"smart-contracts-1-b-label": "Linked to autonomous AI systems that execute transactions",
666+
"smart-contracts-1-b-explanation": "Smart contracts execute transactions predictably according to 'if-this-then-that' logic prescribed in the code—they do not use AI",
667+
"smart-contracts-1-c-label": "Onchain programs following 'if-this-then-that' logic, guaranteed to execute according to its own rules",
668+
"smart-contracts-1-c-explanation": "A smart contract is an Ethereum account deployed with unchangeable code that determines its functionality.",
669+
"smart-contracts-1-d-label": "They are the rules behind the Ethereum Blockchain, developed together with lawyers to ensure legal compliance.",
670+
"smart-contracts-1-d-explanation": "Smart contracts are pieces of code that can be created by developers and deployed on a blockchain.",
671+
"smart-contracts-2-prompt": "What is a metaphor that most closely characterizes the functioning of smart contracts?",
672+
"smart-contracts-2-a-label": "A bank",
673+
"smart-contracts-2-a-explanation": "Banks require manual execution and are structured as hierarchical entities, whereas smart contracts are executed predictable by computers with unchangeable rules.",
674+
"smart-contracts-2-b-label": "A digital vending machine",
675+
"smart-contracts-2-b-explanation": "The vending machine will only dispense your desired product after all requirements are met: specific inputs guarantee deterministic outputs. This is similar to the logic of smart contracts.",
676+
"smart-contracts-2-c-label": "A calculator",
677+
"smart-contracts-2-c-explanation": "Smart contract code can be used for calculations, but is not limited to that. Rather, smart contracts are blockchain-based programs that follow 'if-this-then-that' logic.",
678+
"smart-contracts-2-d-label": "A website",
679+
"smart-contracts-2-d-explanation": "A website is the frontend which captures user directions. A smart contract is the backend logic where these directions are executed, and the result may be returned.",
680+
"smart-contracts-3-prompt": "Which is NOT a main characteristic of smart contracts?",
681+
"smart-contracts-3-a-label": "Deterministic execution",
682+
"smart-contracts-3-a-explanation": "The main benefit of a smart contract is that it deterministically executes unambiguous code, without human interpretation or bias.",
683+
"smart-contracts-3-b-label": "Public record",
684+
"smart-contracts-3-b-explanation": "With smart contracts on a public blockchain, anyone can instantly track asset transfers and other related information.",
685+
"smart-contracts-3-c-label": "Privacy protection",
686+
"smart-contracts-3-c-explanation": "As blockchains are pseudonymous networks, transactions are tied publicly to a unique cryptographic address, not an identity.",
687+
"smart-contracts-3-d-label": "Ability to change",
688+
"smart-contracts-3-d-explanation": "A smart contract cannot be changed once created—it is guaranteed to execute according to the rules defined by its code.",
689+
"smart-contracts-4-prompt": "Which is NOT an application of smart contracts?",
690+
"smart-contracts-4-a-label": "Stablecoins",
691+
"smart-contracts-4-a-explanation": "Stablecoins are token objects which are defined and tracked using smart contracts.",
692+
"smart-contracts-4-b-label": "Protocol changes",
693+
"smart-contracts-4-b-explanation": "While protocol changes can sometimes use smart contracts, their creation and definition are proposed through transparent online forums and implemented in client software.",
694+
"smart-contracts-4-c-label": "Non-fungible tokens (NFTs)",
695+
"smart-contracts-4-c-explanation": "Smart contracts are used to define a wide range of NFTs, ranging from digital art to asset ownership certificates.",
696+
"smart-contracts-4-d-label": "Open currency exchange",
697+
"smart-contracts-4-d-explanation": "Decentralized exchanges (DEXs) are build using smart contracts to operate without centralized control."
698+
}

src/lib/utils/translations.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,22 +231,23 @@ const getRequiredNamespacesForPath = (relativePath: string) => {
231231
// Quizzes
232232
// Note: Add any URL paths that have quizzes here
233233
if (
234+
path.startsWith("/defi/") ||
234235
path.startsWith("/eth/") ||
236+
path.startsWith("/gas/") ||
235237
path.startsWith("/layer-2/") ||
236238
path.startsWith("/layer-2/learn/") ||
237239
path.startsWith("/nft/") ||
240+
path.startsWith("/quizzes/") ||
238241
path.startsWith("/roadmap/merge/") ||
239242
path.startsWith("/roadmap/scaling/") ||
240243
path.startsWith("/run-a-node/") ||
241244
path.startsWith("/security/") ||
245+
path.startsWith("/smart-contracts/") ||
246+
path.startsWith("/stablecoins/") ||
242247
path.startsWith("/staking/solo/") ||
243248
path.startsWith("/wallets/") ||
244249
path.startsWith("/web3/") ||
245-
path.startsWith("/what-is-ethereum/") ||
246-
path.startsWith("/quizzes/") ||
247-
path.startsWith("/stablecoins/") ||
248-
path.startsWith("/defi/") ||
249-
path.startsWith("/gas/")
250+
path.startsWith("/what-is-ethereum/")
250251
) {
251252
requiredNamespaces = [...requiredNamespaces, "learn-quizzes"]
252253
}

0 commit comments

Comments
 (0)