xTokens

Overview of the xToken smart contracts and how they interact with the Swarm Protocol

Any transaction on the Swarm Platform (e.g. the AMM) requires the use of a xToken. An xToken is an ERC-20 compliant representation of balances (“Token”) supplied to the protocol. The xToken reflects that the holder of the xToken is entitled to retrieve the Token from the Swarm Platform if the holder sends the request to the Swarm Protocol. The common wording to describe an xToken is a "wrapped" token.

Such wrapped token may just mirror the functionalities of the Token or can have different functionality which is the case for the xToken as described in the following.

The xToken protocol checks that the address intending on transacting with the Token has permissions (i.e. is an onboarded user, has correct trading permissions as applicable to the given asset, etc) to interact with it. It acts as a permissioning layer for all transactions that take place on Swarm, allowing us to fulfill our regulatory obligations and keep user data secure and anonymous on the platform.

The User has mandatorily a so-called proxy wallet address which is used to bundle transactions for efficiency and to save on transaction fees (see the FAQ on Proxy Contracts for more information). xTokens only are transferred to proxy wallet addresses or to pools but never to the wallet address of the User. xTokens can only be used on the Swarm platform for the purpose of either transacting with a pool or for liquidity providing into a pool. Therefore, xToken’s cannot leave the platform to be used in any other form, particularly it cannot be transferred into a wallet on the Swarm Platform or a wallet outside of it.

Each Token provided into the Swarm Protocol will have a corresponding xToken. For example, WETH has a corresponding xWETH and WBTC has a corresponding xWBTC. Again, these xTokens are non-transferable and exist only in your Proxy Wallet or on a platform pool.

Users must hold a qualified Swarm passport to be able to interact with the xToken assets. To have a Swarm passport, users must undergo KYC and AML checks. Each user holds the same xToken assets; there’s nothing unique to your wallet address or account.

Here's an example of a simple transaction on the platform, demonstrating how xTokens are minted, distributed on the platform, and managed by the user's proxy wallet (CPK in the illustration below). In this transaction, the user is depositing 1000 SMT into a liquidity pool:

First, the original asset (in this case, SMT) is transferred from the user's web3 wallet address to their proxy wallet address (CPK). The proxy wallet then transfers the tokens to the xTokenWrapper, which initiates a minting of the xToken (xSMT) and sends it to the proxy wallet address. Then the pool proxy address (BPool Proxy) forwards the xSMT to the correct pool, completing the addition of liquidity to the pool. Pool tokens (xSPTs) that represent the user's proportion of the total pool’s liquidity are minted and sent back to the user’s proxy wallet.

If the user wants to exit their position in the liquidity pool and unstake their assets, the process is reversed. If the user provides two assets (or more) into a pool, this process is duplicated for each asset staked.

Swarm xTokens

The Swarm Protocol currently provides xToken wrapping for the following assets:

Ethereum Network

Polygon Network

Further Reading

Last updated