Files
proxmox/docs/archive/historical/WETH9_CREATION_ANALYSIS.md
defiQUG cb47cce074 Complete markdown files cleanup and organization
- Organized 252 files across project
- Root directory: 187 → 2 files (98.9% reduction)
- Moved configuration guides to docs/04-configuration/
- Moved troubleshooting guides to docs/09-troubleshooting/
- Moved quick start guides to docs/01-getting-started/
- Moved reports to reports/ directory
- Archived temporary files
- Generated comprehensive reports and documentation
- Created maintenance scripts and guides

All files organized according to established standards.
2026-01-06 01:46:25 -08:00

204 lines
5.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# WETH9 Creation Analysis
**Date**: $(date)
**Contract**: WETH9 (`0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`)
**Chain**: ChainID 138
---
## 🔍 Current WETH9 Status
### Total Supply
- **Raw Value**: `0x53444835ec580000` wei
- **Decimal**: `6,000,000,000,000,000,000` wei
- **ETH Equivalent**: **6.0 ETH**
- **Notation**: 6 × 10¹⁸ wei = 6 ETH
### Important Note
The total supply is **6 WETH**, not 6 trillion WETH. If you're seeing "6,000,000,000.0T" somewhere, this is likely:
1. A display formatting issue in a UI/explorer
2. A misinterpretation of the wei value (6,000,000,000,000,000,000 wei)
3. A different metric being displayed
---
## 📋 How WETH9 Was Created
### 1. Genesis Pre-Deployment
WETH9 was **pre-deployed** in the genesis.json file when ChainID 138 was initialized:
```json
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": {
"balance": "0x0",
"code": "0x6060604052..." // Full WETH9 bytecode
}
```
**Key Points**:
- Contract bytecode was deployed at genesis (block 0)
- No initial ETH balance was allocated to the contract
- No initial WETH tokens were minted
- The contract started with `totalSupply = 0`
### 2. WETH9 Creation Mechanism
WETH9 tokens are created through the `deposit()` function:
```solidity
function deposit() public payable {
balanceOf[msg.sender] += msg.value;
totalSupply += msg.value;
Deposit(msg.sender, msg.value);
}
```
**How it works**:
1. User sends ETH to the contract via `deposit()`
2. Contract mints equivalent WETH tokens to the user
3. `totalSupply` increases by the deposited amount
4. A `Deposit` event is emitted
5. A `Transfer` event is emitted (from address(0) to user)
### 3. Transaction History
Based on the total supply of 6 WETH, there have been deposit transactions that created these tokens.
**Primary Deposit Transaction**:
- **Transaction Hash**: `0xfcd2d771d1c9d27b2ef5c877368928db21c5ec28640419d3d53c911bece94638`
- **Block Number**: 66,895
- **From**: `0x4A666F96fC8764181194447A7dFdb7d471b301C8`
- **To**: `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2` (WETH9)
- **Function**: `deposit()` (input: `0xd0e30db0`)
- **Value**: 6,000,000,000,000,000,000 wei (6 ETH)
- **Purpose**: Wrapped 6 ETH to WETH9
- **Status**: ✅ Completed
**What Happened**:
1. User `0x4A666F96fC8764181194447A7dFdb7d471b301C8` called `deposit()` on WETH9
2. Sent 6 ETH to the contract
3. Contract minted 6 WETH tokens to the user
4. Total supply increased from 0 to 6 WETH
5. Contract balance increased from 0 to 6 ETH
---
## 🔢 Understanding the Numbers
### Wei to ETH Conversion
- 1 ETH = 10¹⁸ wei
- 6 ETH = 6 × 10¹⁸ wei = 6,000,000,000,000,000,000 wei
### Display Formats
Different UIs may display this differently:
- **Standard**: 6 ETH
- **Wei format**: 6,000,000,000,000,000,000 wei
- **Scientific**: 6.0e+18 wei
- **Misleading display**: 6,000,000,000.0T (if T means "trillion", this would be incorrect)
### Why "6,000,000,000.0T" Might Appear
If you're seeing "6,000,000,000.0T WETH" in a UI:
1. **Display Bug**: The UI might be incorrectly formatting:
- `6,000,000,000,000,000,000` wei
- As `6,000,000,000.0T` (treating the first 10 digits as the number and "T" as a suffix)
2. **Decimal Misplacement**:
- Actual: 6,000,000,000,000,000,000 wei = 6 ETH
- Misread: 6,000,000,000.0T (where T might be a formatting artifact)
3. **Different Token**: You might be looking at a different token or chain
---
## 📊 Verification Commands
### Check Total Supply
```bash
cast call 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 \
"totalSupply()" \
--rpc-url http://192.168.11.250:8545 | \
xargs -I {} cast --to-unit {} ether
# Output: 6
```
### Check Contract Balance (ETH)
```bash
cast balance 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 \
--rpc-url http://192.168.11.250:8545 | \
xargs -I {} cast --to-unit {} ether
# Output: 6 (the ETH backing the WETH9 tokens)
```
### Check Deposit Events
```bash
cast logs --from-block 0 \
--address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 \
"Deposit(address,uint256)" \
--rpc-url http://192.168.11.250:8545
```
### Check Transfer Events
```bash
cast logs --from-block 0 \
--address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 \
"Transfer(address,address,uint256)" \
--rpc-url http://192.168.11.250:8545
```
---
## 🔄 WETH9 Creation Flow
```
Genesis Block (Block 0)
├── WETH9 Contract Deployed
│ ├── Bytecode: Pre-deployed
│ ├── Balance: 0 ETH
│ └── Total Supply: 0 WETH
Block N (First Deposit)
├── User calls deposit() with 6 ETH
│ ├── Contract receives 6 ETH
│ ├── Contract mints 6 WETH to user
│ ├── Total Supply: 0 → 6 WETH
│ └── Events: Deposit, Transfer
Current State
├── Contract Balance: 6 ETH
├── Total Supply: 6 WETH
└── All WETH backed by ETH in contract
```
---
## ✅ Summary
1. **WETH9 Total Supply**: 6 WETH (not 6 trillion)
2. **Creation Method**: Pre-deployed in genesis, tokens created via `deposit()`
3. **Current State**: 6 ETH deposited, 6 WETH minted
4. **If seeing "6,000,000,000.0T"**: This is likely a display formatting issue
### Actual Numbers
- **Total Supply**: 6 WETH
- **Backing ETH**: 6 ETH
- **Wei Value**: 6,000,000,000,000,000,000 wei
- **Display**: Should show as "6 WETH" or "6.0 ETH"
---
## 🔍 Troubleshooting
If you're seeing "6,000,000,000.0T WETH":
1. **Check the source**: Which explorer/UI are you using?
2. **Verify the contract**: Ensure you're looking at `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2` on ChainID 138
3. **Check the metric**: Are you looking at totalSupply or a different value?
4. **Verify the chain**: Ensure you're on ChainID 138, not a different chain
---
**Last Updated**: $(date)