# Liquidity Pools

The Liquidity Pools are smart contracts allowing anyone to buy and sell jFIATs without price impact.

Users can buy jFIATs from the protocol's liquidity pools, or sell jFIATs to the pools. These transactions only happen between jFIATs and approved collaterals.
One pool is for one jFIAT and collateral pair, although multiple pools for the same pair can co-exist, with or without different parameters.
The swaps happen at the FIAT/USD or FIAT/COLLATERAL oracle price (provided by Chainlink, or computed using Chainlink price feeds) without spread or price impact regardless of the transaction size. Users pay a swap fee that depends on the jFIAT exchanged.
Example
A user can buy $3,000 worth of jEUR with 3,000 USDC, or$50,000 worth of jMXN with $50,000 worth of ETH (minus the swap fees). Although there is no price impact, slippage may occur if the on-chain price is updated before the transaction is confirmed on the Blockchain. Example If a user sign a transaction to buy 1,000 jCHF for 1,020 USDC at the CHF/USD rate of 1.02, but before the transaction is confirmed on the Blockchain, Chainlink updates the price to 1.025, then the user would receive 995 jCHF. Users can specify a maximum slippage above which the transaction will revert. Users can also specify a time after which the transaction will revert if the latter has not been confirmed yet. ### Burn and mint mechanism A pool needs to be seeded by liquidity providers (LP) to start accepting swaps. Unlike traditional liquidity pools, Synthereum LPs only need to deposit one asset. The pools use a burn and mint mechanism to facilitate trades: • When a user buys jFIATs from a pool, the latter mints them. Example An LP seeds a USDC-jEUR pool with 500 USDC. A user buys 900 jEUR for 1,000 USDC from the pool. The pool now holds 1,500 USDC: 500 USDC from the LP deposit and 1,000 UDSC from the sales proceeds. The pool mints 900 jEUR that it sends to the buyer and its LP has a 900 Euros EUR/USD short position. The LP has a short position on the FIAT/COLLATERAL pair, which size equals the number of jFIATs the pool has minted. • When a user sells jFIATs to a pool, the latter uses its liquidity to buy them back and burns them. Example The user sells their 900 jEUR for 1,050 USDC back to the pool (assuming the EURUSD rate increased). The pool will pay 1,050 USDC to the seller and burn the 900 jEUR it receives. The pool now holds 450 UDSC, has no more jEUR minted, and the LP has no open position. ### Liquidity providers LPs ensure that jFIATs can be bought and sold at any price by providing liquidity. LPs have a short position on the FIAT/COLLATERAL pair. They are the counterparty of users buying and selling through the pool; therefore, they profit when users lose and lose when users profit. In the previous example, the users profited from the EURUSD price appreciation and earned 50 UDSC. The pool used the LP's deposit to pay for these profits. #### Collateral and health ratio The collateral ratio (CR) of the jFIATs is the ratio between the collateral value in the pool and the value of the jFIATs it has minted. The health ratio (HR) of an LP’s position is the ratio between the collateral value of the position and its size. Example An LP seeds a USDC-jEUR pool with 10,000 UDSC. A user buys 2,500 jEUR (worth$2,625 at the EUR/USD rate of 1.05) from the pool.
The pool now holds 12,625 USDC of collateral (10,000 USDC of the LP and 2,625 USDC from the sales of the jEUR) and has minted 2,500 jEUR ($2,625). The jEUR minted by the pool have a CR of 12,625/2,625 = 480%. The LP has a 2,500 Euros ($2,625) EUR/USD short position collateralized by 12,625 USDC. The position has an HR of 480%.
The jFIATs are collateralized by the liquidity in the pool. Pools are seeded by LPs deposits and alimented by swap fees, sales proceeds, and user losses.
The CR of the jFIATs and the HR of the positions vary in function of two factors:
• The more users are buying jFIATs from the pool, the lower the CR and HR (and vice versa).
Example
In the previous example, the CR of the jFIATs minted by the USDC-jEUR pool and the HR of the LP’s short position were 480%.
The user buys 5,000 jEUR more (worth $5,250). The pool now holds 17,875 USDC of collateral (10,000 USDC from the LP’s deposit and 7,875 UDSC from the two sales) and has minted 7,500 jEUR ($7,625). The CR of the jEUR minted by the pool have droped to 17,875/7,625 = 234%.
The LP now has a 7,500 Euros ($7,625) EUR/USD short position collateralized by 17,875 USDC. The HR of the position drops to 234%. • The more the FIAT/COLLATERAL rate increases (or the COLLATERAL/FIAT rate decreases), the lower the CR and HR (and vice versa). Example In the previous example, the CR and the HR were 234%. The EUR/USD rate goes up to 1.2, thus the 7,500 jEUR are now worth$9,000, and so is the 7,500 Euros short position.
The CR of the jEUR minted by the pool is 17,875 / 9,000 = 199%, and so is the HR of the LP’s position.
LPs must maintain the HR of their position above the ”liquidation threshold” (set by the governance). If the HR drops below the liquidation threshold, LPs face liquidation.
LPs make sure that the jFIATs minted by the pool remain over-collateralized (CR above 100%). The over-collateralization guarantees that jFIATs remain redeemable for their collateral, which confers them their value and peg.

