-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Changes from 54 commits
d14eb8f
e0bcc0b
80af2a0
4329da8
8bbc8db
f3aa7a2
06c641e
be4824a
36dd02f
d80a252
c231284
8db2c41
d989438
752eec6
603dcae
b330f22
8d47382
8bce1fd
f965106
4e2acf6
222732c
3cb77f8
dd6324d
7e6c477
d7aa8ff
20568d6
8a8ced9
fc62e46
240f085
00096ae
07220fa
2e4ab92
9cbc2cd
59a6cb8
5f4348b
8810d72
76eb2b1
0f874e4
f501195
1ac0a02
4c14665
764c469
2f8d017
6cc21c6
16a9fa5
b222922
f5038db
0668dfb
df16dc5
3191a11
a6246d1
6747394
8e65124
2bcb9c6
718399c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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> | ||
|
||
## 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) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Detected a potential security risk where user-controlled input ( Consider validating or sanitizing the |
||
|
There was a problem hiding this comment.
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