# ERC20 Swaps

ERC20 Swaps were designed by the developers in the Frictionless protocol to risk off permissionless stablecoins such as USDC or USDT.&#x20;

Permissionless are a great innovation from the crypto markets which were designed for permissionless crypto referencing to US Dollars, however handling stablecoins for traditional institutional partners is still a risky proposition.

{% hint style="success" %}
Using the ERC20 Converter contracts, FrictionlessFundDepositTokens can be converted to/from stablecoins using the Frictionless protocol to help Managers accept stablecoins whilst off-loading their associated risks, such as de-peg events, underlying community bank reliance and liquidity risks.
{% endhint %}

{% hint style="info" %}
The PROTOCOL\_TREASURY manages the on/off ramp of the ERC20 stablecoin, such as USDC/USDT within its fund structures of FRICTIONLESS MARKETS SECURITIES FT. &#x20;
{% endhint %}

{% hint style="success" %}
The availability of a valid configured ERC20 token for conversion to/from FrictionlessFundDepositToken along with the associated fees is transparent, any market participant may query the smart contract.
{% endhint %}

The principle of an ERC20 Swap is simple.

<figure><img src="/files/6afE1PRWvfbGdQe7uK4a" alt=""><figcaption><p>Schematic of a Frictionless ERC20 (USDC stablecoin) Swap</p></figcaption></figure>

1. The PROTOCOL\_ADMIN defines the valid token pairs which are convertible on a 1:1 basis.
2. Fees can be optionally defined for the conversion to/from the ERC20 token.
3. The holder (Investor) of ERC20 tokens invokes the `convertFromERC20`function of the smart contract, the ERC20 tokens are sent to the PROTOCOL\_TREASURY and a matching amount of FrictionlessFundDepositToken is minted and sent to the holder (Investor).
4. If the Investor wishes to convert their FrictionlessFundDepositToken to a valid configured ERC20 token, such as USDC/USDT, then they can invoke the `convertToERC20`function of the smart contract. In this case, the PROTOCOL\_TREASURY will receive the FrictionlessFundDepositToken and burn it, transferring the matching amount of ERC20 (less any fees) to the Investor.

An example of two live ERC20 swaps on the Avalanche C-Chain are;

* [USDC swapped for fsUSD ](https://snowtrace.io/tx/0x3cac0554cbf7b75d347bca14c9e7531147ba75d32b30d0923233c45fd1aa49c7?chainId=43114)
* [fsUSD swapped for USDC ](https://snowtrace.io/tx/0x7dc46fbadd478d8d9c723ce43a913f8e666b17675f394aee2957df93a87c16b2)

In these swaps, you can observe the collection of optional fees and the atomic settlement of the swap of the fsUSD tokens with USDC into the PROTOCOL\_TREASURY.

<figure><img src="/files/y8Czo8PezwSHuVZ3QvII" alt=""><figcaption><p>Frictionless ERC20 Swap - USDC for fsUSD with automatic fee collection</p></figcaption></figure>

<figure><img src="/files/paORXS2O33AmbUI5a2Ft" alt=""><figcaption><p>Frictionless ERC20 Swap - fsUSDC for USDC with no fee collection</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.frictionless.markets/developer/smart-contracts/smart-contract-docs/erc20-swaps.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
