Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Learn page on Wrapped Ether (WETH) #8203

Merged
merged 55 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
d14eb8f
Add Learn page on Wrapped Ether (WETH)
emmanuel-awosika Oct 7, 2022
e0bcc0b
Update wrapped-ether.md
emmanuel-awosika Oct 12, 2022
80af2a0
Update wrapped-ether.md
emmanuel-awosika Nov 7, 2022
4329da8
Apply suggestions from code review
emmanuel-awosika Dec 21, 2022
8bbc8db
Update wrapped-ether.md
emmanuel-awosika Dec 21, 2022
f3aa7a2
Update src/content/wrapped-ether.md
emmanuel-awosika Dec 21, 2022
06c641e
Added info about formal verification of WETH
emmanuel-awosika Dec 21, 2022
be4824a
Update wrapped-ether.md
emmanuel-awosika Dec 31, 2022
36dd02f
Update WETH page based on feedback
emmanuel-awosika Feb 17, 2023
d80a252
Update wrapped-ether.md
emmanuel-awosika Feb 20, 2023
c231284
Update wrapped-ether.md
emmanuel-awosika Feb 21, 2023
8db2c41
Update wrapped-ether.md
emmanuel-awosika Feb 21, 2023
d989438
Apply suggestions from code review
emmanuel-awosika Feb 22, 2023
752eec6
Update wrapped-ether.md
emmanuel-awosika Feb 22, 2023
603dcae
Update wrapped-ether.md
emmanuel-awosika Feb 22, 2023
b330f22
Update wrapped-ether.md
emmanuel-awosika Feb 22, 2023
8d47382
Merge branch 'dev' into pr/emmanuel-awosika/8203
corwintines Aug 15, 2023
8bce1fd
Merge branch 'dev' into pr/emmanuel-awosika/8203
corwintines Jan 26, 2024
f965106
Merge branch 'dev' into pr/emmanuel-awosika/8203
corwintines Mar 11, 2024
4e2acf6
setup wrapped-ether page in new repo structure
corwintines Mar 11, 2024
222732c
rework weth intro
corwintines Mar 13, 2024
3cb77f8
edits
corwintines Mar 18, 2024
dd6324d
Update public/content/wrapped-ether/index.md
wackerow Mar 18, 2024
7e6c477
Update public/content/wrapped-ether/index.md
corwintines Mar 21, 2024
d7aa8ff
Update public/content/wrapped-ether/index.md
corwintines Mar 21, 2024
20568d6
Update public/content/wrapped-ether/index.md
corwintines Mar 21, 2024
8a8ced9
Update public/content/wrapped-ether/index.md
corwintines Mar 21, 2024
fc62e46
Update public/content/wrapped-ether/index.md
corwintines Mar 21, 2024
240f085
Update public/content/wrapped-ether/index.md
corwintines Mar 21, 2024
00096ae
Update public/content/wrapped-ether/index.md
corwintines Mar 21, 2024
07220fa
Update public/content/wrapped-ether/index.md
corwintines Mar 21, 2024
2e4ab92
Update public/content/wrapped-ether/index.md
corwintines Mar 21, 2024
9cbc2cd
Update public/content/wrapped-ether/index.md
corwintines Mar 21, 2024
59a6cb8
Update public/content/wrapped-ether/index.md
corwintines Mar 21, 2024
5f4348b
Glossary use
corwintines Mar 21, 2024
8810d72
copy fixes
corwintines Mar 21, 2024
76eb2b1
wrapped-ether -> wrapped-eth
corwintines Mar 21, 2024
0f874e4
change requests
corwintines Mar 21, 2024
f501195
Merge branch 'dev' into weth-edit
corwintines Mar 21, 2024
1ac0a02
reword
corwintines Mar 21, 2024
4c14665
fix broken element
corwintines Mar 21, 2024
764c469
change requests
corwintines Mar 21, 2024
2f8d017
change requests
corwintines Mar 21, 2024
6cc21c6
remove further reading articles
corwintines Mar 21, 2024
16a9fa5
Merge branch 'dev' into pr/8203
wackerow Mar 22, 2024
b222922
Merge branch 'dev' into weth-edit
wackerow Mar 22, 2024
f5038db
chore: rename to wrapped-eth
wackerow Mar 22, 2024
0668dfb
Merge branch 'weth-edit' into pr/8203
wackerow Mar 22, 2024
df16dc5
Merge branch 'dev' into pr/emmanuel-awosika/8203
corwintines Mar 25, 2024
3191a11
wording around conversion
corwintines Mar 25, 2024
a6246d1
Add other networks contracts FAQ
corwintines Mar 25, 2024
6747394
Add content to link out to /wrapped-eth page
corwintines Mar 26, 2024
8e65124
chore: defi capitalization, linting
wackerow Mar 26, 2024
2bcb9c6
fix: use Translation component for htmr strings
wackerow Mar 26, 2024
718399c
fix: markdown whitespace syntax
wackerow Mar 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions public/content/defi/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ You can think of DeFi in layers:
3. The protocols – [smart contracts](/glossary/#smart-contract) that provide the functionality, for example, a service that allows for decentralized lending of assets.
4. [The applications](/dapps/) – the products we use to manage and access the protocols.

Note: much of DeFi uses the [ERC-20 standard](/glossary/#erc-20). Applications in DeFi use a wrapper for ETH called Wrapped Ether (WETH). [Learn more about wrapped ether](/wrapped-eth).

## Build DeFi {#build-defi}

DeFi is an open-source movement. The DeFi protocols and applications are all open for you to inspect, fork, and innovate on. Because of this layered stack (they all share the same base blockchain and assets), protocols can be mixed and matched to unlock unique combo opportunities.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ Tokens can represent virtually anything in Ethereum:

- reputation points in an online platform
- skills of a character in a game
- lottery tickets
- financial assets like a share in a company
- a fiat currency like USD
- an ounce of gold
- and more...

Such a powerful feature of Ethereum must be handled by a robust standard, right? That's exactly
where the ERC-20 plays its role! This standard allows developers to build token applications that are interoperable with other products and services.
where the ERC-20 plays its role! This standard allows developers to build token applications that are interoperable with other products and services. The ERC-20 standard is also used to provide additional functionality to [ether](/glossary/#ether).

**What is ERC-20?**

Expand Down
64 changes: 64 additions & 0 deletions public/content/wrapped-eth/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: What is Wrapped Ether (WETH)
description: An introduction to Wrapped ether (WETH)—an ERC20-compatible wrapper for ether (ETH).
lang: en
---

# Wrapped ether (WETH) {#intro-to-weth}

Ether (ETH) is the main currency of Ethereum. It's used for several purposes like staking, as a currency, and paying for gas fees for computation. **WETH is effectively an upgraded form of ETH with some additional functionality required by many applications and [ERC-20 tokens](/glossary/#erc-20)**, which are other types of digital assets on Ethereum. To work with these tokens, ETH must follow the same rules they do, known as the ERC-20 standard.

To bridge this gap, wrapped ETH (WETH) was created. **Wrapped ETH is a smart contract that lets you deposit any amount of ETH into the contract and receive the same amount in minted WETH** that conforms to the ERC-20 token standard. WETH is a representation of ETH that allows you to interact with it as an ERC-20 token, not as the native asset ETH. You will still need native ETH to pay for gas fees, so make sure you save some when depositing.

You are able to unwrap WETH for ETH by using the WETH smart contract. You can redeem any amount of WETH with the WETH smart contract, and you will receive the same amount in ETH. The WETH deposited is then burned and taken out of the circulating supply of WETH.

**Roughly ~3% of the circulating ETH supply is locked in the WETH token contract** making it one of the most used [smart contracts](/glossary/#smart-contract). WETH is especially important with users interacting with applications in decentralized finance (DeFi).

## Why do we need to wrap ETH as an ERC-20? {#why-do-we-need-to-wrap-eth}

[ERC-20](/developers/docs/standards/tokens/erc-20/) defines a standard interface for transferable tokens, so anyone can create tokens that interact seamlessly with applications and tokens that use this standard in Ethereum's ecosystem. Since **ETH predates the ERC-20 standard**, ETH doesn't conform to this specification. This means **you can't easily** exchange ETH for other ERC-20 tokens or **use ETH in apps using the ERC-20 standard**. Wrapping ETH gives you the opportunity to do the following:

- **Exchange ETH for ERC-20 tokens**: You cannot exchange ETH directly for other ERC-20 tokens. WETH is a representation of ether that complies with the ERC-20 fungible token standard and can be exchanged with other ERC-20 tokens.

- **Use ETH in dapps**: Because ETH isn’t ERC20-compatible, developers would need to create separate interfaces (one for ETH and another for ERC-20 tokens) in dapps. Wrapping ETH removes this obstacle and enables developers to handle ETH and other tokens within the same dapp. Many decentralized finance applications use this standard, and create markets for exchanging these tokens.

## Wrapped ether (WETH) vs ether (ETH): What is the difference? {#weth-vs-eth-differences}


| | **Ether (ETH)** | **Wrapped Ether (WETH)** |
|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Supply | The supply of ETH is managed by the Ethereum protocol. The [issuance](/roadmap/merge/issuance) of ETH is handled by Ethereum validators when processing transactions and creating blocks. | WETH is an ERC-20 token whose supply is managed by a smart contract. New units of WETH are issued by the contract after it receives ETH deposits from users, or units of WETH are burned when a user wishes to redeem WETH for ETH. |
| Ownership | Ownership is managed by the Ethereum protocol through your account balance. | Ownership of WETH is managed by the WETH token smart contract, secured by the Ethereum protocol. |
| Gas | Ether (ETH) is the accepted unit of payment for computation on the Ethereum network. Gas fees are denominated in gwei (a unit of ether). | Paying gas with WETH tokens is not natively supported. |

## Frequently asked questions {#faq}

<ExpandableCard title="Do you pay to wrap/unwrap ETH?" eventCategory="/wrapped-eth" eventName="clicked Do you pay to wrap/unwrap ETH?">

You pay gas fees to wrap or unwrap ETH using the WETH contract.

</ExpandableCard>

<ExpandableCard title="Is WETH safe?" eventCategory="/wrapped-eth" eventName="clicked Is WETH safe?">

WETH is generally considered secure because it is based on a simple, battle-tested smart contract. The WETH contract has also beeen formally verified, which is the highest security standard for smart contracts on Ethereum.

</ExpandableCard>

<ExpandableCard title="Why am I seeing different WETH tokens?" eventCategory="/wrapped-eth" eventName="clicked Why am I seeing different WETH tokens?">

Besides the [canonical implementation of WETH](https://etherscan.io/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) described on this page, there are other variants in the wild. These may be custom tokens created by app developers or versions issued on other blockchains, and may behave differently or have different security properties. **Always double-check the token information to know which WETH implementation you're interacting with.**

</ExpandableCard>

<ExpandableCard title="What are the WETH contracts on other networks?" eventCategory="/wrapped-eth" eventName="clicked What are the WETH contracts on other networks?">
- [Ethereum Mainnet](https://etherscan.io/token/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2)
- [Arbitrum](https://arbiscan.io/token/0x82af49447d8a07e3bd95bd0d56f35241523fbab1)
- [Optimism](https://optimistic.etherscan.io/token/0x4200000000000000000000000000000000000006)
</ExpandableCard>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting we could potentially use https://tkn.xyz/weth in the future


## Further reading {#further-reading}

- [WTF is WETH?](https://weth.io/)
- [WETH token information on Etherscan](https://etherscan.io/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)
- [Formal Verification of WETH](https://zellic.io/blog/formal-verification-weth)
1 change: 1 addition & 0 deletions src/intl/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@
"what-is-ether": "What is ether (ETH)?",
"what-is-ethereum": "What is Ethereum?",
"withdrawals": "Staking withdrawals",
"wrapped-ether": "Wrapped Ether",
"yes": "Yes",
"zero-knowledge-proofs": "Zero-knowledge proofs"
}
1 change: 1 addition & 0 deletions src/intl/en/page-eth.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"page-eth-underpins": "ETH underpins the Ethereum financial system",
"page-eth-underpins-desc": "Not satisfied with payments, the Ethereum community is building a whole financial system that's <a href=\"/glossary/#peer-to-peer-network\">peer-to-peer</a> and accessible to everyone.",
"page-eth-underpins-desc-2": "You can use ETH as collateral to generate entirely different cryptocurrency tokens on Ethereum. Plus you can borrow, lend and earn interest on ETH and other ETH-backed tokens.",
"page-eth-weth": "Wrapped ether (WETH) is used to extend the functionality of ETH to work with other tokens and applications. <a href=\"/wrapped-eth\">Learn more about WETH</a>.",
wackerow marked this conversation as resolved.
Show resolved Hide resolved
"page-eth-uses": "Uses for ETH grow every day",
"page-eth-uses-desc": "Because Ethereum is programmable, developers can shape ETH in countless ways.",
"page-eth-uses-desc-2": "Back in 2015, all you could do was send ETH from one Ethereum account to another. Here are just some of things you can do today.",
Expand Down
1 change: 1 addition & 0 deletions src/intl/en/page-get-eth.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"page-get-eth-dexs-desc": "Decentralized exchanges are open marketplaces for ETH and other tokens. They connect buyers and sellers directly.",
"page-get-eth-dexs-desc-2": "Instead of using a trusted third party to safeguard funds in the transaction, they use code. The seller's ETH will only be transferred when payment is guaranteed. This type of code is known as a smart contract.",
"page-get-eth-dexs-desc-3": "This means there are fewer geographical restrictions than with centralized alternatives. If someone is selling what you want and accepting a payment method you can provide, you’re good to go.",
"page-get-eth-dexs-desc-4": "Note: many dexes use wrapped ether (WETH) to function. <a href=\"/wrapped-eth\">Learn more about wrapped ether</a>.",
"page-get-eth-do-not-copy": "Example: Do not copy",
"page-get-eth-exchanges-disclaimer": "We collected this information manually. If you spot something wrong, let us know at",
"page-get-eth-exchanges-empty-state-text": "Enter your country of residence to see a list of exchanges you may be able to use",
Expand Down
2 changes: 2 additions & 0 deletions src/layouts/Static.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import DevconGrantsBanner from "@/components/DevconGrantsBanner"
import EnergyConsumptionChart from "@/components/EnergyConsumptionChart"
import FeedbackCard from "@/components/FeedbackCard"
import GlossaryDefinition from "@/components/Glossary/GlossaryDefinition"
import GlossaryTooltip from "@/components/Glossary/GlossaryTooltip"
import { HubHero } from "@/components/Hero"
import NetworkUpgradeSummary from "@/components/History/NetworkUpgradeSummary"
import Link from "@/components/Link"
Expand Down Expand Up @@ -65,6 +66,7 @@ export const staticComponents = {
Contributors,
EnergyConsumptionChart,
GlossaryDefinition,
GlossaryTooltip,
Icon,
Link,
Logo,
Expand Down
6 changes: 5 additions & 1 deletion src/lib/utils/gh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ const getGitLogFromPath = (path: string): string => {

const extractDateFromGitLogInfo = (logInfo: string): string => {
// Filter commit date in log and return date using ISOString format (same that GH API uses)
const lastCommitDate = logInfo
try {
const lastCommitDate = logInfo
.split("\n")
.filter((x) => x.startsWith("Date: "))[0]
.slice("Date:".length)
.trim()
return new Date(lastCommitDate).toISOString()
} catch {
return new Date().toISOString()
}
}

// This util filters the git log to get the file last commit info, and then the commit date (last update)
Comment on lines 13 to 28
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [11-11]

Detected a potential security risk where user-controlled input (path) is passed directly to a shell command within getGitLogFromPath. This could lead to command injection if the input is not properly sanitized.

Consider validating or sanitizing the path parameter to ensure it does not contain shell metacharacters or use safer alternatives to execute shell commands that do not involve string concatenation.

Expand Down
1 change: 1 addition & 0 deletions src/lib/utils/md.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ const getPostSlugs = (dir: string, files: string[] = []) => {
"/terms-of-use",
"/web3",
"/whitepaper",
"/wrapped-eth",
"/zero-knowledge-proofs",
]

Expand Down
3 changes: 3 additions & 0 deletions src/pages/eth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ const EthPage = () => {
description={t("page-eth-whats-defi-description")}
image={defi}
/>
<InfoBanner isWarning>
<Translation id="page-eth:page-eth-weth" />
</InfoBanner>
</Box>
<TextDivider />
<Box>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/get-eth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import dapps from "@/public/doge-computer.png"
import oneinch from "@/public/exchanges/1inch.png"
import bancor from "@/public/exchanges/bancor.png"
import kyber from "@/public/exchanges/kyber.png"
import loopring from "@/public/exchanges/loopring.png"
import hero from "@/public/get-eth.png"
import wallet from "@/public/wallet.png"

Expand Down Expand Up @@ -367,6 +366,9 @@ const GetEthPage = ({
<ButtonLink href="/wallets/find-wallet/">
{t("page-get-eth-get-wallet-btn")}
</ButtonLink>
<InfoBanner isWarning>
<Translation id="page-get-eth:page-get-eth-dexs-desc-4" />
</InfoBanner>
</LeftColumn>
<RightColumn>
<OldHeading
Expand Down
Loading