Handle Native Tokens
Understanding Native Tokens
Native tokens are the base currencies of their blockchains—for example, ETH on Ethereum, BNB on BNB Chain, and POL on Polygon. Because native tokens do not have contract addresses like ERC-20 tokens, the placeholder address: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE is commonly used to represent native tokens in blockchain transactions.
Notes on Native Token Representation
For most of the EVM-compatible chains that we support, the native token is represented using the placeholder address 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE. This convention exists because native assets (e.g., ETH on Ethereum) do not have contract addresses like ERC-20 tokens.
Mantle Network Exception
Mantle’s native token, MNT, does not follow this convention. On the Mantle EVM chain, MNT has a designated contract address: 0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000.
This address applies only to the native MNT token on Mantle and should not be used for wrapped or bridged versions on other networks. Refer to the linked guide for additional differences between Ethereum and Mantle.
For more context on native token addresses:
Steps for Handling Native Tokens
See a full Swap API headless example that demonstrates how to handle native tokens.
Code example
Here’s a code snippet of how you can implement the above steps:
Wrapping and Unwrapping between ETH and WETH
Easily wrap and unwrap between ETH and WETH by requesting a swap quote by setting sellToken and buyToken as either the contract address for WETH or ETH. The swap quote returned will provide the calldata to directly interact with the WETH9 contract and not with 0x Settler contract.