This page is all about how the communication between these chains and the
L1 ⇌ L2 communication
Token Bridges
Native Currency
The native currency on Nahmii 2.0 is Ether. The Ether token on Nahmii 2.0 is implemented as a wrapped ERC20 equivalent of the Ether deposited into the L1 ERC20 bridge smart contract. The address for the wrapped NVM Ether is: 0x4200000000000000000000000000000000000006.
The wrapped NVM Ether can also be accessed by calling the native currency functions that exist within a regular Ethereum network, but there are a number of caveats attached. It is therefore recommended to use the wrapped NVM Ether as an ERC20.
An example implementation of how to use the wrapped NVM Ether as an ERC20 token is shown below:
// SPDX-License-Identifier: MITpragmasolidity 0.6.12;/** * @dev Interface of the ERC20 standard as defined in the EIP. */interface IERC20 {functiontotalSupply() externalviewreturns (uint256);functionbalanceOf(address account) externalviewreturns (uint256);functiontransfer(address recipient,uint256 amount) externalreturns (bool);functionallowance(address owner,address spender) externalviewreturns (uint256);functionapprove(address spender,uint256 amount) externalreturns (bool);functiontransferFrom(address sender,address recipient,uint256 amount) externalreturns (bool);eventTransfer(addressindexed from, addressindexed to, uint256 value);eventApproval(addressindexed owner, addressindexed spender, uint256 value);}contract FundMe {mapping(address=>uint256) public addressToAmountFunded;address[] public funders;addresspublic owner;addresspublic WETH =0x4200000000000000000000000000000000000006;eventDeposit(addressindexed _from, uint _value);constructor() public { owner = msg.sender; }// Fund contract through NVM ETH ERC20 contractfunctionfund(uint value) public {IERC20(WETH).transferFrom(msg.sender,address(this), value); addressToAmountFunded[msg.sender] += value; funders.push(msg.sender);emitDeposit(msg.sender, value); }// Check the current NVM ETH balance for this contractfunctionbalanceOf() publicviewreturns(uint256) {returnIERC20(WETH).balanceOf(address(this)); }modifieronlyOwner {require(msg.sender == owner); _; }}
Note that, unlike in a situation where a native currency is used, the ERC20 approach requires the target smart contract to be approved to spend a users NVM Ether. This will thus result in an extra strep for the user where the user needs to do an approval for the respective token first.