WETH9 v0.2.3 API Reference
A contract that implements Wrapped Ether (WETH), allowing users to wrap and unwrap ETH.
WETH9
mapping(address => mapping(address => uint256)) public allowance
mapping(address => uint256) public balanceOf
uint8 public decimals = 18
string public name = "Wrapped Ether"
string public symbol = "WETH"
event Approval(address indexed src, address indexed guy, uint256 wad)
Parameter | Type | Description |
---|
src | address | The address giving the approval |
guy | address | The address receiving the approval |
wad | uint256 | The amount of tokens being approved |
event Deposit(address indexed dst, uint256 wad)
Parameter | Type | Description |
---|
dst | address | The address receiving the WETH |
wad | uint256 | The amount of ETH being wrapped |
event Transfer(address indexed src, address indexed dst, uint256 wad)
Parameter | Type | Description |
---|
src | address | The address sending the tokens |
dst | address | The address receiving the tokens |
wad | uint256 | The amount of tokens being transferred |
event Withdrawal(address indexed src, uint256 wad)
Parameter | Type | Description |
---|
src | address | The address unwrapping the WETH |
wad | uint256 | The amount of WETH being unwrapped |
Approves another address to spend tokens.
function approve(address guy, uint256 wad) public returns (bool)
Parameter | Type | Description |
---|
guy | address | The address to approve |
wad | uint256 | The amount of tokens to approve |
Parameter | Type | Description |
---|
(unnamed) | bool | Always returns true |
Deposits ETH to receive WETH.
function deposit() external payable
Gets the total supply of WETH.
function totalSupply() public view returns (uint256)
Parameter | Type | Description |
---|
(unnamed) | uint256 | The total supply of WETH |
Transfers tokens to another address.
function transfer(address dst, uint256 wad) public returns (bool)
Parameter | Type | Description |
---|
dst | address | The recipient address |
wad | uint256 | The amount of tokens to transfer |
Parameter | Type | Description |
---|
(unnamed) | bool | Returns true if the transfer succeeds |
Transfers tokens from one address to another.
function transferFrom(address src, address dst, uint256 wad) public returns (bool)
Parameter | Type | Description |
---|
src | address | The source address |
dst | address | The destination address |
wad | uint256 | The amount of tokens to transfer |
Parameter | Type | Description |
---|
(unnamed) | bool | Returns true if the transfer succeeds |
- Reverts if the source address has insufficient balance
- Reverts if the caller has insufficient allowance (unless caller is source or has maximum allowance)
Withdraws ETH by unwrapping WETH.
function withdraw(uint256 wad) external
Parameter | Type | Description |
---|
wad | uint256 | The amount of WETH to unwrap |
- Reverts if the caller has insufficient WETH balance