WBERA
An ERC20 token that wraps the native BERA token, allowing it to be used in smart contracts that expect ERC20 tokens. Users can deposit BERA to receive WBERA and withdraw BERA by burning WBERA. The contract can receive BERA directly, which will automatically wrap it into WBERA for the sender.
Inherits: WETH, ERC20
View Functions
name
Returns the name of the token: "Wrapped Bera". Overrides WETH implementation.
function name() public pure override returns (string memory);
symbol
Returns the symbol of the token: "WBERA". Overrides WETH implementation.
function symbol() public pure override returns (string memory);
allowance
Returns the remaining number of tokens that spender
is allowed to spend on behalf of owner
. Inherited from ERC20.
function allowance(address owner, address spender) public view virtual returns (uint256);
balanceOf
Returns the amount of tokens owned by an account. Inherited from ERC20.
function balanceOf(address account) public view virtual returns (uint256);
decimals
Returns the number of decimals used for token amounts. Always returns 18 for compatibility with BERA. Inherited from ERC20.
function decimals() public view virtual returns (uint8);
totalSupply
Returns the total amount of tokens in existence. Inherited from ERC20.
function totalSupply() public view virtual returns (uint256);
Functions
deposit
Deposits BERA and mints WBERA tokens to the sender. Can also be triggered by sending BERA directly to the contract. Inherited from WETH.
function deposit() public payable;
withdraw
Burns WBERA tokens from the sender and sends the equivalent amount of BERA back. Inherited from WETH.
Errors:
ETHTransferFailed
: If the BERA transfer back to the sender fails
function withdraw(uint256 amount) public;
receive
Allows the contract to receive BERA directly, automatically wrapping it into WBERA for the sender. Inherited from WETH.
receive() external payable;
Events
Transfer
Emitted when tokens are transferred between accounts. Inherited from ERC20.
event Transfer(address indexed from, address indexed to, uint256 value);
Approval
Emitted when an account approves another account to spend tokens on their behalf. Inherited from ERC20.
event Approval(address indexed owner, address indexed spender, uint256 value);
Errors
ETHTransferFailed
error ETHTransferFailed();
Thrown when the BERA transfer fails during withdrawal. Inherited from WETH.