xTokens are the primary means of interacting with the Swarm Markets Protocol
Each asset supported by the Swarm Markets Protocol is integrated through a xToken contract, which is an ERC-20 compliant representation of balances supplied to the protocol.
By minting xTokens, an existing crypto asset or token is "wrapped" or "transformed" into a new wrapped token with additional functionality.
xTokens are the primary means of interacting with the Swarm Markets Protocol; when a user mints, redeems, swaps, provides liquidity, transfers xTokens, or more, she will do so using the xToken contract.
Currently, mostly the wrapping and unwrapping of xTokens is done within the same transaction. But there are instances deposit their assets into the (1) earn interest through the xToken's exchange rate, which increases in value relative to the underlying asset, and (2) gain the ability to use xTokens as collateral.
The translation between token and wrapped token is reversible; users can switch between the two versions at any time. Users can exchange their wrapped tokens for the smart contract to get their original tokens back.
There are currently two types of xTokens:
xToken is a 1:1 representation a wrapped underlying ERC-20 token. A user locks her tokens into the xToken smart contract and receives the corresponding xTokens in return
off-chain xToken is a 1:1 representation a wrapped off-chain asset. These can either be digital assets from other blockchains or real assets. A user deposits an off-chain asset into an off-chain custody and receives the xToken in return
Though both types expose the ERC-20 interface, the core functions which involve transferring an asset into the protocol have slightly different interfaces depending on the type, each of which is shown below.
Each token provided into the Swarm Markets Protocol will have a corresponding xToken. For example, ETH has a corresponding xETH and WBTC has a corresponding xWBTC.
Users must hold a qualified Swarm Markets Passport to be able to interact with the xToken smart contracts. Each user has the same xToken; there’s nothing unique to your wallet that you have to worry about.
The Swarm Markets Protocol currently provides xToken wrapping for the following assets: