BaseDex is a market tracker and watch-only viewer. This page uses a well-known public contract on Base as an example of how Solidity source is published. It is not a BaseDex product contract, and it does not hold your keys.
Public example contracts still cannot replace a wallet. Never enter a recovery phrase or private key into BaseDex.
Open-source Solidity is published so anyone can read it. Listing an example is not an invitation to trade or deposit funds.
Prices move quickly. You can lose money. Nothing on this page or in the app is investment, tax, or legal advice.
Wrapped Ether (WETH) on Base — a widely used, publicly verified contract. Shown here as a teaching example only. It is not operated by BaseDex.
By using BaseDex or visiting this page, you acknowledge the following.
Full terms: Terms of Use · Privacy Policy
Canonical Wrapped Ether (WETH9) — open, widely copied reference code so you can see how a real smart-contract source file looks. This is not BaseDex software. Prefer the verified copy on Basescan.
// Copyright (C) 2015, 2016, 2017 Dapphub
// SPDX-License-Identifier: GPL-3.0-or-later
// Canonical WETH9 — public reference implementation (example only).
pragma solidity ^0.4.18;
contract WETH9 {
string public name = "Wrapped Ether";
string public symbol = "WETH";
uint8 public decimals = 18;
event Approval(address indexed src, address indexed guy, uint wad);
event Transfer(address indexed src, address indexed dst, uint wad);
event Deposit(address indexed dst, uint wad);
event Withdrawal(address indexed src, uint wad);
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
function() public payable {
deposit();
}
function deposit() public payable {
balanceOf[msg.sender] += msg.value;
Deposit(msg.sender, msg.value);
}
function withdraw(uint wad) public {
require(balanceOf[msg.sender] >= wad);
balanceOf[msg.sender] -= wad;
msg.sender.transfer(wad);
Withdrawal(msg.sender, wad);
}
function totalSupply() public view returns (uint) {
return this.balance;
}
function approve(address guy, uint wad) public returns (bool) {
allowance[msg.sender][guy] = wad;
Approval(msg.sender, guy, wad);
return true;
}
function transfer(address dst, uint wad) public returns (bool) {
return transferFrom(msg.sender, dst, wad);
}
function transferFrom(address src, address dst, uint wad)
public
returns (bool)
{
require(balanceOf[src] >= wad);
if (src != msg.sender && allowance[src][msg.sender] != uint(-1)) {
require(allowance[src][msg.sender] >= wad);
allowance[src][msg.sender] -= wad;
}
balanceOf[src] -= wad;
balanceOf[dst] += wad;
Transfer(src, dst, wad);
return true;
}
}