#### Minimum health ratio

LPs must specify a minimum health ratio (MHR) when they deposit liquidity for the first time. They can change the MHR anytime. Although, the MHR cannot be set below the liquidation threshold.
If the HR of their position is below the MHR, they will not be the counterparty of new swaps.
The MHR is a risk management tool to limit the exposure of LPs. The lower the MHR, the more an LP will be the counterparty for buying orders and, therefore, the bigger their position. An LP can also set a very high MHR to stop being the counterparty of buying orders.

#### Virtual liquidity

The virtual liquidity (VL) is:
• The value of jFIATs a user can buy from an LP, but expressed in the collateral-type of jFIATs.
• Or the number of jFIATs a user can buy from an LP (jFIAT virtual liquidity).
The combined VL of all the LPs is the VL of the pool, and the combined VL of all the pools is the VL of the associated jFIAT.
It is "virtual" because it does not exist: the pool can facilitate buying $100,000 of jFIATs despite only holding 10,000 USDC. The VL is calculated with the following formula: $VirtualLiquidity = \frac{NetDeposit }{MHR-1}-Position * Price$ And the jFIAT VL: $jFIATVirtualLiquidity = \frac{VirtualLiqiudity}{Price}$ • NetDeposit: the LP net deposit (Deposits - Withdrawals) • MHR: the minimum health ratio • Position: the size of the position (quoted in the fiat) • Price: the FIAT/COLLATERAL rate Example An LP seeds a USDC-jEUR pool with 10,000 UDSC. A user buys 2,500 jEUR (worth$2,625 at the EUR/USD rate of 1.05).
The LP sets the MHR to 120%.
The VL is (10,000 / (120% - 1) - 2,500 * 1.05 = 47,375 USDC.
The jFIAT VL is 47,275 / 1.05 = 45,119 jEUR.
Therefore, users can buy up to 45,119 jEUR (worth $47,375). To increase their VL, LP can deposit more collateral (which will increase their HR) or lower the MHR of their position, or both. To decrease it, they can withdraw some collateral or increase their MHR, or both. The VL increases if the FIAT/COLLATERAL rate decreases, and vice versa. Unlike traditional liquidity pools which would require at least$200,000 of liquidity to allow the purchase of $100,000 of an asset, a Synthereum pool would only require$10,000 of liquidity if the MHR is set at 110%.

#### Available liquidity

Until LPs have an open position, a part of their liquidity is collateralizing the jFIATs, and is therefore locked.
Their locked liquidity is calculated as follows:
$LockedLiquidity = Position * Price * (MHR-1)$
Therefore the liquidity available to withdraw is calculated as follows:
$AvailableLiquidity = NetDeposit - LockedLiquidity$
An LP who would like to exit their position gradually can set their MHR very high, setting their virtual liquidity and, therefore, their buying shares to respectively 0 and 0%; this will reduce their position size as users sell jFIATs.
Alternatively, LP can join a LP vault, allowing them to unlock their liquidity anytime.

#### Routing order between multiple LPs

Each LP has a different position within the pool, and each LP's position is isolated: when an LP joins or exits a pool, adds or removes collateral, it does not impact the other LP's positions.
When a user buys jFIATs, the order is split between each LP proportionally to their VL (buying shares). However, selling orders are split proportionally to the size of each LP's position (selling shares).
Example
The EUR/USD rate is 1.05.
LP1 has deposited 10,000 USDC in a USDC-jEUR pool and has set the MHR to 105%, with a VL of 210,000 jEUR.
LP2 has deposited 100,000 USDC with an MHR of 120%, with a VL of 525,000 jEUR.
Therefore, their respective buying shares are 28.5 and 71.5%.
A user buys 50,000 jEUR for 52,500 UDSC. The order is split between the two LPs following their buying shares: 14,250 jEUR for 14,820 USDC for LP1, and 35,750 jEUR for 37,180 USDC for LP2.
LP1 now has a 14,250 Euros ($14,820) short position collateralized by 14,820 + 10,000 = 24,820 USDC and an HR of 167%. And LP2 has a 35,750 Euros ($37,180) short position collateralized by 100,000 + 37,180 = 137,180 USDC and an HR of 369%.
Therefore, their respective selling shares are 28.5 and 71.5%.
In the previous example, LPs have the same buying and selling shares because they have joined the pool simultaneously. If one of the LPs adds or removes liquidity, their buying shares will change. If one of the LP would have joined the pool after a user buys jFIATs, their buying and selling shares would differ.
When an LP joins a pool, it does not open a position for them: their position will open only after a user buys jFIATs. Since they do not have a position, their selling shares are 0%.
If an LP with an open position adds or removes liquidity, it only affects their buying shares for future orders; the size of their open position remains unchanged, and so are their selling shares.

#### LP vault

Liquidity provision on Synthereum is not permissionless: users must apply to the governance to become an LP.
An LP can be an individual, a DAO, a VC, etc.
LPs can also deposit their liquidity into a vault to join a mutualized position. A vault is a whitelisted LP with additional logic. We will launch a few protocol-owned vaults with different logic, but anyone can deploy their own vault and apply for whitelisting it. LPs receive a tokenized share of the vault position.
This solution offers permissionless liquidity provision, and more flexibility, thanks to the tokenization of the position which enables multiple use cases (secondary market LP token, collateral for money market, etc.)
🚧 The first protocol-owned vault is under development.

#### LPs revenues

LPs have two revenue streams:
• Trading fees: users pay trading fees when they buy or sell, and all the fees go to LPs.
• Interest from lending: the protocol lends the collateral on third party money markets, and the interest is shared between LPs and the protocol’s treasury, as per a ratio voted by the governance. This essentially provides a multiplier on the money markets' interest.
Example
EUR/USD rate is 1.05.
An LP seeds a USDC-jEUR pool with 10,000 UDSC.
They set the MHR to 110%, enabling a VL of 95,238 jEUR ($100,000) A user buys 30,000 jEUR for 31,500 USDC. The pool now holds 41,500 USDC and lends them on Aave at 0.8% per year. The LP receives 90% of the interest, and the protocol the other 10%. Therefore, the LP earns 90% * 20,500 * 0.8% = 226.8 USDC per year, which equals 2.26% per year (a multiplier of 2.835). If the user had bought 95,238 jEUR, the pool would hold and lend 110,000 USDC, and the LP would earn 7.92% per year (a multiplier of 9.9). A low MHR allows for a larger VL, leading to a larger position and more trading fees and interest. If the FIAT/COLLATERAL rate decreases, the VL increases, and more jFIATs can be bought. This allows the protocol to lend more collateral on money markets, increasing the multiplier. ### Liquidation If the HR of an LP's position falls under the liquidation threshold, the position can be liquidated. Liquidators receive the collateral covering the position and a percentage of the remaining collateral, called the penalty fee, and set by the governance. Example EUR/USD rate is 1.05. An LP seeds a USDC-jEUR pool with 1,000 UDSC and sets the MHR to 105% ($20,000 of VL). The liquidation threshold is 102.5% and the penalty fee is 100%.
A user buys 18,000 jEUR ($18,900) from the pool. The LP has an 18,000 Euros ($19,900) EUR/USD short position collateralized by 19,900 USDC. The position has an HR of 105.3%.
If the EUR/USD rate goes up to 1.08, the position would have an HR of 19,900 / (18,000 * 1.08) = 102.3%, below the liquidation threshold. If the LP does not add more collateral, their position will get liquidated.
A liquidator would need to acquire 18,000 jEUR (\$19,440) to liquidate the position. The liquidator will get back 18,000 * 1.08 = 19,440 USDC (18,000 Euros worth of collateral that covers the position) and a penalty fee of (19,900 - 19,440) * 100% = 560 USDC (100% of the remaining collateral). The liquidator realises a profit to 560 / 19,440 = 2.9%.
Liquidators can acquire the jFIATs by buying or borrowing them (with or without flash loans) on primary or secondary markets.

### Counterparty risks

The liquidation system is in place to keep the system over-collateralized and free of counterparty risk.
However, in a situation where there is not enough available liquidity to perform a liquidation, the CR of the jFIATs minted by the pool can falls under 100%. In this case, these jFIATs will become under-capitalised. A similar event can happen if the FIAT/COLLATERAL rate spikes so high and rapidly that liquidators will not have the time to liquidate positions under the liquidation threshold.
If the jFIATs minted by the pool become under-collateralized, it compromises their redeemability. The percentage of the jFIATs that could not be redeemable is equal to their CR: if the CR of the jCADs minted by a USDC-jCAD pool is 94%, then 6% of these jCADs cannot be redeemed for USDC and become de-facto un-collateralized.

### Pool parameters

The parameters of a pool are set during the deployment. Some of these parameters cannot be changed, such as the collateral type, oracle price, and liquidation threshold; other parameters can be changed afterward, such as the transaction fees, the liquidation penalty, and the whitelisting of LPs.

### Liquidity

The total liquidity is available at the oracle price and is limited to the combined VL of all the pools.