Skip to content

Commit 774843b

Browse files
authored
Merge pull request #15254 from SupaMega24/Add_Learn_Quiz_Gas_Fees
Add learning quiz for gas fees [Fixes #14752]
2 parents 863ee48 + 46b6f25 commit 774843b

File tree

8 files changed

+70
-3
lines changed

8 files changed

+70
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@ src/data/crowdin/bucketsAwaitingReviewReport.csv
6060
# Storybook
6161
build-storybook.log
6262
storybook-static
63+

app/[locale]/gas/_components/gas.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { Image } from "@/components/Image"
1313
import InfoBanner from "@/components/InfoBanner"
1414
import MainArticle from "@/components/MainArticle"
1515
import PageHero from "@/components/PageHero"
16+
import { StandaloneQuizWidget } from "@/components/Quiz/QuizWidget"
1617
import Translation from "@/components/Translation"
1718
import { ButtonLink } from "@/components/ui/buttons/Button"
1819
import { Divider } from "@/components/ui/divider"
@@ -384,6 +385,9 @@ const GasPage = () => {
384385
</Callout>
385386
</Flex>
386387
</Content>
388+
<Content>
389+
<StandaloneQuizWidget quizKey="gas" />
390+
</Content>
387391
<Content>
388392
<FeedbackCard />
389393
</Content>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const meta = {
2222
daos: [false, 0],
2323
stablecoins: [false, 0],
2424
defi: [false, 0],
25+
gas: [false, 0],
2526
},
2627
totalCorrectAnswers: 0,
2728
},

src/data/quizzes/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ const quizzes = {
5353
title: "learn-quizzes:page-assets-merge",
5454
questions: ["merge-1", "merge-2", "merge-3", "merge-4", "merge-5"],
5555
},
56+
gas: {
57+
title: "gas",
58+
questions: ["gas-1", "gas-2", "gas-3", "gas-4", "gas-5"],
59+
},
5660
daos: {
5761
title: "DAOs",
5862
questions: ["daos-1", "daos-2", "daos-3", "daos-4", "daos-5"],
@@ -163,6 +167,10 @@ const usingEthereumQuizzesRaw: QuizzesSection[] = [
163167
id: "staking-solo",
164168
level: "advanced",
165169
},
170+
{
171+
id: "gas",
172+
level: "advanced",
173+
},
166174
]
167175

168176
export const usingEthereumQuizzes: QuizzesSection[] = addNextQuiz(

src/data/quizzes/questionBank.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ const questionBankConfig: QuestionBankConfig = {
107107
{ totalAnswers: 2, correctAnswer: 2 },
108108
{ totalAnswers: 4, correctAnswer: 2 },
109109
],
110+
gas: [
111+
{ totalAnswers: 4, correctAnswer: 4 },
112+
{ totalAnswers: 4, correctAnswer: 4 },
113+
{ totalAnswers: 4, correctAnswer: 1 },
114+
{ totalAnswers: 4, correctAnswer: 2 },
115+
{ totalAnswers: 4, correctAnswer: 2 },
116+
],
110117
daos: [
111118
{ totalAnswers: 4, correctAnswer: 4 },
112119
{ totalAnswers: 4, correctAnswer: 4 },

src/intl/en/learn-quizzes.json

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,51 @@
326326
"merge-5-c-explanation": "Eth1 was the original name given to the execution layer, not the consensus layer.",
327327
"merge-5-d-label": "Staking",
328328
"merge-5-d-explanation": "Staking is depositing ETH into a smart contract to help secure the chain.",
329+
"gas-1-prompt": "What are gas fees?",
330+
"gas-1-a-label": "A fee associated with transactions and smart contract operations",
331+
"gas-1-a-explanation": "Partially correct, gas fees represent the cost of transactions and smart contract operations.",
332+
"gas-1-b-label": "The amount of gas used to perform an operation, multiplied by the cost per unit of gas",
333+
"gas-1-b-explanation": "Partially correct. While true, it is not the best answer given the choices.",
334+
"gas-1-c-label": "A payment that includes a priority fee to potentially expedite transaction processing",
335+
"gas-1-c-explanation": "Partially correct, the total gas fee includes a base fee and a priority fee that can influence transaction processing speed",
336+
"gas-1-d-label": "All of the above",
337+
"gas-1-d-explanation": "Gas fees encompass all these aspects: they compensate for computation, apply to both transactions and smart contracts, and can include priority fees for faster inclusion.",
338+
"gas-2-prompt": "Which of the following is the LEAST effective strategy for reducing the cost of gas?",
339+
"gas-2-a-label": "Executing transactions during low-congestion periods",
340+
"gas-2-a-explanation": "Timing transactions during off-peak hours can lower gas costs.",
341+
"gas-2-b-label": "Waiting for gas prices to decrease",
342+
"gas-2-b-explanation": "Waiting for gas prices to decrease is a valid strategy since gas fluctuates based on congestion.",
343+
"gas-2-c-label": "Using layer 2 chains for lower fees",
344+
"gas-2-c-explanation": "Layer 2 solutions reduce fees and are an effective way to save on gas.",
345+
"gas-2-d-label": "Using complex smart contract logic that increases computational requirements",
346+
"gas-2-d-explanation": "Complex smart contract logic increases gas costs by requiring more computation. Efficient design minimizes steps, storage, and redundant operations to reduce fees.",
347+
"gas-3-prompt": "What causes gas fees to be high?",
348+
"gas-3-a-label": "Network computation exceeding a specific threshold",
349+
"gas-3-a-explanation": "When computation on Ethereum exceeds a threshold, gas fees increase, especially during high activity periods like dapps or NFT drops.",
350+
"gas-3-b-label": "Validators increasing the base fee manually",
351+
"gas-3-b-explanation": "Validators do not manually set base fees; they are adjusted by the protocol based on demand in previous block.",
352+
"gas-3-c-label": "Well-written, optimized smart contracts",
353+
"gas-3-c-explanation": "Well-written smart contract logic such as efficient use of storage and loops can lead to lower gas consumption.",
354+
"gas-3-d-label": "A lack of available ETH on the network",
355+
"gas-3-d-explanation": "Gas fees are not affected by the amount of ETH available on the network.",
356+
"gas-4-prompt": "How do gas fees help keep Ethereum secure?",
357+
"gas-4-a-label": "By incentivizing validators to act honestly",
358+
"gas-4-a-explanation": "Validators are compensated in a few ways, but gas fees primarily discourage spam and excessive resource use.",
359+
"gas-4-b-label": "By disincentivizing spam and malicious activity with financial costs",
360+
"gas-4-b-explanation": "Gas fees make spam or malicious activity expensive, preventing abuse and helping maintain network stability.",
361+
"gas-4-c-label": "By ensuring transactions are processed in order of priority",
362+
"gas-4-c-explanation": "Priority can be determined by the tip, not the gas fees themselves.",
363+
"gas-4-d-label": "By increasing the total amount of ETH in circulation",
364+
"gas-4-d-explanation": "The base fee (part of the total gas fee) is burned, reducing ETH in circulation, not increasing it",
365+
"gas-5-prompt": "How are gas fees calculated?",
366+
"gas-5-a-label": "Gas price × transaction size",
367+
"gas-5-a-explanation": "Gas fees are based on computation, not transaction size.",
368+
"gas-5-b-label": "Units of gas used × (base fee + priority fee)",
369+
"gas-5-b-explanation": "Gas fees are determined using the formula: units of gas used × (base fee + priority fee).",
370+
"gas-5-c-label": "Block size × validator tip cap",
371+
"gas-5-c-explanation": "Block size does not directly factor into this formula.",
372+
"gas-5-d-label": "Base fee + priority fee + tip",
373+
"gas-5-d-explanation": "The base fee and priority fee are part of the formula; the tip is the priority fee.",
329374
"daos-1-prompt": "What is true about DAOs?",
330375
"daos-1-a-label": "DAOs are collectively owned via governance tokens",
331376
"daos-1-a-explanation": "DAOs are collectively owned, but that’s not the only correct statement.",
@@ -614,4 +659,4 @@
614659
"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.",
615660
"defi-5-d-label": "Traditional financial institutions",
616661
"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."
617-
}
662+
}

src/intl/en/page-learn.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,4 @@
121121
"unchained-description": "Dives deep into the people building the decentralized internet, the details of this technology that could underpin our future, and some of the thorniest topics in crypto, such as regulation, security and privacy",
122122
"the-daily-gwei-title": "The Daily Gwei",
123123
"the-daily-gwei-description": "Ethereum news recaps, updates and analysis"
124-
}
124+
}

src/lib/utils/translations.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ const getRequiredNamespacesForPath = (relativePath: string) => {
229229
path.startsWith("/what-is-ethereum/") ||
230230
path.startsWith("/quizzes/") ||
231231
path.startsWith("/stablecoins/") ||
232-
path.startsWith("/defi/")
232+
path.startsWith("/defi/") ||
233+
path.startsWith("/gas/")
233234
) {
234235
requiredNamespaces = [...requiredNamespaces, "learn-quizzes"]
235236
}

0 commit comments

Comments
 (0)