WBERA Berachain
WBERA is an ERC20 token on Berachain that is functionally similar to WETH on Ethereum mainnet. WBERA can be used in any application on Berachain which requires ERC20 tokens. For example to provide liquidity on the native BEX with the BERA asset, WBERA is used under the hood.
WBERA is pre-deployed at 0x5806E416dA447b267cEA759358cF22Cc41FAE80F
on Berachain.
Note: Link to existing contract ABI's can be found on Github here.
Inherits: ERC20
Authors: Berachain Team, OpenZeppelin Team
Wrapped BERA The WBERA token is a Wrapped BERA token that adheres to the ERC20 interface. Deposit EVM balance (BERA) to receive the WBERA token; withdraw your EVM balance for the WBERA token.
Inspiration from WETH
Functions
constructor
constructor() ERC20("Wrapped BERA", "WBERA");
constructor() ERC20("Wrapped BERA", "WBERA");
name
function name() public pure override(ERC20) returns (string memory);
function name() public pure override(ERC20) returns (string memory);
symbol
function symbol() public pure override(ERC20) returns (string memory);
function symbol() public pure override(ERC20) returns (string memory);
receive
The receive function is called when BERA is sent directly to the contract. It automatically calls the deposit function to mint WBERA tokens.
receive() external payable;
receive() external payable;
deposit
The deposit function allows users to deposit EVM balance (BERA) into the contract. It mints an equivalent amount of WBERA tokens and assigns them to the sender.
function deposit() public payable;
function deposit() public payable;
withdraw
The withdraw function allows users to withdraw their EVM balance (BERA) from the contract. It burns the specified amount of WBERA tokens and transfers the corresponding EVM balance to the sender.
function withdraw(uint256 amount) external;
function withdraw(uint256 amount) external;
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of WBERA tokens to burn and receive BERA for. |
Events
Deposit
event Deposit(address indexed from, uint256 amount);
event Deposit(address indexed from, uint256 amount);
Withdrawal
event Withdrawal(address indexed to, uint256 amount);
event Withdrawal(address indexed to, uint256 amount);