MockWETH
A mock WETH contract for testing
name
string name
symbol
string symbol
decimals
uint256 decimals
totalBalance
uint256 totalBalance
balances
mapping(address => uint256) balances
Deposit
event Deposit(uint256 amount, address depositor)
Withdraw
event Withdraw(uint256 amount, address withdrawer)
Transfer
event Transfer(address receiver, uint256 amount)
UserBalanceTooLow
error UserBalanceTooLow()
BalanceTooLow
error BalanceTooLow()
WithdrawFailed
error WithdrawFailed()
constructor
constructor(string _name, string _symbol) public payable
Constructor
Parameters
Name | Type | Description |
---|---|---|
_name | string | The name of the token |
_symbol | string | The symbol of the token |
deposit
function deposit() external payable
Deposit ETH
withdraw
function withdraw(uint256 amount) external
Withdraw ETH
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | The amount to withdraw |
transfer
function transfer(address to, uint256 amount) external
Transfer ETH
Parameters
Name | Type | Description |
---|---|---|
to | address | The address to transfer to |
amount | uint256 | The amount to transfer |
balanceOf
function balanceOf(address account) external view returns (uint256)
Get the balance of an address
Parameters
Name | Type | Description |
---|---|---|
account | address | The address to get the balance of |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The balance of the address |