Only this pageAll pages
Powered by GitBook
1 of 78

fx Docs

Loading...

OVERVIEW

Loading...

Loading...

f(x) Protocol Mechanisms

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

RISK MANAGEMENT

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Earn with f(x)

Loading...

Loading...

Loading...

Loading...

Loading...

POWER TO THE PEOPLE

Loading...

Loading...

FAQ

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

GUIDES

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

DEVELOPERS

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

MORE

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Understanding the redemption mechanism

Redemptions act as a last resort protection of $fxUSD's peg. They should only happen if the other Advanced Peg Protection Mechanisms fail. For that reason, the redemption feature is only possible when fxUSD is deppeged according to the Risk parameters. The redemption mechanism ensures that fxUSD can be redeemed for $1 worth of fxUSD's collateral. The redeemed collateral is taken by reducing the debt xPOSITIONS, starting with the most leveraged one and not exceeding a certain proportion of each position before moving to the next leverage level. It gives an incentive to buy discounted fxUSD and redeem it for its collateral for a profit while restoring fxUSD's peg. The redemption can be triggered using the following contract. Please note that a redemption fee is applied. Redemption fees and the maximum proportion of an xPOSITION to be redeemed can be found here.

🚨Risk parameters

FXN Farming and veFXN Boost

TheFXN overall token allocationspecifies 980,000 FXN tokens (49% of max supply) to be emitted as liquidity incentives over a 50-year period, with the emission rate starting at 98,000 FXN for the first year and declining by 10% (relative) each year thereafter. Each year is divided into weekly epochs, with a veFXN governance vote determining how that epoch’s FXN will be allocated among the available gauges, the same as in the Curve’s pioneering model. In the details, however, there are several differences to Curve, driven by technical considerations in the f(x) system.

Gauge Types

f(x) Protocol supports two types of gauges: Stability Pool gauges, and liquidity pool gauges. For LP gauges, farmers can earn FXN by providing liquidity to certain Curve liquidity pools. These gauges are based on a double-gauge structure: farmers stake their Convex farming positions, allowing them to earn both Curve/Convex rewards as well as FXN. Of course, zaps hide this complexity for users who wish to simply deposit underlying tokens. LP gauge yields are boosted by owned, shared or delegated veFXN boost.

On the other side, Stability Pools are even more different to Curve gauges. First, they are not strictly gauges in the Curve sense, due to the fact that they are not tokenized. This has implications for how tokens are distributed, how boost is allocated, and more. Additionally, Stability Pool gauges can be boosted by owned or shared veFXN boost, but not delegated.

Boost Calculation

In Curve’s gauge model, all gauge emissions are distributed immediately and users with boost power take rewards from users without. The veFXN model allows each user to earn their own maximum FXN, and if they do not, the difference is rolled over and used to increase yields for the pool across the board.

FXN distributions to the Stability Pool are shared among farmers according to each farmer’s share of TVL in that pool and their share of total veboost power. Each farmer’s share of TVL in the pool determines the maximum share of incoming FXN they can earn, while their boost determines how much of that they can actually claim. Farmers with veboost power earn up to 2.5X more than farmers with none.

Farmers who have zero veboost have a boost of 1X, which allows them to claim 40% of their maximum earnable share of FXN for this epoch. Farmers who have the maximum veboost of 2.5X may claim 100% of their maximum share.

Each farmer’s boost level is calculated like this:

Maximum FXN = Total Distributable FXN x Individual TVL / Total TVL

Claimable FXN = 0.4 x Maximum FXN x Boost Level

Boost Level = min (Individual TVL x 0.4 + (Total TVL x Individual veFXN for the epoch) x 0.6 / Total veFXN for the epoch, Individual TVL) / (Individual TVL x 0.4)

An alternative way to think about boost level is in terms of two variables: A farmer’s fractional share of the total veboost (fv), and a farmer’s fractional share of the total TVL (fd). Using these terms, each farmer’s boost is calculated like this:

For an individual farmer, the optimal approach is to hold precisely the same share of the total vepower and TVL. A higher share of total vepower than their share of the TVL doesn’t help that farmer, however, the FXN system allows sharing boost power for whitelisted addresses (see below).

Rollover FXN

It is likely that not every farmer will earn their maximum share, which means each time a farmer in the pool makes a settlement transaction (see “Settlement”) there may be leftover FXN. This leftover FXN is rolled forward and treated as a new distribution to the Stability Pool, similar to FXN coming from the gauge.

When any new FXN comes to the Stability ool it is combined with FXN already vesting (if any), and the sum is vested over a new 7 day period starting at the moment of the distribution. Since distributions can come from settlement transactions at any time and in any amount, it would be possible for a small distribution to come in at an inopportune time and artificially (briefly) deflate the pool APR.

To prevent this, FXN rollover distributions which would cause the overall pool APR to drop more than 10% are held in reserve, and added to the next settlement-triggered distribution.

Sharing and Delegating Boost Power

A whitelisted address can choose to share its veFXN boosting power with one or more other addresses. This mechanism is useful for boosting services built on top of f(x), allowing many individual farmers to benefit from a single central pool veFXN. In the case of shared boosting, the total veboost is calculated using the amount of veFXN shared (i.e. that held by the sharing address) and the collective TVL of the all recipients.

The calculated boost level is applied to all recipients.Users may also choose to delegate their veFXN boost power to another single address. Delegated boost can be used to boost LP farming yields, but not stability pool yields.

Emissions Require Harvesting

A Stability Pool is not strictly a gauge in the Curve sense because it is not tokenized. This has some technical implications, but practically it means the following:

  1. FXN is released by the gauge linearly over a period of 7 days, but requires harvesting before it can be distributed

  2. FXN is minted when the harvest function is called (it is a permissionless keeper function). Minted FXN is vested linearly to Stability Pool farmers over 7 days.

Between harvest delays and vesting, token emissions have smoothed and slightly delayed changes from pool APRs. Things will smooth out after a week.

Settlement

Upon any deposit/withdraw/claim/veFXN top up transaction (including receiving shared boost power,) the system will immediately calculate and settle claimable FXN rewards for the period between two transactions. Even though a user may not choose to make any transaction which triggers settlement for a period of many epochs, the amount of FXN they may claim from each past epoch is locked in and does not change after the end of that epoch.

In other words, when the settlement happens, total claimable FXN for each epoch since the previous settlement is calculated using TVL and veboost values from that epoch.

Settlement happens prior to the execution of the transaction which triggers it, so any changes to veboost which result from the transaction will apply only to subsequent epochs.

Examples

Here are two simple numerical examples. Assume we only have Alice and Bob in the Stability Pool, and that there are 10 distributable FXN for this epoch:Example 1 (nobody has any veboost)

In Example 1, only 4 out of 10 FXN have been distributed, so the remaining 6 FXN are placed in the rollover reserve which will be used to increase distributable FXN in later epochs.

Example 2 (everybody has equal veboost)

All of the 10 FXN have been distributed when everybody has the equal veboost.All of the 10 FXN have been distributed when everybody has the equal veboost.

Stability Pool Farmer

Alice

Bob

TVL $

100

100

Maximum Earnable FXN for the epoch

5

5

veFXN

0

0

Claimable FXN

5 x 0.4 = 2

5 x 0.4 = 2

Stability Pool Farmer

Alice

Bob

TVL $

100

100

Maximum Earnable FXN for the epoch

5

5

veFXN

100

100

Claimable FXN

5 x 0.4 x 2.5 = 5

5 x 0.4 x 2.5 = 5

Get involved - Community Booster Program

Aladdin DAO has always been a community-oriented project. Anyone can contribute to the protocol's growth and be rewarded. There is no limit to the ways one can contribute. Here are a couple of examples:

  • Creating online content about f(x)

  • Getting intros to the team with DeFi Funds and large LPs

  • Getting intros with qualitative KoLs

  • Building relevant DeFi integrations with other protocols

  • ...

Anything that helps bring awareness, TVL, and volume to the protocol is beneficial. Currently, 500FXN are distributed every month among the Community Boosters. The rewards are linearly vested over 12 months. Still, they can be converted into cvxFXN or sdFXN, respectively, Convex or StakeDAO's liquid lockers to let boosters earn the veFXN yields during the vesting period. How to get started? Join the Aladdin DAO's and post your contribution to the #contribute-fx channel.

Each month, the rewards distribution will be announced in Discord and on X.

Discord

Why are there different stablecoins?

When you visit our V1 dApp, you might need more clarity regarding the variety of stablecoins available. Each stablecoin is backed by different types of collateral, each with unique risk profiles. Here's a breakdown of their key differences:

Each of these stablecoins is designed to serve different use cases and risk appetites. For more details, explore our Token Breakdown.

Is there any LUNA-like risk?

No, f(x) stablecoins are fundamentally different from Luna. While Luna collateralized its stablecoin with endogenous assets (its own governance token), f(x) stablecoins are backed exclusively by tier-1 exogenous DeFi assets. You can check fxUSD and its related xPOSITIONS backing here.

How to adjust your leverage / how to reduce your Liquidation Brake

Adjusting your leverage, suppose you already have an opened xPOSITION. You should see your xPOSITION on the Trade page in the middle left section called “My xPOSITION”. Ensure the correct wallet is connected to the dApp if you don't see it.

There are two ways of adjusting the leverage of an xPOSITION. You can modify it without changing its nominal value or top up to your position with a different leverage.

To lower your Liquidation Brake threshold, simply reduce your leverage using one of the two options below. You can reduce it by adding to your position with a lower leverage.

Adjusting the leverage without changing the xPOSITION’s nominal value.

  • Once you are correctly connected on the page, you should see a button labeled “Adjust Leverage.” Click it.

  • Slide the leverage bar to reach your desired leverage.

  • Hit the “Preview” button.

  • Review your trade and the evolution of your xPOSITION, then click the “Submit Transaction” button when ready.

Adjusting the leverage of the xPOSITION by adding to it.

You can also top up your position or create a new one with a different leverage. Your xPOSITIONs are aggregated into a single one with an average leverage.

Please follow that tutorial to learn how to add or reduce a position.

Confirm the transaction using your wallet.

Trade
➕How to add/reduce a leverage position?

How to stake into the stability pool?

The f(x) Protocol stability pool offers a unique way of putting your stablecoins at efficient work. By staking either your fxUSD or USDC, you will not only earn enhanced LSD yields, xPOSITIONs trading commissions, and $FXN but will also contribute to making the protocol robust and scalable. Remember, this is not a counterparty vault. You are not betting against traders; your capital stays pegged to the USD. Understand that depositing and staking is a mandatory two-step process to earn all the rewards. You first need to deposit assets into the stability pool, then stake this stability pool token into the $FXN gauge. Hopefully, the UI abstracts this by triggering both transactions in a row.

Let’s get into it.

  • Make sure you have either fxUSD or USDC in your wallet.

  • Head over to the “Earn” page.

  • Connect your wallet using the upper right “Connect Wallet” button.

  • Look for the “fxUSD Stability Pool Gauge” strategy.

  • If not already, expand the strategy by clicking the down arrow button on the right of the box

  • Hit the “Deposit” button to see a deposit box popup.

  • Choose whether you want to deposit fxUSD or USDC using the down arrow

  • Type the desired amount

  • Keep the Stake toggle if you want to stake directly into the f(x) gauge. (Recommended - Untoggle it if you wish to stake elsewhere)

  • Choose whether you want to earn organic real yield paid in wstETH and WBTC or accumulate FXN rewards.

  • Click the “Deposit & Stake” button - Approve may also be prompted if you haven't already approved.

  • Confirm the transactions in your wallet.

If you have some unstaked Stability Pool tokens, you will see a “Stake” button; click it to stake them in the gauge and earn yield.

  • Type the desired amount.

  • Click the “Approve & Deposit” button (if already approved, it will be a simple “Deposit” button”)

  • Confirm the transactions in your wallet.

Please note that to prevent unfavorable arbitrages, unstaking from the stability pool is subject to either a cooldown period or a fast withdrawal fee. See and .

Risk parameters
Fees

Leverage

Where Does the Leverage Come From?

Leverage in f(x) Protocol originates from the innovative design of fTokens and xTokens, which split the price volatility of BaseTokens into stable and leveraged components. This allows users to balance between stability and risk, creating flexible investment strategies.

Key Features

fTokens (e.g., fETH, fxUSD, btcUSD):

  • Fully decentralized and native to Ethereum, Bitcoin, and Convex ecosystems.

  • Minimize volatility while maintaining slight market exposure (0% volatility for most fTokens, except fETH at 10%).

  • Support instant creation and trading to meet stablecoin demands.

xTokens (e.g., xETH, xeETH, xwBTC):

  • Perpetual long tokens for ETH, BTC, and CVX with built-in leverage.

  • Fully on-chain, composable, and highly liquid.

  • Offer low liquidation risk, providing a safer alternative for leveraged positions.

How It Works

Depositing BaseTokens:

  • Users deposit BaseTokens (e.g., wBTC for btcUSD and xwBTC) into the protocol.

Splitting Price Volatility:

The protocol splits the price volatility of collateral into two components:

  • fTokens: Absorb no market volatility (0% allocation, except 10% for fETH).

  • xTokens: Amplify leverage (100% allocation, except 90% for xETH).

Diversified Exposure:

  • This split enables users to diversify BaseToken exposure by balancing between stability (fTokens) and leverage (xTokens).

Minting and Redemption Fees:

  • fTokens: 0–0.25% fee.

  • xTokens: 1.5–2.5% fee.

  • Users can avoid these fees by trading tokens on secondary markets.

f(x) Protocol Documentation

The official source of information regarding f(x) Protocol

What is f(x) Protocol?

f(x) Protocol empowers DeFi to bring an innovative approach to stablecoins and leverage trading.

The f(x) invariant can split any yield-bearing asset into two components:

- A scalable decentralized stablecoin that captures sustainable on-chain real yield - fxUSD

- A leveraged position that delivers up to 10x leverage on ETH with minimal liquidation risk and funding cost - the xPOSITION.

On one hand, you can get the first USD delta neutral strategy that captures leveraged real yield (perps trading fees - ETH staking yield - FXN emissions) and; on the other hand, you can opt for a high-volatility position with minimized liquidation risk but without inherent yield.

100% on-chain & scalable. Let's get started 👇

Abstract

The genesis of f(x) Protocol

Stablecoins and leverage trading are the backbone of the crypto industry. Surprisingly, most efficient approaches so far relied on a trust assumption that is the opposite of what DeFi stands for. This time is over; let's dive into f(x) Protocol's paradigm shift.

Stablecoins

Most stablecoins are either centralized, capital inefficient or have unreliable pegs. DeFi users, DAOs, and institutions need a scalable stablecoin that doesn't require trusting any entity. Moreover, they need it to provide sustainable and attractive yields.

Leverage

By design, gaining leverage exposure can be dangerous. Liquidations melt the capital of the most adventurous traders, while funding rates erode it regardless. Regarding decentralization, most perps are built on centralized layers or rely on centralized execution elements, while the decentralized money markets offer very low leverage options.

The Genesis

March 2023, the most trusted stablecoin across DeFi, USDC, lost its peg toward $0,86 due to the collapse of a TradFi institution: the Silicon Valley Bank. Aladdin DAO attended, noted the above points, and, drawing on their experience as Concentrator and CLever, decided to change the paradigm of stablecoins and decentralized leverage forever. f(x) Protocol V1 was released on August 2023. By splitting any yield-bearing asset into a zero-volatility asset (stablecoin) and a high-volatility asset (leveraged token), it has already created the most capital-efficient decentralized stablecoin ever while offering a zero-liquidation solution for leverage traders. But the system could constantly be improved. 16 months and $70m TVL later, f(x) Protocol now unleashed it's V2 bringing:

On the leverage side.

  • Up to 7x leverage on ETH and BTC

  • Very minimized liquidation risk thanks to the rebalancing mechanism

  • No funding cost under normal market conditions

On the stable side, the first USD strategy:

  • Stays perfectly USD delta-neutral

  • Captures perp trading commissions

  • Earn enhanced stETH and WBTC yield

  • Has no counterparty risks

TLDR: the most attractive, scalable & sustainable, decentralized, stable yield strategy.

This documentation is here for you to get all the ins and outs of f(x) Protocol. You may finds all your questions answered.

Is 100% on-chain and doesn't rely on RWA

Core Products of f(x) Protocol

xPOSITION & sPOSITION (Leveraged Tool):

  • Offers up to 7x LONG and SHORT leverage on ETH and BTC

  • Fully decentralized, collateralized and on-chain

  • Minimal liquidation risk

  • Zero funding fees under normal market conditions, maximizing user returns

fxUSD (Stablecoin):

  • Fully decentralized and collateralized with a reliable and consistent peg

  • Minted and redeemed instantly in response to xPOSITION demand

  • Derives liquidity from collateral and generates sustainable on-chain yield

Key Functions of f(x)

Opening and Closing xPOSITION - Minting fxUSD

  • Users can open xPOSITION by providing stETH or WBTC as collateral. fxUSD is minted as a byproduct of the xPOSITION opening using the f(x) Invariant formula.

  • The system dynamically adjusts leverage ratios and fxUSD minting to maintain overall stability.

Opening an Closing sPOSITION

  • Users can open sPOSITION by providing fxUSD as collateral. The leverage is obtained using a flashloan which is repaid using the fxUSD's backing assets. .

  • The system adjust leverage ratios to maintain overall stability.

Rebalancing Operations

  • Automatically adjusts leveraged positions to safe levels (see ), significantly reducing liquidation risk.

  • This process is handled automatically by keepers.

Liquidation Mechanism

  • If rebalancing fails, the protocol initiates liquidation by redeeming associated fxUSD to always protect fxUSD's integrity.

  • This process is handled automatically by keepers.

Stability Pool

  • Offers yield opportunities for users while serving as a peg-keeper for fxUSD.

  • Maintains price stability through efficient arbitrage operations.

Learn more
Risk parameters

Creating a Leveraged LONG Position (xPOSITION)

xPOSITION is a non-fungible, high-beta leveraged long position that provides a powerful decentralized tool for on-chain high-leverage trading. When a user opens an xPOSITION, the process is seamlessly facilitated through the use of a flash loan. This is executed via an atomic transaction, ensuring that all steps are completed successfully or the entire transaction is reverted, preserving the integrity of both user funds and the protocol.

Here’s how the process works:

1. Collateral Submission

The user provides collateral (e.g., stETH or WBTC), which is used to mint fxUSD, the protocol's stablecoin, and fund the leverage mechanism.

2. Flash Loan for Collateral

The protocol employs flash loans to obtain the required amount of collateral to back the leverage position. The flash loan and the position creation occur atomically, ensuring the entire transaction either execute completely or not at all, thus avoiding partial execution risks.

3. Minting fxUSD

For every unit of xPOSITION, the protocol mints the required amount of fxUSD to manage volatility and maintain full collateralization. For example, a 7x leveraged position will have 1 unit of xPOSITION backed by 6 units of fxUSD. Meanwhile, the underlying collateral remains in stETH or WBTC, harnessing its yield while maintaining the desired leverage ratio.

4. xPOSITION Creation

Once the collateral is secured through flash loans and the necessary fxUSD is minted, the leveraged position (xPOSITION) is activated. At this stage, the user gains exposure to the underlying assets, and their position is opened.

fxMINT: borrowing fxUSD against your BTC and ETH

fxMINT allows you to mint fxUSD directly by depositing collateral (ETH/WBTC) at a 0% annual interest rate and with minimal liquidation risks. Instead of annual interests, we charge a one-time opening and closing fee for your loan. Keep the loan open for as long as you need. Note that a temporary borrowing cost can be applied to the whole collateral in rare circumstances. The mechanism is exactly the same as for xPOSITIONs, excluding the flashloan operation. While xPOSITIONs give you overexposure to the collateral, fxMINT maintains a constant exposure while achieving better capital efficiency. Using the xPOSITIONs infrastructure has multiple implications; let's break it down.

Here’s how the process works:

1. Collateral Submission

The user provides collateral (e.g., ETH or WBTC), which is used to mint fxUSD, the protocol's stablecoin, and fund the leverage mechanism.

2. Zap for Collateral

The protocol only uses wstETH and WBTC as collateral. If the users pledges WETH, it will be automatically swapped for wstETH. But remember, on f(x) Protocol, the collateral yields are mostly distributed to the stable stakers. It means that your leverage position keeps an ETH or WBTC exposure and doesn't earn yield on the collateral.

3. Minting fxUSD

fxUSD is minted using your collateral. On f(x) Protocol, you only pay a one-time fee when opening the position and when closing it. The fee is added to your debt position, resulting in a slightly higher amount of fxUSD to repay than what you receive in your wallet.

4. Repaying your debt

If you want to reduce your LTV/Leverage and or withdraw your collateral, you need to repay your fxUSD debt. When doing so, the closing fee is applied to the amount of repaid debt. Learn more about the fees below.

Understanding the temporary borrowing cost

Under certain market conditions, a temporary borrowing cost can be applied to your position. Since fxMINT utilizes the xPOSITION infrastructure, the cost is applied to the entire collateral. Please be aware that the lower the LTV of your position, the higher the borrowing cost is relative to your debt. Again, in most situations, that cost is temporary.

Learn more here:

What's the liquidation design for fxMINT?

Since fxMINT uses the same infrastructure as xPOSITIONS, the liquidation brake applies, protecting your position from any hard liquidation. Learn more about the liquidation brake 🔽

Learn more about the liquidation brake and hard liquidation LTVs.

💵Fees
How does f(x) Protocol minimize funding costs or annual interests?
🪂Rebalancing the Position (Liquidation Brake)
🚨Risk parameters

Creating a Leveraged SHORT Position (sPOSITION)

sPOSITION is a non-fungible, high-beta leveraged short position that provides a powerful decentralized tool for on-chain high-leverage trading. When a user opens an sPOSITION, the process is seamlessly facilitated through the use of a flash loan. This is executed via an atomic transaction, ensuring that all steps are completed successfully or the entire transaction is reverted, preserving the integrity of both user funds and the protocol.

Here’s how the process works:

1. Collateral Submission

The user provides collateral (fxUSD), which will be used to borrow directional collateral from the xPOSITION reserve.

2. Flash Loan for Collateral

The protocol employs flash loans to obtain the required amount of collateral (wstETH or WBTC) and sells it for fxUSD to back the leverage position, thus creating the short exposure. The flash loan and the position creation occur atomically, ensuring the entire transaction either executes completely or not at all, thus avoiding partial execution risks.

Please note that in the current iteration of sPOSITIONs, the ETH debt is wstETH-denominated. While the protocol doesn't charge any funding under normal conditions, the value of the debt naturally increases by the wstETH yield.

3. Borrowing directional assets from the xPOSITION reserve

The total fxUSD, consisting of both the user’s initial collateral and the flash loan-acquired fxUSD, is then deposited into the protocol to borrow the corresponding token (wstETH or WBTC) from the leverage long reserve. The borrowed collateral asset is immediately used to repay the flashloan, thereby establishing the user’s short position without requiring upfront access to the borrowed asset.

4. sPOSITION Creation

Once the collateral is secured through flash loans, the leveraged position (sPOSITION) is activated. At this stage, the user gains leveraged short exposure to the underlying assets, and their position is opened.

The f(x) Invariant

The f(x) Invariant is the core mechanism behind both V1 and V2. It enables on-chain leverage while delivering 100% capital efficiency for the stablecoins. f(x) Protocol ensures that the total value of all fxUSD combined with the total value of all xPOSITIONs is always equal to the total value of the collateral reserves. Dynamic adjustments to the leverage ratio of xPOSITION and the peg ratio of fxUSD enable seamless collaboration between low-volatility stablecoins and high-leverage trading tools.

The relationship is represented as:

Where:

  • 𝑛 is the number of TOKEN collateral,

  • 𝑠 is the TOKEN price in USD,

  • nf is the number of fxUSD,

  • 𝑓 is the fxUSD NAV in USD,

  • nx is the number of xPOSITION units, and

  • 𝑥 represents the NAV of xPOSITION in USD.

This formula ensures that the system remains balanced, maintaining integrity and stability across its decentralized financial tools.

WIth the addition of sPOSITION, the invariant evolved to ensure every fxUSD, xPOSITION and sPOSITION remained fully backed and that the protocol maintaines internal solvency across both long and short positions. The new invariant is:

Where:

  • 𝑛 is the number of TOKEN collateral,

  • is the amount of TOKEN collateral borrowed for short positions,

  • 𝑠 is the TOKEN price in USD,

  • nf is the number of fxUSD minted (longs),

Stability Pool

Stability Pool is a cornerstone of the protocol, designed to maintain system stability and provide rewards for participants.

1. Purpose and Rewards

Users can deposit fxUSD or USDC into the Stability Pool to either earn: - wstETH and WBTC (converted to wstETH) coming from xPOSITION fees and reserve yield and Aave yields. - Or $FXN emissions. This incentivizes participation and strengthens the protocol’s resilience.

2. Peg Stabilization

The Stability Pool ensures that fxUSD maintains its peg to USD through automatic swaps between fxUSD and USDC based on exchange conditions:

  • If fxUSD is undervalued: The pool swaps USDC for fxUSD to restore the peg.

  • If fxUSD is overvalued: The pool swaps fxUSD for USDC to stabilize its price.

These adjustments are executed using Chainlink oracle prices to ensure accurate valuations, offering price stability while optimizing returns for users.

3. Depeg Protection

In the rare event of a USDC depeg, the protocol halts peg maintenance and temporarily disables deposits to safeguard users and uphold system integrity.

4. Rebalance and Liquidation Procedures

When necessary, the protocol redeems fxUSD from the Stability Pool. If the pool lacks sufficient fxUSD, the USDC obtained is used to repurchase fxUSD at a ratio not exceeding 1:1, thereby stabilizing the peg.

5. Asynchronous or Synchronous Execution

Depending on market conditions, these operations can be carried out synchronously or asynchronously. This flexibility ensures sufficient liquidity while maintaining the fxUSD peg and supporting the overall stability of the system.

fxSAVE

fxSAVE is the tokenized stability pool built by (another protocol built by ). It is a 4626 vault that automatically compounds all wstETH and WBTC rewards into more fxUSD and USDC. Another way of describing fxSAVE is that it is a yield-bearing stablecoin that harnesses the Stability Pool's yields.

Looking at integrating fxSAVE into your protocol or automating deposits and withdrawals? Check our docs. fxSAVE is fully integrated into Enso to facilitate interactions from any chain.

Learn how to deposit into the Stability Pool and earn Stable yield 👇

Understanding the band system

Rebalancing operations are handled when the underlying price reaches a certain threshold (see ). To maximize the efficiency of these operations and ensure it is profitable for the keeper to execute them, all xPOSITIONs are grouped into the same price bands. Each price band width is 0.15%. If your rebalance price is $1710, when the price of ETH falls below that price, all xPOSITION who have a rebalance price between $1710 and $1712 will be rebalanced together.

Example

Alice opens a 2x position when ETH trades at $3000. She will be rebalanced when ETH price falls 43.2%, which is $1704 (LTV=88%)

Bob opens a 5x position when ETH trades at $1880. He will be rebalanced when ETH price falls 9.09% which is $1704 (LTV=88%)

Both Alice and Bob put in the same band. Once ETH price falls below $1704, all positions in this band will be rebalanced and brought back below LTV=88%.

Liquidation process

If the rebalancing process fails, your position could eventually reach the Liquidation line. If that happens, the rest of the position is entirely closed. It uses the same mechanism as described in the Rebalancing section, with two differences:

  • The entirety of the debt is burned (xPOSITION) or repaid (sPOSITION)

  • The liquidation bounty isn't necessarily the same as for rebalancings

Learn more about the rebalancing process here:

Learn more about the thresholds and bounty applied to the liquidation process here:

Concentrator
Aladdin DAO
developer
💰How to stake into the stability pool?
Risk parameters
🪂Rebalancing the Position (Liquidation Brake)
🚨Risk parameters

n−n^{-}n−f is the number of fxUSD locked (shorts),

  • X represents the NAV of xPOSITIONs in USD,

  • SP represents the total NAV of sPOSITIONs in USD.

  • n−n^{-}n−

    Rebalancing the Position (Liquidation Brake)

    The rebalancing mechanism

    After a position is opened, the protocol employs an automated rebalancing mechanism to maintain stability and ensure the leverage ratio stays within predefined safe limits.

    Rebalance is an automatic operation triggered when the leverage of a position reaches a predefined threshold (rebalance line). The protocol adjusts the leverage to bring it back to the rebalance line instead of liquidating a significant portion of the position. During this operation for xPOSITIONs:

    • fxUSD is first redeemed from the Stability Pool.

  • The underlying TOKEN is swapped for USDC to maintain system stability.

  • sPOSITIONs:

    • Borrowed asset is first paid back by keepers

    • The keeper gets fxUSD in return

    1. Continuous Monitoring

    External keepers continuously monitor market conditions and the leverage ratios of all open positions. If market fluctuations cause a position to drift outside safe leverage thresholds, the rebalancing mechanism is activated.

    2. Reducing Leverage

    1. xPOSITION & fxMINT - Via fxUSD Burning

    If leverage exceeds the safe limits—such as when ETH or BTC prices drop—the protocol automatically burns a portion of the fxUSD associated with the xPOSITION. The collateral backing the burned fxUSD is sold for fxUSD or USDC and returned to the Stability Pool. This adjustment reduces the leverage ratio while maintaining the user’s exposure to the underlying asset, effectively avoiding liquidation.

    This automated rebalancing process eliminates the need for manual interventions and prevents forced liquidations, offering users a more secure and reliable way to manage positions in volatile markets.

    1. sPOSITION - Via debt repayment

    If leverage exceeds the safe limits—such as when ETH or BTC prices surge—the protocol automatically repay a portion of the debt associated with the sPOSITION. The fxUSD backing the repaid debt is given to the keeper processing the operation. This adjustment reduces the leverage ratio while maintaining the user’s exposure to the underlying asset, effectively avoiding liquidation.

    This automated rebalancing process eliminates the need for manual interventions and prevents forced liquidations, offering users a more secure and reliable way to manage positions in volatile markets.

    Example of a rebalancing operation

    Alice opens a 5x position with 1ETH when ETH trades at $3000. She will be rebalanced when ETH price falls 9.09%, which is $2727 (LTV=88% - see Risk parameters). This is how her position looks at the opening.

    ETH Price
    xPosition size (USD)
    Position size (USD)
    Real time Leverage
    fxUSD debt
    LTV

    $3000

    $3000

    $15000

    5.00

    $12000

    80.00%

    Lousy luck, ETH price collapsed by 10% and reached $2700: Alice's xPOSITION will be rebalanced.

    Before rebalancing, this is how her position now looks:

    ETH Price
    xPosition size (USD)
    Position size (USD)
    Real time Leverage
    fxUSD debt
    LTV

    $2700

    $1500

    $13500

    9.00

    $12000

    88.89%

    The rebalancing process must burn enough fxUSD from her debt to bring her LTV back to 88%. The needed amount to burn can be calculated using the following formula.

    The redeeming bounty (see Risk parameters) is added to this amount.

    This is how the rebalancing process occurs:

    1. $1000 worth of fxUSD are burnt from the stability pool and deducted from Alice’s debt

    2. The corresponding amount of wsETH collateral + the keeper bounty is redeemed by the keeper.

    3. The equivalent amount of fxUSD or USDC is returned to the Stability Pool.

    Alice'sAfter the rebalancing process, Alice's position looks like this:

    ETH Price
    xPosition size (USD)
    Position size (USD)
    Real time Leverage
    fxUSD debt
    LTV

    $2700

    $1500

    $12500

    8.33

    $11000

    88%

    Her real-time leverage was stabilized to prevent her from liquidation. She kept market exposure. If the market recovers back to $3000:

    ETH Price
    xPosition size (USD)
    Position size (USD)
    Real time Leverage
    fxUSD debt
    LTV

    $3000

    $2889

    $13889

    4.81

    $11000

    79.20%

    Read More:

    fxUSDtoBurn=(Debt−PositionSize∗TargetLTV)/(1−TargetLTV)fxUSDtoBurn = ( Debt - PositionSize * TargetLTV)/(1-TargetLTV)fxUSDtoBurn=(Debt−PositionSize∗TargetLTV)/(1−TargetLTV)
    🟦What price drop would it require for my fxMINT or xPOSITION to be rebalanced/liquidated?

    WBTC

    Learn more about f(x) V2 oracle mechanism.

    The f(x) 2.0 price oracle mechanism for WBTC/USD combines multiple data sources, including Chainlink, Uniswap and Curve, to calculate spot prices and anchor prices. It defines Max and Min Price for WBTC/USD based on these sources and uses a governance-adjustable threshold (default 2%) to decide whether to rely on the Anchor Price or the Max/Min Price for operations like rebalancing, minting, or redeeming. This ensures accurate and stable pricing while accommodating market fluctuations. Below is the detailed breakdown of the WBTC Spot Price Oracle Mechanism:

    BTC/USD Spot oracle:

    1. []

    2. []

    3. [] * []

    WBTC/BTC Spot oracle:

    1. []

    WBTC/USD Anchor Price oracle:

    • [] * []

    The Algorithm of WBTC/USD Max and Min Price:

    • Max: WBTC/USD Price=Max(Anchor Price, [WBTC/BTC Spot Max Price ]*[BTC/USD Spot Max Price ])

    • Min: WBTC/USD Price=Min(Anchor Price, [WBTC/BTC Spot Min Price ]*[BTC/USD Spot Min Price ])

    Price Checking Mechanism:

    • Anchor Price is used, while the price difference between Anchor Price and Max/Min Price exceeds the threshold

    • The threshold is a governed parameter, 2% in default

    Conclusion:

    • Min WBTC/USD Price is used for Open/Close of xPOSITION risk control, Rebalance and Liquidation if the price difference between Anchor Price and Min Price doesn’t exceed the threshold. Anchor Price is used otherwise.

    • Max WBTC/USD Price is used for Redeeming fxUSD if the price difference between Anchor Price and Max Price doesn’t exceed the threshold. Anchor Price is used otherwise.

    • Max WBTC/USD Price is used for Open/Close of sPOSITION risk control, Rebalance and Liquidation if the price difference between Anchor Price and Max Price doesn’t exceed the threshold. Anchor Price is used otherwise.

    Min WBTC/USD Price is used for Redeeming sPOSITIONs when the system runs out of leverage long collaterals to meet xPOSITIONs’ closing and risk management options if the price difference between Anchor Price and Min Price doesn’t exceed the threshold. Anchor Price is used otherwise.
    Chainlink BTC/USD Spot
    Uniswap V3 WBTC/USDC 0.3% Spot
    Uniswap V3 WBTC/ETH 0.3% Spot
    Uniswap V3 USDC/ETH 0.05% Spot
    Chainlink WBTC/BTC Spot
    Chainlink WBTC/BTC Spot
    Chainlink BTC/USD Spot

    Oracle

    Learn more about f(x) V2 oracle mechanisms.

    WBTCstETH

    Advanced Peg Protection Mechanisms

    The protocol ensures fxUSD's peg at all times by implementing 4 different incremental peg-keeping mechanisms.

    Stability Pool acts as Peg-Keeper

    The stability pool accepts both fxUSD and USDC. If fxUSD trades below $1.00, it will automatically buy it and sell it back to USDC if fxUSD trades above $1.00.

    ➡️ Ensures fxUSD stability through arbitrage operations in the fxUSD/USDC AMM pool.

    Operational Restrictions During Depegging

    If fxUSD is depegged, new xPOSITION openings are prohibited. This prevents excessive fxUSD minting and reduces selling pressure on fxUSD.

    ➡️ No more selling pressure on fxUSD if traded below peg.

    Funding Fees

    If the Stability Pool lacks the needed assets to keep the peg close enough to $1, funding can temporarily be applied to x and s POSITIONS. Different incremental levels of funding are used depending on the situation to keep the best peg while delivering the best user experience to leverage traders and minimizing their costs. xPOSITION: Funding fees of xPOSITONs are determined based on the percentage of fxUSD held within the Stability Pool:

    • When the percentage of fxUSD in the Stability Pool exceeds Threshold A, Funding Level I activates.

    • If fxUSD depegs and exceeds Threshold B in the Stability Pool, Funding Level II activates. This higher funding fee is set at a significantly elevated level (e.g., a multiplier of Aave USDC borrow rate) to accelerate deleveraging and encourage peg restoration.

    This funding is delivered to:

    • The Stability Pool, making it more attractive to USDC deposits, thus facilitating the peg restoration.

    • sPOSITIONs, making it more attractive to open a short position that will support fxUSD's peg by essence.

    ➡️ The Stability Pool gets a high real yield, facilitating the peg keeping.

    ➡️ Users get an incentive to open sPOSITIONs when needed, preventing fxUSD's depeg.

    sPOSITION:

    The addition of sPOSITION to the protocol brings an organic and consistent buying pressure to fxUSD that may prevent the previous operations from being necessary. sPOSITION funding fees are applied when the utilization of long collateral assets exceeds prudent lending thresholds.

    When the percentage of leverage long collateral lent out to sPOSITIONs exceeds Threshold C, Funding Level III activates. This funding fee is applied to all open sPOSITIONs borrowing the corresponding collateral asset.

    The funding fees are delivered to xPOSITIONs, making it more attractive to open a long position, thus preventing fxUSD from trading above $1. ➡️ Users get an incentive to open xPOSITIONs when needed, avoiding fxUSD's overpeg.

    Redemption of fxUSD

    When fxUSD is depegged, users can purchase it on the secondary market and redeem it for $1.00 worth of collateral, subject to applicable fees. ➡️ Redemption acts as a last resort mechanism to guarantee fxUSD's peg if the previous mechanisms have failed.

    Fees

    Please find all the fee settings below. Mind that they are all adjustable by governance.

    Fee
    Setting

    ETH xPOSITION and sPOSITION Opening fee

    0.3%

    ETH xPOSITION and sPOSITION Closing fee

    0.1%

    BTC xPOSITION and sPOSITION Opening fee

    0.3%

    BTC xPOSITION and sPOSITION Closing fee

    0.1%

    Funding Cost Level I

    Want to learn how these fees are redistributed? Take a look at the section below 👇

    stETH

    Learn more about f(x) V2 oracle mechanism.

    The f(x) 2.1 price oracle mechanism for stETH/USD combines multiple data sources, including Chainlink, Uniswap, Curve, and Balancer, to calculate spot prices and anchor prices. It defines Max and Min Price for stETH/USD based on these sources and uses a governance-adjustable threshold (default 1%) to decide whether to rely on the Anchor Price or the Max/Min Price for operations like rebalancing, minting, or redeeming. This ensures accurate and stable pricing while accommodating market fluctuations. Below is the detailed breakdown of the stETH Spot Price Oracle Mechanism:

    ETH/USD Spot oracle:

    1. []

    2. []

    3. []

    stETH/ETH Spot oracle:

    1. []

    2. []

    3. [

    stETH/USD Anchor Price oracle:

    • [ ]*[]

    The Algorithm of stETH/USD Max and Min Price:

    • Max: stETH/USD Price=Max(Anchor Price, [stETH/ETH Spot Max Price ]* [ETH/USD Spot Max Price ])

    • Min: stETH/USD Price=Min(Anchor Price, [stETH/ETH Spot Min Price ]* [ETH/USD Spot Min Price ])

    Price Checking Mechanism:

    • Anchor Price is used, while the price difference between Anchor Price and Max/Min Price exceeds the threshold

    • The threshold is a governed parameter, 1% in default

    Conclusion:

    • Min stETH/USD Price is used for Open/Close of xPOSITION risk control, Rebalance and Liquidation if the price difference between Anchor Price and Min Price doesn’t exceed the threshold. Anchor Price is used otherwise.

    • Max stETH/USD Price is used for Redeeming fxUSD if the price difference between Anchor Price and Max Price doesn’t exceed the threshold. Anchor Price is used otherwise.

    • Max stETH/USD Price is used for Open/Close of sPOSITION risk control, Rebalance and Liquidation if the price difference between Anchor Price and Max Price doesn’t exceed the threshold. Anchor Price is used otherwise.

    AAVE USDC borrowing rate charged on xPOSITIONs only when there is too much fxUSD in the Stability Pool (see Advanced Peg Protection Mechanisms)

    Funding Cost Level II

    AAVE USDC borrowing rate x10 charged on xPOSITIONs only when fxUSD depegs for too long (see Advanced Peg Protection Mechanisms)

    Funding Cost Level III

    AAVE USDC borrowing rate x10 charged on sPOSITIONS only when a certain threshold of xPOSITION collateral is lent out (See Risk parameters)

    Rebalance / Liquidation

    10% of the bounty (see Risk parameters)

    Unused slippage

    f(x) offers the lowest trading commissions. To compensate for this, any unused slippage will be retained to incentivize stablecoin supply in the Stability Pool. You can set your own slippage.

    Collateral Yield / Funding / fxSAVE harvesting bounty (keeper incentive)

    1% (0.01% for fxSAVE currently)

    Stability Pool early exit fee

    1%

    fxMINT ETH opening fee (of minted debt)

    0.5%

    fxMINT ETH closing fee (of repaid debt)

    0.2%

    fxMINT BTC opening fee (of minted debt)

    0.8%

    fxMINT BTC closing fee (of repaid debt)

    0.2%

    🔥Protocol Revenue & Distribution
    Min stETH/USD Price is used for Redeeming sPOSITIONs when the system runs out of leverage long collaterals to meet xPOSITIONs’ closing and risk management options if the price difference between Anchor Price and Min Price doesn’t exceed the threshold. Anchor Price is used otherwise.
    https://data.chain.link/feeds/ethereum/mainnet/eth-usd
    https://app.uniswap.org/explore/pools/ethereum/0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640
    https://app.uniswap.org/explore/pools/ethereum/0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8
    stETH/ETH Curve Spot
    stETH/ETH Univ3 Spot
    stETH/ETH Curve2 Spot]
    stETH/ETH Curve EMA
    ETH/USD Chainlink Spot

    Audit Reports

    As with every Aladdin DAO product, every line of code in production has been audited. Please find all the audits reports below.

    Audit
    Date
    Auditor

    All the Aladdin DAO audits

    https://github.com/AladdinDAO/aladdin-v3-contracts/tree/main/audit-reports

    f(x) Protocol V1

    June 14, 2023

    Secbit

    Stability Pool

    July 25, 2023

    Secbit

    f(x) Protocol V1 Update

    september 17, 2023

    Secbit

    V1 Gauge mechanism

    November 29, 2023

    Secbit

    Stability Pool Boost Mechanism

    December 13, 2023

    Secbit

    veFXN boost delagation for stability pool farming

    January 18, 2024

    Secbit

    V1 fxUSD

    February 23, 2024

    Secbit

    f(x) Protocol overall audit

    April 16, 2024

    Trail of Bits

    btcUSD

    April 19, 2024

    Secbit

    New Oracle Design

    May 14, 2024

    Secbit

    arUSD

    June 18, 2024

    Secbit

    New Oracle Design

    July 10, 2024

    Trail of Bits

    aFXN

    July 26, 2024

    Secbit

    f(x) Protocol V2

    January 01, 2025

    Secbit

    V2 WBTC Oracle + batched rebalancings and liquidations

    March 17, 2025

    Secbit

    fxSAVE

    March 17, 2025

    Secbit

    f(x) Protocol V2.1 -( sPOSITIONs

    July 22, 2025

    Secbit

    f(x) Protocol V2.0, covering leveraged trading logic, fxUSD stability, oracle systems, and asset management

    August 4, 2025

    OpenZeppelin

    f(x) Protocol V2 - Limit Orders and fxMINT report

    October 30, 2025

    Secbit

    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/SECBIT_f(x)_Protocol_Report_v1.0_20230614.pdf
    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/SECBIT_f(x)_Protocol_RebalancePool_Report_v1.2_20230725.pdf
    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/SECBIT_f(x)_Protocol_Update_Report_v1.1_20230917.pdf
    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/SECBIT_f(x)_Protocol_New_Features_Report_v1.1_20231129.pdf
    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/SECBIT_f(x)_Rebalance_Pool_Boost_Report_v1.0_20231213.pdf
    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/SECBIT_f(x)_Shareable_RebalancePool_Report_20240118.pdf
    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/SECBIT_f(x)_FxUSD_Report_v1.0_20240223.pdf
    https://github.com/trailofbits/publications/blob/master/reviews/2024-03-aladdinfxprotocol-securityreview.pdf
    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/fx_btcUSD_Report_v1.0_2024_04_19.pdf
    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/SECBIT_f(x)_New_Oracle_Report_v1.0_20240514.pdf
    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/SECBIT_Concentrator_arUSD_Report_v1.0_20240618.pdf
    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/TrailofBits_fx_oracle_202406.pdf
    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/SECBIT_Concentrator_aFXN_Report_v1.0_20240726.pdf
    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/SECBIT_f(x)_V2_Report_v1.2_20250101.pdf
    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/SECBIT_f(x)_Update_Batch_Rebalance_WBTC_Oracle_Report_v1.0_20250317.pdf
    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/SECBIT_f(x)_fxSAVE_And_StabilityPoolUSDCStrategy_Report_v1.1_20250317.pdf
    https://github.com/AladdinDAO/audit-reports/blob/main/SECBIT_f(x)_V2.1_Report_v1.0_20250722.pdf
    https://blog.openzeppelin.com/fx-v2-audit
    https://github.com/AladdinDAO/aladdin-v3-contracts/blob/main/audit-reports/SECBIT_f(x)_LimitOrder_fxMint_Report_v1.0_2025_10_30.pdf

    USD high & sustainable yield

    f(x) Protocol V2 delivers a unique USD yield value proposition with its Stability Pool. It offers the best risk rewards strategy by being collateralized with Tier 1 DeFi assets and collecting high and sustainable yield sources. Learn more here 👇

    💰Stability Pool

    The "Earn" section of the protocol also offers different stable strategies, such as the Curve fxUSD/USDC pool or V1 stability pool.

    Learn more about V1 stability pools here.

    Stability Mechanism

    veFXN

    $FXN runs under the ve tokenomics popularized by Curve. Locking FXN gets you veFXN. The longer the lock time, the more veFXN received.

    • 1 FXN locked for 4 years = 1 veFXN

    • 1 FXN locked for 3 years = 0.75 veFXN

    • 1 FXN locked for 2 years = 0.5 veFXN

    • 1 FXN locked for 1 year = 0.25 veFXN

    Risk framework

    Aladdin DAO's absolute priority is to ensure the integrity of all stakeholders' capital. Please find the incremental risk framework applied to f(x) Protocol below.

    1. Rebalancing - Liquidation Brake

    The liquidation brake mechanism maintains all leverage positions at the safest leverage levels in a progressive manner. It enables the best compromise between capital efficiency and the protocol's integrity.

    🪂Rebalancing the Position (Liquidation Brake)
    1. Liquidation

    In the event of failure in the previous step, hard liquidations can be triggered to preserve fxUSD's backing.

    Liquidation process
    1. Reserve Fund

    In the event of failure of the two previous steps, the protocol can face bad debt. A portion of the collected protocol fees is held in a Reserve Fund, which serves as a first layer of compensation in the event of any bad debt occurrence.

    1. Bad Debt Redistribution

    If the Reserve Fund can't compensate for all the bad debt, it is shared among the remaining leveraged positions. More specifically:

    • In case of under-collateralized debt on xPOSITIONs, the shortfall is proportionally redistributed across active xPOSITIONs if the reserves are insufficient.

    • Regarding sPOSITIONS:

      • If the overall sPOSITION LTV is still below 100%, the system will redistribute bad debt from insolvent sPOSITIONs to healthy sPOSITIONs

      • In the very unlikely occurrence of an overall sPOSITION LTV crossing 100%, which means all the previous steps would have failed:

    1. Recapitalization

    If the total collateralization ratio drops below 100%, the protocol halts new xPOSITION openings and deploys protocol assets to restore the fxUSD peg.

    Risk parameters

    Please find the risk parameters of the protocol below. Note that all of them are adjustable by governance.

    Global Risk Parameters

    Parameter
    Value

    Pegging Risk Parameters

    Parameter
    Value

    • All operations (open/close/rebalance/liquidate/redeem) are disabled

    • All outstanding sPOSITION bad debt gets charged as one-off funding to xPOSITIONs

    • All sPOSITIONs' outstanding collateral (fxUSD) is redeemed against xPOSITIONs. It works exactly the same as the fxUSD redemption process, except that there is no redemption fee in this case.

    🚨Risk parameters

    Curve fxUSD/USDC EMA price hits 0.998

    Distribution of xPOSITIONs' collateral lent out to sPOSITIONs - Threshold C

    45%

    Distribution of xPOSITIONs' collateral lent out to sPOSITIONs - Debt Cap

    50%

    fxUSD's upward depeg threshold

    1.002

    Rebalance Line

    LTV = 88%

    Rebalance Bounty

    2,5%

    Liquidation Line

    LTV = 95%

    Liquidation Bounty

    4%

    Stability Pool TVL threshold under which keepers can use their funds to rebalance

    $10,000

    Leverage Range

    1.1x - 7x

    Stablity Pool redemption Period

    60 minutes

    Maximum amount USDC from the Stability Pool deposited on Aave Core (FIP-12)

    80%

    Maximum amount of wstETH from the reserve deposited on Aave Prime (FIP-12)

    80%

    Stability Pool peg arbitrage threshold

    0.3%

    Redemption fee

    0.5%

    Max redeemed fxUSD proportion of xPOSITION at a time, starting with the highest leverage

    20%

    USDC depeg threshold to disable USDC deposits into the Stability Pool

    USDC Oracle Price hits 0.995 or below

    fxUSD distribution in the Stability pool - Threshold A

    95%

    fxUSD distribution in the Stability pool - Threshold B

    100%

    fxUSD Depeg threshold - funding threshold B

    Referral Program

    f(x) Protocol offers a very straightforward referral program that lets both referrer and referee earn extra yield. The mechanism is very simple:

    • Create a referral code using the Referral center

    • Share your referral link or invite friends to use your code. To use your code, they can either follow your link or click on the "Earn extra APR" button on the Earn page to type your code. In both cases, they must sign the subscription using their wallet (no gas required).

    • Your friends earn an extra 0,5% APR on every stablecoin deposited into the V2 Stability pool or the fxUSD/USDC Curve pool. Convex deposits are eligible.

    • You earn 1% APR on all your friends deposits.

    You can claim the FXN rewards monthly by going to the referral center.

    Protocol Revenue & Distribution

    The f(x) Protocol generates revenue through multiple mechanisms designed to sustain the system while rewarding participants and long-term supporters.

    1. Revenue Sources

    • Collateral Yields: Earnings derived from the collateral (e.g., stETH) backing the protocol.

    • Opening and Closing Fees: Fees collected when users open or close xPOSITIONs, contributing to the protocol's revenue stream.

    2. Revenue Distribution

    All fees and collateral yields are redistributed between the Stability Pool, the xPOSITIONs and sPOSITIONs, and the f(x) Treasury, with the allocation determined by governance.

    • Stability Pool: A portion of the revenue supports the Stability Pool, reinforcing system stability and rewarding participants.

    • xPOSITIONs and sPOSITIONs: as they are leveraged positions, incentivizing their openings brings significant impacts on fxUSD's peg.

    • f(x) Treasury: The remaining revenue is allocated to the Treasury, where a proportion of it is distributed to veFXN holders. This mechanism provides long-term supporters with substantial financial benefits, fostering a robust and engaged community around the protocol.

    Fees Distribution Parameters

    Global

    Fee
    Distribution

    ETH xPOSITIONs and fxMINT positions

    Fee
    Distribution

    BTC xPOSITIONs and fxMINT positions

    Fee
    Distribution

    BTC & ETH sPOSITIONs

    Fee
    Distribution

    *The rebate reserve is built to offer a fee rebate in the future 👀

    Looking at the fee settings? 👉

    Protocol Revenue Distribution Parameters

    All fees captured by the Treasury are distributed in this way.

    The Treasury Multisig allocation helps to sustain the protocol by funding further developments

    How do f(x) Protocol stablecoins maintain stability?

    Stablecoins can be minted and redeemed at the oracle price, ensuring seamless functionality. For fxUSD, several mechanisms guarantee a perfect peg:

    • f(x) Protocol establishes and maintains a deep fxUSD/USDC liquidity pool.

    • The fxUSD stability pool offers high and sustainable yields derived from stETH staking, xPOSITION opening fees, and FXN emissions. This stability pool, which accepts both USDC and fxUSD, also acts as a peg keeper by purchasing fxUSD when it trades below peg and selling it back to USDC when it trades above.

    • xPOSITION cannot be opened if fxUSD is trading below peg.

    • fxUSD can always be redeemed at the oracle price for stETH or WBTC, safeguarding it against any significant de-peg events. Learn more here.

    fxUSD redemption fee

    70% to the Stability Pool / 30% Protocol Revenue

    Stability Pool early exit fee

    100% to the Stability Pool

    Collateral Yields

    A dynamic percentage based on the shorts debt ratio versus the longs collateral goes to the sPOSITIONs / The rest to the Stability Pool

    xPOSITION and fxMINT opening/closing fees

    70% to the Stability Pool / 30% Protocol Revenue

    Rebalance / Liquidation: 10% of the bounty

    70% to the Stability Pool / 30% Protocol Revenue

    Funding costs (Level I & II)

    A dynamic percentage based on the shorts debt ratio versus the longs collateral goes to the sPOSITIONs / The rest to the Stability Pool

    Unused Slippage

    50% to the Stability Pool / 50% to the Protocol Revenue

    Aave yields (FIP-12)

    100% to the Stability Pool

    xPOSITION / fxMINT opening/closing fees

    50% to the Stability Pool / 50% Protocol Revenue

    Rebalance / Liquidation: 10% of the bounty

    50% to the Stability Pool / 50% Protocol Revenue

    Funding costs (Level I & II)

    A dynamic percentage based on the shorts debt ratio versus the longs collateral goes to the sPOSITIONs / The rest to the Stability Pool

    Unused Slippage

    50% to the Stability Pool / 50% to the Protocol Revenue

    sPOSITION opening/closing fees

    100% Protocol Revenue

    Rebalance / Liquidation: 10% of the bounty

    100% Protocol Revenue

    Funding costs (Level III)

    100% to the xPOSITIONs

    Unused Slippage

    100% Protocol Revenue

    veFXN

    75%

    Treasury Multisig

    12,5%

    Reserve / Insurance Fund

    12,5%

    Fees
    ✅Advanced Peg Protection Mechanisms

    Is fxUSD an algorithmic stablecoin?

    Absolutely not. All stablecoins issued by f(x) Protocol, including its flagship fxUSD, are fully collateralized with top-tier DeFi assets. Specifically, fxUSD is backed solely by Lido's stETH and WBTC. The f(x) invariant ensures unparalleled capital efficiency by maintaining the stablecoin's 100% collateralization, while the xPOSITION (v2) and leveraged tokens (v1) manage the protocol's over-collateralization.

    How does f(x) Protocol minimize funding costs or annual interests?

    Most perp protocols rely on funding costs to balance long and short demand.

    f(x)’s unique design doesn’t rely on this, as the counterparty of every trade is a concentrated liquidity DEX pool with deep liquidity thanks to sustainable yields. The first pegkeeping mechanism for fxUSD is the Stability Pool. If the Stability Pool lacks of USDC to secure a good peg for fxUSD, the cost of borrowing USDC on Aave is charged to thefxMINT and xPOSITIONs. This fee is mostly directed to the Stability Pool and sPOSITIONs until the peg is restored (see Protocol Revenue & Distribution). This fee can be considered as a funding cost or interest temporarily applied to the position. If that is not enough to keep the peg, and if fxUSD trades below the depeg threshold (see Risk parameters), the fee applied is amplified by an order of magnitude defined by governance, until the peg is restored. When too much of the xPOSITION collateral is lent out to sPOSITIONs, a funding/interest may be applied to sPOSITIONS and directed to xPOSITIONs. To summarize in most situations, you don’t pay any funding or interest fee. However, when the peg of fxUSD could be threatened, a variable fee may be temporarily applied to your position. It's important to note that other peg-keeping mechanisms in place should prevent that scenario from happening regularly, providing a sense of reassurance. Learn more 👇

    ✅Advanced Peg Protection Mechanisms

    Why is my execution price different from what the chart displays?

    xPOSITIONs and sPOSITIONs are on-chain leverage tools. It means that 100% of the execution occurs on-chain without involving any centralized market maker or order book. On-chain execution can result in a discrepancy between the oracle-estimated execution price and the actual execution price. Please note that the charts currently displayed on the dapp are CEX charts displayed for informational purposes, rather than oracle-based charts. When opening or closing a position at the market price, the execution may face price impacts and fees at different levels, excluding the protocol fees:

    • Swapping the collateral with USDC - For instance, WBTC's main liquidity pool with USDC charges a 0.3% swap fee on Uniswap.

    • Swapping USDC with fxUSD - The fees here are minimal; however, depending on the current liquidity and the trade size, a small price impact may occur.

    The size of your position increases the effect.

    To mitigate this:

    • Mind the slippage setting before interacting with the protocol

    • Upcoming limit orders should deliver a perfect execution

    • We are progressively integrating dex aggregators API to deliver better execution prices

    How does f(x) Protocol minimize liquidations?

    f(x) Protocol uses its rebalancing mechanism to minimize any risk of liquidation. This means scenarios where a sudden market drop that would normally liquidate your entire long position just before a rally are unlikely to occur. However, this doesn't eliminate the risk of losing money as leverage amplifies both potential gains and losses.

    xTokens (v1): In highly extreme scenarios, leveraged xTokens could potentially lose all of their value. However, the protocol's primary goal is to prevent this. Multiple Stability Mechanism are in place to ensure this doesn't happen.

    xPOSITION (v2): If your position reaches a price level that would normally trigger liquidation on a regular perpetual exchange, it will instead be rebalanced to a different leverage level. While this operation incurs a small fee, it keeps you as much as possible exposed to the market, giving you a chance to recover. In extreme cases where the rebalancing operation fails, liquidation may occur to protect fxUSD's backing and peg. But there is a very small risk of this occurring. Learn more by following the link below.

    🪂Rebalancing the Position (Liquidation Brake)

    What is the difference between f(x) Protocol V1 and V2?

    From a user perspective, v1 offers variable leverage tokens, providing up to 4.3x leverage on ETH and 5.6x on wBTC. Most leveraged tokens incur no funding costs. With its unique value proposition—leverage without liquidation or funding costs—and a scalable decentralized stablecoin, v1 serves as a robust solution. However, the unpredictability of variable leverage may not suit everyone's needs. This is where v2 steps in, introducing a groundbreaking feature: Fixed Leverage of up to 10x, fully on-chain, with minimal liquidation risk and funding costs.

    v2 also offers an exclusive feature through its stability pool, which delivers exceptionally high and sustainable yields derived from PERP trading commissions. These yields are achieved without exposing stakers to market volatility. The pool is USD delta-neutral and avoids counterparty risk, unlike other perpetual exchange protocols.

    v1 still remains an excellent option, offering a unique use case by splitting any yield-bearing asset into two tokens: a stablecoin and a leveraged xToken. The stablecoins can harness enhanced yield without market exposure, while xTokens enjoy enhanced market exposure without yield.

    $FXN Tokenomics

    f(x) Token Distribution

    Token Name: f(x) Protocol Token

    Token Symbol: FXN

    Token Supply: 2,000,000 $FXN

    FXN Distribution

    CategoryPercentageVesting Schedule

    Category
    Percentage
    Vesting Schedule

    FXN Release Schedule

    0.5%

    Vested linearly over 12 months

    veCLEV Holders

    0.25%

    Vested linearly over 12 months

    veCTR Holders

    0.25%

    Vested linearly over 12 months

    Aladdin DAO

    30%

    Vested linearly over 24 months, ve-locked after vesting

    Initial Liquidity

    1%

    Strategic Partnerships

    1%

    Vested linearly over 12 months

    Liquidity Incentives

    49%

    5% vested linearly in the first year, decreasing by 10% each year thereafter. e.g., 5% on the first year, 4.5% on the second year, 4.05% on the third year... until 0%. Full emission will take 50 years to complete, starting in 2023.

    Community Contributors

    3%

    Vested linearly over 12 months & lasting 3 years:1.5% for Year 1, 1% for Year 2, 0.5% for Year 3

    Treasury Reserve

    10%

    Vested linearly over 24 months

    IDO

    5%

    Testnet/Beta/IDO Users

    What price drop would it require for my fxMINT or xPOSITION to be rebalanced/liquidated?

    f(x) Protocol prevents leverage traders from being liquidated by rebalancing the positions before liquidation would be required. The LTV at which the protocol rebalances or liquidates the xPOSITION is set by governance (see Risk parameters). The price distance to reach the rebalancing LTV depends on the leverage level the user chooses. You can find some examples of price drops required to reach the rebalancing line or liquidation line according to the leverage of an xPOSITION below.

    The UI provides the exact price of rebalancing and liquidation line for your xPOSITION when opening it and can be consulted in your dashboard once the position is open. The table below is an example.

    Leverage
    Price drop to rebalance (LTV=88%)
    Price drop to liquidation (LTV=95%)

    Learn more about the rebalancing and liquidation process below.

    Where does the yield come from?

    This is the question everyone should ask themselves when assessing any yield opportunity. The main f(x) strategy is the Stability Pool. Many wonder how f(x) can deliver yields while offering no funding / no borrowing cost leverage. You'll find a detailed answer below, but first, note that while the xPOSITIONs incur no recurring borrowing costs (in most conditions), there is a one-time opening and closing fee. Learn more here: Creating a Leveraged LONG Position (xPOSITION) The stability pool accepts both fxUSD and USDC and gives exposure to both assets. It harnesses different sources of real, organic, and sustainable yields.

    • xPOSITION opening and closing fees

    • The reserve's yields. Remember, ETH xPOSITIONS are backed by wstETH which generates staking yields. Plus, a portion of it is deposited on Aave* to capture even better rewards.

    • USDC's lending yield on Aave*

    • Other occasionnal revenue. You can find all the details on that page:

    OR

    $FXN. Indeed, depending on what you'd rather accumulate with your stablecoins: wstETH, stables (fxSAVE), or FXN you can opt for FXN emissions instead of real yield.

    *Following the , some of the wstETH of the reserve and USDC of the Stability Pool are deposited into Aave. The maximum dsitribution deposited can be found on .

    How to open a leverage position (xPOSITION)

    xPOSITIONS offer up to 10x leverage on ETH. To open a position:

    • Head over to the page.

    • Connect your wallet using the upper right “Connect Wallet” button.

    • Input the amount you would like to leverage. The default asset is USDC; you can pledge other assets by clicking the down arrow.

    Protocol Revenue & Distribution
    FIP-12
    Risk parameters

    -9.77%

    2

    -43.18%

    -47.37%

    3

    -24.24%

    -29.82%

    4

    -14.77%

    -21.05%

    5

    -9.09%

    -15.79%

    6

    -5.30%

    -12.28%

    7

    🪂Rebalancing the Position (Liquidation Brake)

    -2.60%

    Set the requested leverage using the slider bar and wait for the preview to load.

  • Hit the Preview button to review your trade.

  • Review your trade and the evolution of your xPOSITION, and once you are ready, click the “Submit Transaction” button.

  • Confirm the transaction using your wallet.

  • You’re all set. You can now track your position on your Dashboard on the “Trade” page.

    Trade

    How to add/reduce a leverage position?

    Adding up or reducing an xPOSITION is as easy as creating or closing one.

    You can create as many xPOSITION as you want; they will all be aggregated into a single global one.

    For example, suppose you create a first xPOSITION with a 2x leverage worth $10,000 and a second xPOSITION with a 4x leverage worth $10,000. In that case, you will end up with a $20,000 xPOSITION with a 3x leverage (assuming you opened them simultaneously with the same execution price). Now, let’s see how to do that practically.

    How to add to a leverage position

    Head over to the Trade page.
  • If not already, hit the “Buy / Open” tab.

  • Connect your wallet using the upper right “Connect Wallet” button.

  • Input the amount you would like to leverage. The default asset is USDC; you can pledge other assets by clicking the down arrow.

  • Set the requested leverage using the slider bar and wait for the preview to load.

  • Hit the Preview button to review your trade.

  • Review your trade and the evolution of your xPOSITION, then click the “Submit Transaction” button when ready.

  • Confirm the transaction using your wallet.

  • How to reduce a leverage position

    • Head over to the Trade page.

    • Connect your wallet using the upper right “Connect Wallet” button.

    • Click on the “Sell / Close” tab of the order box.

    • Slide the bar to the desired amount / Type the amount or the percentage in the text box you would like to close.

    • Hit the Preview button to review your trade.

    • Review your trade and the evolution of your xPOSITION, then click the “Submit Transaction” button when ready.

    • Confirm the transaction using your wallet.

    How to unstake from the stability pool?

    Understand that withdrawing from the stability pool gauge to fxUSD & USDC is a two-step process. You first need to unstake from the $FXN gauge, then withdraw this stability pool token for USDC and fxUSD. There is a redemption period (see ) from the stability pool to prevent unhealthy arbitrage operations.

    • Head over to the “” page.

    • Connect your wallet using the upper right “Connect Wallet” button.

    • Look for the “fxUSD Stability Pool Gauge” strategy.

    If not already, expand the strategy by clicking the down arrow button on the right of the box

  • Hit the “Withdraw” button to see a withdraw popup.

  • If all your tokens are staked in the FXN gauge:

    • Type the desired amount to be withdrawn.

    • Toggle the "Fast" option if you'd rather withdraw instantly and pay a small fee. Leave it untoggled to wait for the redemption period.

    • Click the “Approve & Unstake & Withdraw” button (if already approved, it will be a simple “Unstake & Withdraw” button”)

    • Confirm the transactions in your wallet.

    • If you didn't opt for the instant withdrawal, wait for the redemption period to be completed. You can track the remaining time on the page.

    • Follow the instructions below to withdraw your Stability Pool tokens to fxUSD and USDC.

    If you have some unstaked stability pool tokens:

    • Click on the FXN Gauge dropdown menu and select “fxUSD Stability Pool”

    • Type the desired amount to be withdrawn.

    • Click the “Approve & Withdraw” button (if already approved, it will be a simple “Withdraw” button”)

    • Confirm the transactions in your wallet.

    Risk parameters
    Earn
    Earn

    How do the limit orders work?

    A Limit Order allows users to automatically open or close a position at a specified price within a set period of time.

    When the market price reaches the trigger condition you set, the system will automatically execute your order — creating a true “set-and-forget” trading experience.

    💡 Important:

    As always in DeFi, a limit order is not guaranteed to execute.

    Keepers will only execute your order when the market price is sufficient to cover both your limit price and network fees.

    Therefore, your order may not execute immediately when the price first reaches your limit level.

    1. Before You Start

    • No gas fees are required to place an order. Gas is only required in case of cancelling your currents orders.

    • Opening orders currently only accept fxUSD as base asset, use your favorite DEX aggregator to get some.

    • You only need to authorize fxUSD and, if applicable, your position NFT.

    Looking at automating the limit orders? Look at the .

    2. Order Parameters

    3. Limit Order Types

    Execution Conditions & Mechanism

    • The protocol uses Chainlink Oracle prices.

    • Only when the Oracle price meets the Trigger Price condition can a keeper initiate the trade.

    • Execution occurs exactly at the Limit Price, with no slippage.

    • Minimum trade size: 100 fxUSD (to incentivize Keeper execution).

    ⚠️ Even when conditions are met, execution is not guaranteed and depends on keeper availability and market incentives. Note that this is true for every kind of limit order, not only on f(x) Protocol.

    What could go wrong?

    xTokens (v1): In the worst-case scenario, all xTokens could potentially lose their value. Before this happens however, the stability mechanism is designed to trigger and rebalance them. However, if the mechanism becomes exhausted, xTokens could drop to zero. In such extreme cases, the protocol's total collateralization ratio remains at 100% and the stablecoin is always backed and pegged to the dollar. If the market continues to decline, the stablecoin may temporarily de-peg, with a strong likelihood of recovery if the underlying market (e.g., ETH) rebounds. For more details about the stability mechanism, please refer to the V1 .

    xPOSITION (v2): Rebalancing and liquidation thresholds are carefully calibrated to prevent such scenarios. In an unlikely worst-case scenario where both rebalancing and liquidation mechanisms fail, the protocol may incur a bad debt. To safeguard users from this, f(x) Protocol allocates a significant portion of its revenue to a reserve fund specifically for such extreme cases. If the reserve fund is insufficient, the bad debt would be distributed among all xPOSITIONs. Learn more:

    Stability Mechanism
    🧘‍♂️Risk framework
    ✅Advanced Peg Protection Mechanisms

    Order validity period. Default: 7 days (customizable, up to 1 year).

    Open position: the protocol fees are deducted from the position.

  • Close position: keeper handles the protocol fees.

  • Parameter

    Description

    Pay

    Amount of fxUSD to be used for opening or adding to a position.

    Amount

    Amount of collateral to be sold when closing or reducing a position.

    Limit Price

    The price at which the limit order will be executed.

    Limit Type

    For closing orders, choose Take Profit or Stop Loss.

    Trigger Price

    The trigger price is calculated automatically based on Limit Price and Slippage, but can be edited manually.

    Partial Fill

    Whether to allow partial order execution. Recommended for large orders so multiple Keepers can fill portions of it.

    Type

    Description

    Limit Open

    Opens a position when the market price reaches your set limit price.

    Stop Loss Limit

    Executes at the Stop Loss (SL) price once the trigger condition is met.

    Take Profit Limit

    Executes at the Take Profit (TP) price once the trigger condition

    is met.

    developpers doc

    Expiration

    Ticks

    Ticks are a fundamental concept in f(x) protocol that represent discrete price points for debt-to-collateral ratios. They serve as a risk categorization system that groups user positions with similar risk levels together. For more details, you can check _getTick function in contracts.

    1. Mathematical Foundation

    The core formula for the tick system is:

    Long Pool Integration

    1. Rebalance Operations

    For long pools, the rebalance operation has to be invoked through FxUSDBasePool.

    Rebalance can only be operated when debt ratio is between the values fetched in getRebalanceRatios

    As for tokenIn address, both fxUSD and USDC tokens are supported. The FxUSDBasePool contract uses the _beforeRebalanceOrLiquidate function to handle token conversion:

    Processing the rebalances and liquidations

    Learn how to monitor and trigger rebalance and liquidation operations

    Introduction

    In DeFi, a Keeper is an entity or system responsible for automating on-chain actions that cannot execute themselves. Since smart contracts on blockchains are passive, they require an external trigger—this is where Keepers come in.

    While f(x) is a fully on-chain system, the Keeper is designed to actively monitor positions and initiate actions once certain conditions are met.

    Maintaining an active Keeper community is critical for the f(x) Protocol. Therefore, we’ve written this document to help you understand some key concepts and processes related to Keepers.

    Integrating fxSAVE

    To facilitate the integration of fxSAVE from any chain, routed it. You'll find more information here.

    Note that since fxSAVE withdrawal is a two-step process, Enso only routed the atomic withdrawal that charges a withdrawal fee. To avoid that fee, you can wait for the cooldown period instead.

    How to close a leverage position (xPOSITION)

    To close an xPOSITION:

    • Head over to the page.

    • Connect your wallet using the upper right “Connect Wallet” button.

    • Click on the “Sell / Close” tab of the order box.

    Keeper Bots

    There is an open-source example keeper implementation available at .

    State Syncing

    In this implementation, the bot relies on the stateSync class to synchronize states locally and reassemble the on-chain status. Based on the synchronized data, it calculates relevant metrics and executes rebalance and liquidate operations accordingly.

    Calculate how much to rebalance

    There are two known restrictions from the contracts:

    Related contract addresses

    • PoolManager(Long): 0x250893CA4Ba5d05626C785e8da758026928FCD24

    • WBTC Long Pool: 0xAB709e26Fa6B0A30c119D8c55B887DeD24952473

    • wstETH Long Pool: 0x6Ecfa38FeE8a5277B91eFdA204c235814F0122E8

    • ShortPoolManager: 0xaCDc0AB51178d0Ae8F70c1EAd7d3cF5421FDd66D

    • wstETH Short Pool: 0x25707b9e6690B52C60aE6744d711cf9C1dFC1876

    • WBTC Short Pool: 0xA0cC8162c523998856D59065fAa254F87D20A5b0

    • fxETH(wstETH CreditNote): 0x7c5350BaC0eB97F86A366Ee4F9619a560480F05A

    • fxBTC(WBTC CreditNote): 0xB25a554033C59e33e48c5dc05A7192Fb1bbDdfc6

    You can double-check the contracts for the last update on Github

    Ratio = (1.0015^tick) × 2^96

  • This ratio represents the debts/collaterals proportion

  • Each tick represents approximately 0.15% price change (1.0015 - 1 = 0.0015)

  • 2. Primary functions of Ticks

    All user positions with similar debt ratios are grouped into the same tick, enabling:

    • Efficient batch processing: Multiple similar-risk positions can be handled simultaneously

    • Precise risk management: Positions within the same tick share similar liquidation risks

    3. topTick

    The system processes ticks starting from the highest risk tick (topTick) in descending risk order.

    The system maintains a topTick that points to the highest-risk tick with outstanding debt. Operations always start from this point and work downward through decreasing risk levels.

    4 Trace ticks

    There are many ways to trace ticks. Fundamentally, they are stored in the nodes of each pool contract. For more details, please view [PoolStorage.sol][https://github.com/AladdinDAO/fx-protocol-contracts/blob/main/contracts/core/pool/PoolStorage.sol)

    As for a position, you can use getPosition in each pool to get the tick of the position.

    As for a tick, you can use tickData to fetch which node it belongs to:

    As for a node, you can fetch the node's info through tickTreeData and tickData.

    • tickData: tick -> node

    • tickTreeData: node -> tick

    However, the tick number returned by getPosition cannot be directly used in rebalance or liquidation operations unless its node's parent is 0. If the node's parent is not 0, you must trace the parent tick number upward until you reach a node whose parent is 0 (i.e., the root node).

    Additionally, you can also use TickBitmap contract to track active root ticks.

    1.1 Pool-Wide Rebalance

    Usage Example:

    1.2 Tick-Specific Rebalance

    Notice: The tick provided must always be a root tick—i.e., its node's parent must be 0. Otherwise, you need to trace the tick upward to identify the corresponding root tick.

    Usage Example:

    2. Liquidation Operations

    Rebalance can only be operated when debt ratio is between the values fetched in getLiquidateRatios

    Contract Interface

    Usage Example:

    3. CreditNote Received

    If it happens that the long pool does not have enough collateral in the contract (it is still overcollateralized, but the collateral is held elsewhere — for example, lent to short pools), you may receive the CreditNote from the long pool instead of the collateral asset. In this case, you can use redeemByCreditNote to obtain the collateral asset.

    • for WBTC pools, you may receive fxBTC: 0xB25a554033C59e33e48c5dc05A7192Fb1bbDdfc6

    • for wstETH pools, you may receive fxETH: 0x7c5350BaC0eB97F86A366Ee4F9619a560480F05A

    Please double-check those addresses before using them.

    For more details, see CreditNotes

    (debt - x) / (price * (coll - y * (1 + incentive))) ≤ target_ratio

    where

    • x = debt to be repaid

    • y = collateral to be removed

    • incentive = rebalance bounty ratio

    1. debt / (price * coll) >= target_ratio

    From these conditions, we derive the following formula:

    Code implementation(source):

    Calculate how much to liquidate:

    Based on the restrictions from the contract:

    We can derive:

    Code implementation(source):

    redeemByCreditNote

    When CreditNote is received, you may use redeemByCreditNote to redeem to the underlying assets. You can check the example code FxProtocolLongBatchExecutor contract of the bots to see a full process to how to integrate it.

    • First, in a flashloan, it use the borrowed fund to do rebalance/liquidation

    • After this, it checks the USDC balance

    • Then, it converts all the newly fetched collateral assets to USDC

    • Then, it checks CreditNote balance and use redeemByCreditNote to obtain the assets and get more USDC

    • Then try to repay the borrowed funds to finish the flashloan

    fx-keeper-example
    // From TickMath.sol:
    int24 internal constant MIN_TICK = -32767;
    int24 internal constant MAX_TICK = 32767;
    
    // Tick calculation uses 1.0015 as the base
    // ratioX96 = (1.0015^tick) * 2^96
      /// @notice Return the details of the given position.
      /// @param tokenId The id of position to query.
      /// @return rawColls The amount of collateral tokens supplied in this position.
      /// @return rawDebts The amount of debt tokens borrowed in this position.
      function getPosition(uint256 tokenId) external view returns (uint256 rawColls, uint256 rawDebts);
      /// @dev Mapping from tick to tree node id.
      mapping(int256 => uint48) public tickData;
      /// @dev Mapping from tree node id to tree node data.
      mapping(uint256 => TickTreeNode) public tickTreeData;
      /// @dev Internal function to get the root of the given tree node.
      /// @param node The id of the given tree node.
      /// @return root The root node id.
      /// @return collRatio The actual collateral ratio of the given node, multiplied by 2^60.
      /// @return debtRatio The actual debt ratio of the given node, multiplied by 2^60.
      function _getRootNode(uint256 node) internal view returns (uint256 root, uint256 collRatio, uint256 debtRatio) {
        collRatio = E60;
        debtRatio = E60;
        while (true) {
          bytes32 metadata = tickTreeData[node].metadata;
          uint256 parent = metadata.decodeUint(PARENT_OFFSET, 48);
          collRatio = (collRatio * metadata.decodeUint(COLL_RATIO_OFFSET, 64)) >> 60;
          debtRatio = (debtRatio * metadata.decodeUint(DEBT_RATIO_OFFSET, 64)) >> 60;
          if (parent == 0) break;
          node = parent;
        }
        root = node;
      }
    function _beforeRebalanceOrLiquidate(
        address tokenIn,
        uint256 maxAmount
    ) internal view returns (RebalanceMemoryVar memory op) {
        op.stablePrice = getStableTokenPriceWithScale();
        op.totalYieldToken = totalYieldToken;
        op.totalStableToken = totalStableToken;
    
        uint256 amountYieldToken = op.totalYieldToken;
        uint256 amountStableToken;
        
        if (tokenIn == yieldToken) {
            // User pays fxUSD - direct usage
            // ... fxUSD handling logic
        } else {
            // User pays USDC - convert to USD equivalent
            uint256 maxAmountInUSD = (maxAmount * op.stablePrice) / PRECISION;
            if (maxAmountInUSD < amountYieldToken) {
                amountYieldToken = maxAmountInUSD;
            } else {
                amountStableToken = ((maxAmountInUSD - amountYieldToken) * PRECISION) / op.stablePrice;
            }
        }
        
        // Ensure we don't exceed available stable tokens
        if (amountStableToken > op.totalStableToken) {
            amountStableToken = op.totalStableToken;
        }
    
        op.yieldTokenToUse = amountYieldToken;
        op.stableTokenToUse = amountStableToken;
    }
    /**
     * @notice Rebalance all eligible ticks in the pool through FxUSDBasePool
     * @param pool The address of the long pool
     * @param tokenIn The token to use (fxUSD or stable token)
     * @param maxAmount Maximum token amount to use
     * @param minBaseOut Minimum collateral expected
     * @return tokenUsed Amount of input token consumed
     * @return baseOut Amount of collateral tokens received
     */
    function rebalance(
        address pool,
        address tokenIn,
        uint256 maxAmount,
        uint256 minBaseOut
    ) external returns (uint256 tokenUsed, uint256 baseOut);
    // Approve tokens for rebalancing
    IERC20(fxUSD).approve(fxUSDBasePool, maxFxUSD);
    IERC20(stableToken).approve(fxUSDBasePool, maxStable);
    
    // Rebalance entire pool
    (uint256 tokenUsed, uint256 collateralReceived) = 
        IFxUSDBasePool(fxUSDBasePool).rebalance(
            poolAddress,      // target pool
            fxUSD,            // use fxUSD
            maxFxUSD,         // max amount
            minCollateral     // minimum expected
        );
    /**
     * @notice Rebalance positions in a specific tick through FxUSDBasePool
     * @param pool The address of the long pool
     * @param tick The specific tick to rebalance (risk level)
     * @param tokenIn The token to use (fxUSD or stable token)
     * @param maxAmount Maximum token amount to use
     * @param minBaseOut Minimum collateral expected
     * @return tokenUsed Amount of input token consumed
     * @return baseOut Amount of collateral tokens received
     */
    function rebalance(
        address pool,
        int16 tick,
        address tokenIn,
        uint256 maxAmount,
        uint256 minBaseOut
    ) external returns (uint256 tokenUsed, uint256 baseOut);
    // Get highest risk tick
    int16 topTick = ILongPool(poolAddress).getTopTick(); // you may want to replace this with your own logic to fetch ticks
    
    // Prepare tokens (fxUSD or USDC)
    IERC20(tokenIn).approve(fxUSDBasePool, maxAmount);
    
    // Rebalance specific tick
    (uint256 tokenUsed, uint256 collateralReceived) = 
        IFxUSDBasePool(fxUSDBasePool).rebalance(
            poolAddress,      // target pool
            topTick,          // highest risk tick
            tokenIn,          // fxUSD or USDC address
            1000e18,          // max 1000 tokens
            0                 // minimum collateral (set based on slippage tolerance)
        );
    /**
     * @notice Liquidate high-risk positions through FxUSDBasePool
     * @param pool The address of the long pool
     * @param tokenIn The token to use (fxUSD or stable token)
     * @param maxAmount Maximum token amount to use
     * @param minBaseOut Minimum collateral expected
     * @return tokenUsed Amount of input token consumed
     * @return baseOut Amount of collateral tokens received
     */
    function liquidate(
        address pool,
        address tokenIn,
        uint256 maxAmount,
        uint256 minBaseOut
    ) external returns (uint256 tokenUsed, uint256 baseOut);
    // Check liquidation opportunity
    bool canLiquidate = ILongPool(poolAddress).canLiquidate();
    require(canLiquidate, "No liquidation opportunity");
    
    // Prepare liquidation tokens
    IERC20(tokenIn).approve(fxUSDBasePool, maxAmount);
    
    // Execute liquidation
    (uint256 tokenUsed, uint256 collateralReceived) = 
        IFxUSDBasePool(fxUSDBasePool).liquidate(
            poolAddress,      // target pool
            tokenIn,          // fxUSD or USDC
            maxAmount,        // max token amount
            minCollateral     // minimum expected collateral
        );
    x ≥ (debt - target_ratio × price × coll) / (1 - target_ratio × (1 + incentive))
    function getRawDebtToRebalance(tick: ITickToBalance): bigint {
    
      const rawDebts =
        (tick.rawDebts * PRECISION * PRECISION - tick.debtRatio * tick.price * tick.rawColls) /
        (PRECISION * PRECISION - (PRECISION * tick.debtRatio * (FEE_PRECISION + tick.bonusRatio)) / FEE_PRECISION);
      return rawDebts;
    }
    rawDebts / price * (1 + bonus) <= position.rawColls + balance
     rawDebts <= (position.rawColls + balance) / (1 + bonus) * price
    function getRawDebtToLiquidate(position: IPositionToLiquidate, balance: bigint): bigint {
      // rawDebts / price * (1 + bonus) <= position.rawColls + balance
      // rawDebts <= (position.rawColls + balance) / (1 + bonus) * price
      let rawDebts =
        ((((position.rawColls + balance) * position.price) / PRECISION) * FEE_PRECISION) /
        (FEE_PRECISION + position.bonusRatio);
      (position.rawColls * position.price) / PRECISION;
      if (rawDebts > position.rawDebts) rawDebts = position.rawDebts;
      return rawDebts;
    }
        // do rebalance or liquidate
        uint256 amountBase;
        address pool;
        if (callType == 0) {
          (pool, amountBase, assets) = _doRebalance(tokenToUse, assets, userData);
        } else if (callType == 1) {
          (pool, amountBase, assets) = _doLiquidate(tokenToUse, assets, userData);
        }
        // swap base to USDC
        uint256 usdcAmount = IERC20(USDC).balanceOf(address(this));
        {
          (, address swapTarget, bytes memory swapData) = abi.decode(userData[1:], (address, address, bytes));
          IERC20(IPool(pool).collateralToken()).forceApprove(swapTarget, amountBase);
          if (amountBase > 0) {
            (bool success, ) = swapTarget.call(swapData);
            _popupRevertReason(success);
          }
        }
        usdcAmount = IERC20(USDC).balanceOf(address(this)) - usdcAmount;
        // check if we have credit note
        address shortPool = IPool(pool).counterparty();
        if (shortPool != address(0)) {
          address creditNote = IShortPool(shortPool).creditNote();
          uint256 balance = IERC20(creditNote).balanceOf(address(this));
          if (balance > 0) {
            IERC20(creditNote).forceApprove(shortPoolManager, balance);
            balance = IShortPoolManager(shortPoolManager).redeemByCreditNote(shortPool, balance, 0);
            // swap fxUSD to USDC
            usdcAmount += ICurveStableSwapNG(USDC_fxUSD_POOL).exchange(1, 0, balance, 0);
          }
        }
    Method 1: Direct Redemption via Router
    • Contract Addresses

      • RouterManagementFacet: 0x33636D49FbefBE798e15e7F356E8DBef543CC708

      • SavingFxUSDFacet: 0x56afB443dE36340c32f1a461605171992480059D

    • Function Call

      • Function:

      • Description: Burns fxSave shares and instantly converts them into the target token(s) (such as fxUSD, USDC, or a combination of fxUSD + USDC).

    • Function Signature

    • Parameter Struct Description (ConvertOutParams)

    ConvertOutParams Example

    ConvertOutParams defines how assets redeemed from fxSave are converted (swapped) into the target token, such as USDC, fxUSD, or USDC+fxUSD. Below are three typical usage scenarios:


    ✅ Scenario 1: Redeeming USDC

    In this case:

    • fxUSD needs to be swapped into USDC via the converter.

    • USDC is redeemed directly without swap.

    fxusdParams (Swap fxUSD → USDC)

    usdcParams (Direct Redemption of USDC)


    ✅ Scenario 2: Redeeming fxUSD

    In this case:

    • fxUSD is redeemed directly without swap.

    • USDC needs to be swapped into fxUSD via the converter.

    fxusdParams (Direct Redemption of fxUSD)

    usdcParams (Swap USDC → fxUSD)

    ✅ Scenario 3: Redeeming USDC + fxUSD(No Swap)

    In this case:

    • fxUSD is redeemed directly without any swap.

    • USDC is redeemed directly without any swap.

    fxusdParams (Direct Redemption of fxUSD)

    usdcParams (Direct Redemption of USDC)


    Method 2: Two-Step Redemption Process to Get fxUSD + USDC

    Step 1: Redeem fxSP Tokens from fxSave

    • Contract Address

      • SavingFxUSD: 0x7743e50F534a7f9F1791DdE7dCD89F7783Eefc39

    • Function Call

      • Function:

    • After redeeming, you will receive the corresponding amount of fxSP tokens.


    Step 2: Instantly Redeem fxSP Tokens to Obtain fxUSD and USDC

    • Contract Address

      • fxSP: 0x65C9A641afCEB9C0E6034e558A319488FA0FA3be

    • Function Call

      • Function:

    • Return Values

      • amountStableOut: Amount of stable token (fxUSD and USDC) received

      • amountYieldOut: Amount of yield token received


    Summary

    Method

    Description

    Features

    Method 1

    Direct redemption of fxUSD, USDC, or both via Router

    Single-step process; suitable for flexible and immediate conversion

    Method 2

    Two-step redemption: first redeem fxSP, then extract fxUSD and USDC

    Fine-grained control over redemption; suitable for detailed asset management


    Enso
    https://docs.enso.build/pages/build/get-started/route
    https://docs.enso.build/pages/build/examples/shortcuts

    Hit the “MAX” link / Slide the bar to 100% / Type “100%” in the text box to close your entire position.

  • Hit the Preview button to review your trade.

  • Review your trade and the evolution of your xPOSITION, and once ready, hit the “Submit Transaction” button.

  • Confirm the transaction using your wallet.

  • Trade

    CreditNotes

    CreditNotes are tokens that represent borrowed collateral in the fx-protocol's Long-Short Pool lending system. It acts as a debt instrument that tracks how much collateral the Short Pool has borrowed from the Long Pool.

    For each short pool, one type of CreditNote is generated. For example, we currently have two short pools in the system — the wstETH short pool and the WBTC short pool. Thus, there are two types of CreditNotes in the system, named:

    • fxETH (CreditNotes for wstETH Pool)

    • fxBTC (CreditNotes for WBTC Short Pool)

    CreditNotes are primarily held by protocol contracts, though users may also receive CreditNotes from the protocol. In such cases, several methods are provided to allow users to redeem their CreditNotes for standard asset types.

    redeem (0xba087652)
    instantRedeem (0x9f56f9f0)
    function instantRedeemFromFxSave(
        LibRouter.ConvertOutParams memory fxusdParams,
        LibRouter.ConvertOutParams memory usdcParams,
        uint256 shares,
        address receiver
    )
    struct ConvertOutParams {
        address tokenOut;    // Address of the output token
        address converter;   // Address of the converter contract
        uint256 encodings;   // Encoding parameters for MultiPathConverter
        uint256[] routes;    // Route encodings for conversion
        uint256 minOut;      // Minimum expected amount of output token
        bytes signature;     // Optional data for future use
    }
    
    {
      tokenOut: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC address
      converter: "0x12AF4529129303D7FbD2563E242C4a2890525912",
      encodings: 2097151n, // Encoding flags for routing
      routes: [13937444672719263997463500976868002028738657667021836n], // Swap path: fxUSD → USDC
      minOut: tokenXMinOut, // Minimum acceptable output for USDC (should be queried from converter)
      signature: '0x'
    }
    {
      tokenOut: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC address
      converter: "0x12AF4529129303D7FbD2563E242C4a2890525912",
      encodings: 0n, // No conversion
      routes: [],
      minOut: tokenYMinOut, // Minimum expected output for direct USDC
      signature: '0x'
    }
    {
      tokenOut: "0x085780639CC2cACd35E474e71f4d000e2405d8f6", // fxUSD address
      converter: "0x12AF4529129303D7FbD2563E242C4a2890525912",
      encodings: 0n,
      routes: [],
      minOut: tokenYMinOut,
      signature: '0x'
    }
    {
      tokenOut: "0x085780639CC2cACd35E474e71f4d000e2405d8f6", // fxUSD address
      converter: "0x12AF4529129303D7FbD2563E242C4a2890525912",
      encodings: 2097151n,
      routes: [97745794563822560938935604024150535507888453411437580n], // Swap path: USDC → fxUSD
      minOut: tokenXMinOut, // Should be obtained by querying the converter
      signature: '0x'
    }
    {
      tokenOut: "0x085780639CC2cACd35E474e71f4d000e2405d8f6", // fxUSD address
      converter: "0x12AF4529129303D7FbD2563E242C4a2890525912",
      encodings: 0n,
      routes: [],
      minOut: fxusdMinOut, // Minimum expected fxUSD output
      signature: '0x'
    }
    {
      tokenOut: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC address
      converter: "0x12AF4529129303D7FbD2563E242C4a2890525912",
      encodings: 0n,
      routes: [],
      minOut: usdcMinOut, // Minimum expected USDC output
      signature: '0x'
    }

    Implementation Reference(s)

    These are third-party implementations; please use them at your own risk.

    The team is not liable for any damages, losses, or issues arising from the use of the following software.

    • https://github.com/starit/fx-protocol-keeper-example

    f(x) Protocol 1.0

    1. Redemption Mechanism:

    Users can redeem CreditNote tokens for underlying fxUSD collateral:

    In the end, when the short pool reaches the end of its life cycle, all CreditNotes should be burned.

    For more details on how to use it in a keeper bot, see the redeemByCreditNote section.

    // Users call ShortPoolManager.redeemByCreditNote()
    function redeemByCreditNote(address pool, uint256 debts, uint256 minColls) external {
        // Transfer CreditNote from user
        IERC20(creditNote).safeTransferFrom(_msgSender(), address(this), debts);
        
        // Redeem equivalent collateral
        colls = IShortPool(pool).redeemByCreditNote(rawDebts);
        
        // Apply protocol fees
        uint256 protocolFees = (colls * getRedeemFeeRatio()) / FEE_PRECISION;
        colls -= protocolFees;
        
        // Transfer net collateral to user
        _transferOut(fxUSD, colls, _msgSender());
    }
    instantRedeemFromFxSave (0x6d701088)

    Token Breakdown

    Since the launch of the first iteration of the protocol, several tokens have been launched. Please find a breakdown below to help you navigate along them.

    Stablecoins

    • fxUSD: Our flagship stablecoin, operating on v2. It is exclusively collateralized by Lido stETH and WBTC. While governance may introduce additional collateral types, they will always consist of the most liquid and secure assets in DeFi.

    • fxSAVE: the ultimate DeFi savings account. This yield-bearing stablecoin harnesses the 's yields.

    • rUSD: A v1 stablecoin backed by Etherfi eETH and Renzo ezETH. Once staked, it not only earns restaking yields but also provides points!

    • btcUSD: A v1 stablecoin collateralized by wBTC. Since wBTC is not yield-bearing, a small funding cost is charged to xToken holders and distributed to stable stakers.

    • cvxUSD: A v1 stablecoin backed by aCVX, an auto-compounding staked CVX created by .

    • fETH: Our first-ever v1 stablecoin, designed differently. Instead of being pegged to the dollar, it maintains stability by capturing only 10% of ETH's volatility, with its xToken absorbing the rest.

    Leveraged tokens (V1)

    • xETH: a perpetual leveraged token providing up to 4x long exposure to ETH price movements, backed by Lido stETH exclusively.

    • xstETH / xfrxETH: ETH leverage tokens offering up to 4.3x exposure. Respectively backed by Lido stETH and frxETH.

    • xeETH / xezETH: ETH leverage tokens with up to 4.3x exposure. Respectively backed by Lido eETH and ezETH.

    • xwBTC: A Bitcoin leverage token offers up to 5.6x exposure, enabling traders to capitalize on market movements precisely.

    Short Pool Integration

    1. Contract Interface

    interface IShortPoolManager {
        /**
         * @notice Rebalance positions in a specific tick
         * @param pool The address of short pool
         * @param receiver The address to receive fxUSD
         * @param tick The tick to rebalance
         * @param maxRawDebts Maximum raw debt tokens to use
         */
        function rebalance(
            address pool,
            address receiver,
            int16 tick,
            uint256 maxRawDebts
        ) external returns (uint256 colls, uint256 debts);
    
        /**
         * @notice Rebalance entire pool
         * @param pool The address of short pool
         * @param receiver The address to receive fxUSD
         * @param maxRawDebts Maximum raw debt tokens to use
         */
        function rebalance(
            address pool,
            address receiver,
            uint256 maxRawDebts
        ) external returns (uint256 colls, uint256 debts);
    
        /**
         * @notice Liquidate high-risk short positions
         * @param pool The address of short pool
         * @param receiver The address to receive fxUSD
         * @param maxRawDebts Maximum raw debt tokens to use
         */
        function liquidate(
            address pool,
            address receiver,
            uint256 maxRawDebts
        ) external returns (uint256 colls, uint256 debts);
    }

    2. Short Pool Specifics

    Key Differences from Long Pool:

    1. Collateral: fxUSD tokens

    2. Debt: External tokens (ETH, BTC, etc.)

    Rebalance Example:

    Integrating the f(x) limit orders

    For users of the f(x) protocol, Limit Orders are a critical feature. By allowing position management at a fixed rate, limit orders eliminate slippage and reduce exposure to market-price uncertainty — a benefit that is especially valuable for large-size orders and systematic strategy executors. In addition, the introduction of take-profit / stop-loss orders enables the reliable automation of many trading strategies that would otherwise be impractical on an entirely market-priced execution model.

    1. Components

    1.1 Smart contracts

    We introduce the LimitOrderManager family of smart contracts to implement limit-order functionality. These contracts allow orders to be filled on-chain while simultaneously operating the corresponding position (open/close/adjust), ensuring atomic and auditable execution. For more details, please read the section.

    1.2 Limit order API services

    A dedicated API/relayer service is provided to help users broadcast and discover signed orders. Users sign orders off-chain and submit the order plus signature to the API, which acts as an order-relay and discovery layer for counterparties.

    For more details, please read the section.

    1.3 Front-end

    For retail or non-technical users, the standard f(x) front-end provides UI flows to create, submit and monitor limit orders and TP/SL orders, abstracting away the underlying contract interactions and relayer details.

    2. Integration flow (high level)

    1. Maker creates and signs an order off-chain (locally).

    2. The maker submits the signed order to the Limit Order API / relayer (optional).

    3. A Taker discovers the order (via the API or other discovery means) and fills it on-chain by calling LimitOrderManager. The on-chain fill is executed atomically and operates the associated position.

    Note: The API/relayer is optional — it's allowed to call the LimitOrderManager directly to fill orders on-chain.

    ⚠️ Note: Once an order is signed, it can only be canceled on-chain (by sending an on-chain cancel transaction) to prevent it from being filled.


    Limit Order APIs

    APIs are provided to help users relay the signed orders.

    Basic Information

    • Base URL: https://fx-limit-order-api.aladdin.club/

    • API Swagger Docs:

    • Supported Blockchains: Ethereum

    1. Create Limit Order

    For risk considerations, creating orders through the API documentation is not recommended at this time. Please use the website to create limit orders.

    ⚠️ IMPORTANT RISK DISCLAIMER: By submitting orders through APIs, you acknowledge and accept full responsibility for all trading risks including but not limited to: market volatility, slippage, liquidation risk, smart contract risks, and potential total loss of funds. This API provides no guarantees regarding order execution, profitability, or protection against losses. Use at your own risk and ensure you fully understand the implications of each order before submission.

    2. Get Active Orders (For Bots/Keepers)

    Returns all open and fillable orders, sorted by their createdAt timestamp in ascending order. This endpoint is optimized for keepers, bots, or external indexers that need to continuously fetch newly created orders available for on-chain execution.

    Query Parameters:

    • after (optional): Only include orders created after this UNIX timestamp (in seconds). Useful for incremental syncing.

    • limit (optional): Maximum number of orders to return (default: 100, max: 5000)

    Response:

    3. Get Order Updates (For Real-time Monitoring)

    Returns orders that have changed state (created, filled, cancelled, or expired), sorted by their updatedAt timestamp in ascending order. Ideal for clients or bots polling for updates to maintain an up-to-date local view of the order book.

    Query Parameters:

    • after (optional): Only include orders updated after this UNIX timestamp (in seconds). Enables incremental polling for order state changes.

    • limit (optional): Maximum number of orders to return (default: 100, max: 1000)

    Response:

    FX Auto-Compound

    aFXN:

    • Description: aFXN is an auto-compounding asset derived from cvxFXN.

    • Yield: Staking cvxFXN earns:

      • Rewards from veFXN.

      • A share of boosted FXN earnings and CVX tokens from Convex LPs.

    • Important:

      • Converting FXN to cvxFXN is irreversible.

      • You can stake and unstake cvxFXN tokens but cannot revert them to FXN.

      • Secondary markets allow trading cvxFXN for FXN at market rates.

    • Addresses:

      • FXN Token Address: 0x365AccFCa291e7D3914637ABf1F7635dB165Bb09

      • cvxFXN Token Address: 0x183395DbD0B5e93323a7286D1973150697FFFCB3

      • Deposit Contract Address: 0x56B3c8eF8A095f8637B6A84942aA898326B82b91

    arUSD:

    • Description: arUSD is an auto-compounding asset based on rUSD staked in Earn Pools.

    • Yield: Earn up to ~6x ether.fi loyalty points and ~2x EigenLayer points.

    • Collateral: rUSD.

    LimitOrderManager contracts

    The `LimitOrderManager` is a critical component of the f(x) Protocol that enables users to create and execute limit orders for position management. This system allows traders to:

    • Open new positions when market conditions meet specific price criteria

    • Close existing positions at predetermined price levels

    • Set up stop-loss and take-profit orders for risk management

    • Execute complex trading strategies programmatically

    Interacting with LimitOrderManager

    To interact with LimitOrderManager, send a contract call to its address.

    Key Functions

    fillOrder(order, signature, makingAmount, takingAmount)

    Executes a limit order by filling it with the specified amounts. (taker's operation)

    cancelOrder(order)

    Cancels an existing order (only callable by the order maker).

    getOrderDetails(order)

    Returns the order details (including making/taking tokens and amounts) for an order.

    getExecution(orderHash)

    Returns the current execution status of an order.

    getOrderHash(order)

    Calculates and returns the unique hash for a given order. This hash is used as the identifier for tracking order execution status.

    increaseNonce()

    Increments the caller's nonce, effectively invalidating all previously signed orders with the old nonce. Useful for batch cancelling multiple orders. (Basically, it means cancelAll)

    Key Concepts

    Order Structure

    The Order struct contains the following key fields:

    Pool Address: f(x) pool addresses, for example

    • WBTCLong : 0xAB709e26Fa6B0A30c119D8c55B887DeD24952473

    • wstETHLong: 0x6Ecfa38FeE8a5277B91eFdA204c235814F0122E8

    • WBTCShort: 0xA0cC8162c523998856D59065fAa254F87D20A5b0

    Making Amount vs Taking Amount

    • Making Amount: The amount of tokens the order maker is offering

    • Taking Amount: The amount of tokens the order maker wants to receive

    These amounts are calculated based on the order type and side.

    Order Hash

    The Order Hash is a unique identifier for each order, calculated using the EIP712 standard. This hash serves as:

    • Unique Identifier: Each order has a distinct hash based on its parameters

    • Execution Tracker: Used to store and retrieve order execution status

    • Signature Target: The hash is what gets signed by the order maker

    • Database Key: Off-chain systems use this hash to index and track orders

    The order hash is deterministic - the same order parameters will always produce the same hash. This allows for consistent tracking across different systems and ensures order integrity.

    Signature

    The Signature is a cryptographic proof that the order hash was authorized by the order maker. The signature content is the order hash (not the raw order data), ensuring any parameter changes invalidate the signature.

    Signature Format:

    • EOA Signatures: 65 bytes (r, s, v) or 64 bytes (r, s) for EIP-2098 compact format

    • Smart Contract Signatures: Variable length, validated through EIP-1271 isValidSignature method

    Integrate Examples:

    Signature Creation Example

    How to Call fillOrder

    Function Signature

    Parameters

    • order: The order struct containing all order details

    • signature: EIP712 signature from the order maker

    • makingAmount: Amount of making tokens the filler provides

    Prerequisites

    1. Valid Signature: The order must be properly signed by the maker

    2. Order Validation: Order parameters must pass validation checks

    3. Price Conditions: Trigger price conditions must be met (if applicable)

    4. Token Approvals: Filler must approve tokens to the LimitOrderManager

    Example Integration

    Stake Contract Address: 0xEC60Cd4a5866fb3B0DD317A46d3B474a24e06beF

    xCVX: A CVX leverage token offering up to 3x exposure, designed to enhance trading efficiency and excitement.

    Stability Pool
    Concentrator
    LimitOrder contracts
    LimitOrder APIs
    // Get debt token for the short pool
    address debtToken = IShortPool(shortPoolAddress).debtToken();
    
    // Approve debt tokens for rebalancing
    IERC20(debtToken).approve(shortPoolManager, maxDebtAmount);
    
    // Execute rebalance
    (uint256 fxUSDReceived, uint256 debtUsed) = 
        IShortPoolManager(shortPoolManager).rebalance(
            shortPoolAddress,    // target short pool
            msg.sender,          // receive fxUSD
            maxDebtAmount        // max debt tokens to use
        );
    https://petstore.swagger.io/?url=https://fx-limit-order-api.aladdin.club/openapi.yml
    wstETHShort: 0x25707b9e6690B52C60aE6744d711cf9C1dFC1876
  • LimitOrderManager: 0x112873b395B98287F3A4db266a58e2D01779Ad96

  • takingAmount: Amount of taking tokens the filler wants from the order

    Sufficient Balance: Filler must have sufficient token balance

    GET /v1/active-orders
    {
      "statusCode": 0,
      "message": "OK",
      "result": [
        {
          "orderHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
          "data": {
            "maker": "0x742D35Cc6609CBB9C1EC8f1E4A3ea5A1A8c1aB34",
            "pool": "0x1234567890123456789012345678901234567890",
            "positionId": 1,
            "positionSide": true,
            "orderType": false,
            "orderSide": true,
            "allowPartialFill": true,
            "triggerPrice": "0",
            "fxUSDDelta": "1000000000000000000000",
            "collDelta": "500000000000000000000",
            "debtDelta": "0",
            "nonce": 1,
            "salt": "0x1234567890123456789012345678901234567890123456789012345678901234",
            "deadline": 1703980800
          },
          "signature": "0x1234567890abcdef123456789...",
          "execution": {
            "status": 0,
            "filled": "0",
            "positionId": 1
          },
          "makingAmount": "1000000000000000000000",
          "takingAmount": "500000000000000000000",
          "expired": false,
          "createdAt": 1703894400,
          "updatedAt": 1703894400
        }
      ]
    }
    GET /v1/order-updates
    {
      "statusCode": 0,
      "message": "OK",
      "result": [
        {
          "orderHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
          "data": { /* OrderData object */ },
          "signature": "0x1234567890abcdef...",
          "execution": {
            "status": 1,
            "filled": "250000000000000000000",
            "positionId": 1
          },
          "makingAmount": "1000000000000000000000",
          "takingAmount": "500000000000000000000",
          "expired": false,
          "createdAt": 1703894400,
          "updatedAt": 1703894500
        }
      ]
    }
    struct Order {
        address maker;           // Order creator
        address pool;           // Target pool address
        uint256 positionId;     // Position ID (0 for new positions)
        bool positionSide;      // true = long, false = short
        bool orderType;         // false = limit order, true = stop order
        // orderType
        // for limit order (orderType = true)
        //   orderSide = true: open order, order can be filled only oracle price is <= triggerPrice
        //   orderSide = false: close order, order can be filled only oracle price is >= triggerPrice
        // stop order (orderType = false)
        //   always close order
        //   orderSide = true: take profit order, order can be filled only oracle price is >= triggerPrice
        //   orderSide = false: stop loss order, order can be filled only oracle price is <= triggerPrice
        bool orderType;
        bool allowPartialFill;  // Allow partial execution
        uint256 triggerPrice;   // Price trigger condition
        int256 fxUSDDelta;      // fxUSD amount change
        int256 collDelta;       // Collateral amount change
        int256 debtDelta;       // Debt amount change
        uint256 nonce;          // Maker's nonce for batch cancellation
        bytes32 salt;           // Unique order identifier
        uint256 deadline;       // Order expiration timestamp
    }
    // EIP712 Domain for f(x) Limit Order Manager
    const domain = {
        name: "f(x) Limit Order Manager",
        version: "1",
        chainId: 1, // Mainnet
        verifyingContract: limitOrderManager.address
    };
    
    // EIP712 Types for Order struct
    const types = {
        Order: [
            { name: "maker", type: "address" },
            { name: "pool", type: "address" },
            { name: "positionId", type: "uint256" },
            { name: "positionSide", type: "bool" },
            { name: "orderType", type: "bool" },
            { name: "orderSide", type: "bool" },
            { name: "allowPartialFill", type: "bool" },
            { name: "triggerPrice", type: "uint256" },
            { name: "fxUSDDelta", type: "int256" },
            { name: "collDelta", type: "int256" },
            { name: "debtDelta", type: "int256" },
            { name: "nonce", type: "uint256" },
            { name: "salt", type: "bytes32" },
            { name: "deadline", type: "uint256" }
        ]
    };
    
    // Sign the order (actually signs the order hash)
    async function signOrder(order, signer) {
        // _signTypedData internally calculates the order hash and signs it
        const signature = await signer._signTypedData(domain, types, order);
        return signature; // This signature proves the signer authorized this specific order hash
    }
    
    // Verify signature before using
    async function verifySignature(order, signature, expectedSigner) {
        const recoveredAddress = ethers.utils.verifyTypedData(domain, types, order, signature);
        return recoveredAddress.toLowerCase() === expectedSigner.toLowerCase();
    }
    
    // Usage example
    const signature = await signOrder(order, signer);
    const isValid = await verifySignature(order, signature, await signer.getAddress());
    console.log(`Signature valid: ${isValid}`);
    function fillOrder(
        OrderLibrary.Order memory order,
        bytes memory signature,
        uint256 makingAmount,
        uint256 takingAmount
    ) external nonReentrant
    // Example using ethers.js
    const order = {
        maker: "0x...",
        pool: "0x...",
        positionId: 0,
        positionSide: true,
        orderType: false,
        orderSide: true,
        allowPartialFill: true,
        triggerPrice: ethers.utils.parseEther("2000"),
        fxUSDDelta: ethers.utils.parseEther("1000"),
        collDelta: ethers.utils.parseEther("0.5"),
        debtDelta: ethers.utils.parseEther("500"),
        nonce: 1,
        salt: "0x1234...",
        deadline: Math.floor(Date.now() / 1000) + 3600
    };
    
    // Get the order hash for tracking
    const orderHash = await limitOrderManager.getOrderHash(order);
    console.log(`Order hash: ${orderHash}`);
    
    // Check if order has been executed before
    const execution = await limitOrderManager.getExecution(orderHash);
    console.log(`Order status: ${execution.status}`);
    
    // Get order details
    const [makingToken, takingToken, makingAmount, takingAmount] = 
        await limitOrderManager.getOrderDetails(order);
    
    // Approve tokens
    await IERC20(takingToken).approve(limitOrderManager.address, makingAmount);
    
    // Fill the order
    await limitOrderManager.fillOrder(
        order,
        signature,
        makingAmount,
        takingAmount
    );

    Aladdin DAO

    Building Secure and Decentralized Freedom with a Touch of Magic since 2021

    Aladdin DAO is a decentralized builder and incubator of cutting-edge DeFi protocols. We are a global community of contributors composed of enthusiasts, shadowy super-coders, and DeFi innovators. Our current focus is in building new approaches to yield farming optimization and automation within the Curve ecosystem and with our latest product, f(x) Protocol, we are expanding to scalable decentralized stablecoins.

    To date Aladdin has built three products: Concentrator, Clever, and f(x) Protocol. Each of these protocols offers powerful new tools for DeFi users and adds new, composable DeFi money lego which will help form the basis of what we believe will be the decentralized future of global finance. Each protocol was launched independently with NO VC & NO TEAM ALLOCATION.

    Resources

    Github: https://github.com/AladdinDAO

    Github(f(x) Protocol 2.0): https://github.com/AladdinDAO/fx-protocol-contracts/blob/main/ignition/deployments/ethereum/deployed_addresses.json

    Stability Mechanism

    Earn Pools also play a critical role in maintaining stability:

    • If the stable-leverage pair becomes unstable due to excessive minting of stables or insufficient xTokens, stables in the Earn Pool are redeemed for reserve assets at their Net Asset Value (NAV).

    • In stability mode, this operates like automatically buying ETH (or the reserve asset) at market price without slippage.

    • Otherwise, it enables farming of real, unstable yields using stablecoins.

    Multisig

    Operationnal Multisig

    All the protocol's technical and treasury operations are processed through the following Gnosis Safe multisignature wallet:

    0x26B2ec4E02ebe2F54583af25b647b1D619e67BbF. The threshold is set to 6 signatures.

    Signer
    Address

    Diligent Deer

    🪔 Team member

    Emergency Multisig

    For better responsiveness in case of emergency, the following multisignature wallet can pause xPOSITION and sPOSITION operations. The threshold for this wallet is set to 3 signatures.

    Signer
    Address

    🪔 Team member

    The emergency multisig can exclusively pause the following contracts:

    • LongPoolManager:

    • ShortPoolManager:

    Oracle

    Learn more about V1 oracle design.

    Here is a breakdown of the key features and mechanisms of the oracle solution.

    Enhanced collateral price feeds: In addition to the original TWAP, spot prices are incorporated, with additional price feeds from Curve, Uniswap V3, and Balancer.

    Arbitrage prevention: Minting and redeeming transactions are conducted at different prices to eliminate arbitrage trades. This helps to protect the collateral held by the protocol.

    • fToken can be minted at the minimum price

    • fToken can be redeemed at the maximum price

    • xToken can be minted at the maximum price

    • xToken can be redeemed at the minimum price

    Risk management

    The collateralization ratio is calculated at the maximum price as well as stability pool liquidations. This ensures that risk is managed effectively and liquidations occur at appropriate levels to maintain system stability.

    Net Asset Value

    The NAV is calculated based on TWAP during the non-transacting periods. This NAV calculation can serve as an oracle price feed for various DeFi applications integrating f(x) assets.

    Additional protection measures for xTokens

    To prevent arbitrage trades, xTokens cannot be both minted and redeemed within the same block. Additionally, a transfer of xTokens cannot occur within a specified timeframe of thirty minutes after minting. These measures help in mitigating potential exploits and maintaining price integrity.

    [ETH/USD Spot] has 4 price sources, which are:

    stETH New oracle:

    1. [ ]*[]

    2. [] * [ETH/USD Spot ]

    3. [] *[ ETH/USD Spot ]

    4. [] * [ETH/USD Spot ]

    frxETH New oracle:

    1. [] * []

    2. [] * [ETH/USD Spot ]

    3. [] * [ETH/USD Spot ]

    4. [] * [] * [ETH/USD Spot ]

    weETH New oracle:

    1. [] * []

    2. [] * [ETH/USD Spot ]/weETH.getRate()

    3. [] *[wstETH/stETH rate] * [ ]* [ETH/USD Spot ]

    4. [] * [ETH/USD Spot ]

    ezETH New oracle:

    1. [] * []

    2. [] * [ETH/USD Spot ]

    3. [] * [ETH/USD Spot ]

    WBTC New oracle:

    1. [] * []

    2. [WBTC/USDC spot price of ]

    3. [ ]

    4. [] * []

    CVX oracle:

    1. []

    2. []

    3. [] * [ETH/USD Spot ]

    Code:​

    Contracts

    f(x) protocol 2.0

    Find it in here.

    f(x) protocol 1.0

    Governance

    Name
    Address
    Notes

    Price Oracle

    Name
    Address
    Notes

    Liquidity Gauge

    Name
    LP Address
    Gauge Address
    Notes

    Rebalance Pool Gauge

    Name
    Gauge Address
    Claimer Address
    Notes

    fxUSD, beta = 0

    • FxUSD: 0x085780639CC2cACd35E474e71f4d000e2405d8f6

    • FxUSDRebalancer: 0x78c3aF23A4DeA2F630C130d2E42717587584BF05

    fstETH & xstETH

    Name
    Address
    Notes

    ffrxETH & xfrxETH

    Name
    Address
    Notes

    rUSD, beta = 0

    • rUSD: 0x65D72AA8DA931F047169112fcf34f52DbaAE7D18

    • FxUSDRebalancer: 0x78c3aF23A4DeA2F630C130d2E42717587584BF05

    feETH & xeETH

    Name
    Address
    Notes

    fezETH & xezETH

    Name
    Address
    Notes

    btcUSD, beta = 0

    • btcUSD: 0x9D11ab23d33aD026C466CE3c124928fDb69Ba20E

    • FxUSDRebalancer: 0x78c3aF23A4DeA2F630C130d2E42717587584BF05

    fWBTC & xWBTC

    Name
    Address
    Notes

    funiBTC & xuniBTC

    Name
    Address
    Notes

    cvxUSD, beta = 0

    • cvxUSD: 0x9f0D5E33617A1Db6f1CBd5580834422684f09269

    • FxUSDRebalancer: 0x78c3aF23A4DeA2F630C130d2E42717587584BF05

    fCVX & xCVX

    Name
    Address
    Notes

    f(x) on stETH, beta = 0.1

    Name
    Address
    Notes

    Rebalance Pool

    • RebalancePoolRegistry: 0x4eEfea49e4D876599765d5375cF7314cD14C9d38

    • RebalancePoolSplitter: 0x79c5f5b0753acE25ecdBdA4c2Bc86Ab074B6c2Bb

    • Gauge: 0x9710ca7f3edd4893f399c89ea184d92cc7172e28

    • RebalancePoolGaugeClaimer: 0x81243a88Dd9Fb963c643bD3f2194c2cA9CCFc428

    Name
    Address
    liquidator
    Notes

    Revenue Sharing

    Name
    Address
    Notes
    Token Burner
    Address
    Note

    Bridging

    fETH

    • Ethereum ProxyOFT: 0xc608Dfb90A430Df79a8a1eDBC8be7f1A0Eb4E763

    Chain
    Token Address

    xETH

    • Ethereum ProxyOFT: 0x535f7Ca9637A5099DB568b79a3624CFd6B5fc833

    Chain
    Token Address

    FXN

    • Ethereum ProxyOFT: 0x808130d89fC067a7a8D9dDF4ca2abf6EB5Ed3B32

    Chain
    Token Address

    arUSD (4626)

    • Ethereum ProxyOFT: 0xeC4840cD835A1f31E7f77def10Aa7f6bE802E539

    Chain
    Token Address

    f(x) Protocol 2.0 Gtihub: f(x) Protocol 2.0 Contracts:

    Useful links

    Whitepaper_V2 : X : Medium :

    Discord :

    Dune: /

    Github:

    Earn

    Where Does the Yield Come From?

    The f(x) Protocol provides multiple opportunities to earn yields through Earn Pools and FX Auto-Compound mechanisms. These tools leverage BaseTokens, Liquid Staking Derivatives (LSDs), and FXN emissions to generate returns.

    Earn Pools

    Stable holders can stake their fTokens into Earn Pools (also known as Stability Pools) to earn yields generated by BaseTokens, plus FXN emissions. Each Earn Pool is tailored to the specific characteristics of its collateral.

    fxUSD Earn Pools

    • Collateral: wstETH and frxETH.

    • Yield: Earn wstETH and frxETH rewards.

    • Details:

      • fxUSD Earn Pools are segregated by reserve LSD, allowing for variations in yield and leverage across stability pools.

      • Pools reflect the different risks, base yields, and reserve backing of their respective LSDs.

    btcUSD Earn Pools

    • Collateral: WBTC.

    • Yield: Earn WBTC rewards.

    • Details:

      • Unlike other BaseTokens, WBTC has no built-in yield.

      • xWBTC holders pay competitive funding rates for leveraged price exposure.

      • btcUSD holders share these funding rates without additional costs, with xWBTC’s funding rate tracking the crvUSD borrowing rate against WBTC.

    rUSD Earn Pools

    • Collateral: eETH and ezETH (ETH Liquid Restaking Tokens).

    • Yield: Earn restaking rewards, including points, without ETH price exposure.

    • Details:

      • 100% of reserve points flow to the rUSD Stability Pool, along with 50% of LST yields.

      • This makes the rUSD Stability Pool’s point accrual rate significantly higher than directly holding the LST.

    cvxUSD Earn Pools

    • Collateral: CVX.

    • Yield: Earn staking rewards from Convex Finance.

    • Details:

      • Users can stake cvxUSD in Earn Pools to earn CVX staking yields while maintaining the stablecoin’s dollar peg.

    fETH Earn Pools

    • Collateral: stETH.

    • Yield: Earn native LSD rewards from stETH, plus FXN emissions.

    0xcdF067F306E7a511Ef701588AFCdcff292B19282

    0xLlama

    0x7904Ad7c992CDAb500dAa0f3366301b1f5365B62

    chiaki644 🪔

    0x4088421cBDBa1501d8Fd09fD241717097Afb42Cb

    Gordon 🪔

    0x38a93e70b0D8343657f802C1c3Fdb06aC8F8fe99

    Guo Yu

    0x74390470F4001Ca85D93bD546A4Ab1724359654B

    Jamie 🪔

    0xe3522d85d37F55735e9327CD7a5cDe3abaf28E03

    Martin Krung

    0x8EcAB7B8ed8215cA52500cbf1548B9239173ef82

    Sharlyn Wu 🪔

    0x85DB62FdFA9Ee6050f8b422F74D75D2069dA102B

    vfat

    0xef0ca09fbf9a5f61e657fb208b46b8685c1d4766

    Gordon 🪔

    0x38a93e70b0D8343657f802C1c3Fdb06aC8F8fe99

    Guo Yu

    0x74390470F4001Ca85D93bD546A4Ab1724359654B

    Jamie 🪔

    0xe3522d85d37F55735e9327CD7a5cDe3abaf28E03

    Sharlyn Wu 🪔

    0x85DB62FdFA9Ee6050f8b422F74D75D2069dA102B

    0x28c921adAC4c1072658eB01a28DA06b5F651eF62
    0x250893CA4Ba5d05626C785e8da758026928FCD24
    0xaCDc0AB51178d0Ae8F70c1EAd7d3cF5421FDd66D

    [stETH/ETH Curve2 Spot] * [ETH/USD Spot ]

    https://data.chain.link/feeds/ethereum/mainnet/eth-usd
    https://info.uniswap.org/#/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640
    https://info.uniswap.org/#/pools/0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8
    https://v2.info.uniswap.org/pair/0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc
    stETH/ETH Curve EMA
    ETH/USD Chainlink TWAP
    stETH/ETH Curve Spot
    stETH/ETH Univ3 Spot
    stETH/ETH Balancer Spot
    Curve frxETH/WETH EMA
    Chainlink ETH/USD TWAP
    Curve frxETH/WETH Spot
    Curve frxeth Spot
    Curve stETH/frxETH Spot
    Curve steth Spot
    RedStone weETH/ETH Twap
    Chainlink ETH/USD TWAP
    Uniswap V3 ETH/weETH 0.05%
    Uniswap V3 wstETH/weETH 0.05%
    Curve steth-ng
    Curve weETH/ETH
    RedStone ezETH/ETH Twap
    Chainlink ETH/USD TWAP
    Curve ezETH/ETH
    Balancer V2 Stable
    Chainlink WBTC/BTC Twap
    Chainlink BTC/USD Twap
    Curve TriCryptoUSDC
    Uniswap V3 WBTC/USDC 0.3% Spot
    Uniswap V3 WBTC/ETH 0.3% Spot
    Uniswap V3 USDC/ETH 0.05% Spot
    Chainlink CVX/USD Twap
    Chainlink CVX/USD Spot
    Curve CVX/ETH
    https://github.com/AladdinDAO/aladdin-v3-contracts/pull/198
    V2 Whitepapers
    https://x.com/protocol_fx
    https://medium.com/@protocol_fx_667
    https://discord.com/invite/D8znPnRqZ6
    https://dune.com/ivan123/protocol-fx
    https://dune.com/degenerate_defi/fx-protocol-a-closer-look
    https://github.com/AladdinDAO

    FXN

    0x365AccFCa291e7D3914637ABf1F7635dB165Bb09

    veFXN

    0xEC6B8A3F3605B083F7044C0F31f2cac0caf1d469

    VotingEscrowHelper

    0xd766f2b87DE4b08c2239580366e49710180aba02

    VotingEscrowBoost

    0x8Cc02c0D9592976635E98e6446ef4976567E7A81

    VotingEscrowProxy

    0x1145f304d74f3295Fa38b82e7BB8704B0E187FA1

    TokenMinter

    0xC8b194925D55d5dE9555AD1db74c149329F71DeF

    GaugeController

    0xe60eB8098B34eD775ac44B1ddE864e098C6d7f37

    GaugeControllerOwner

    0x1Ca7b82c4265835C7841cf29407217D820a7DADb

    SmartWalletWhitelist

    0xD71B8B76015F296E53D41e8288a8a13eAfFff2ea

    Vesting FXN

    0x2290eeFEa24A6E43b26C27187742bD1FEDC10BDB

    ManageableVesting FXN

    0x0E4f31a2f48418c90F5e9fa84Bf761D832C54ceD

    CvxFxnVestingManager

    0x43fCFe9F128b5e4271c7E25C47eFe91bA8896220

    SdFxnVestingManager

    0xA2FaffE31153e5E60F2352e3ed28ff973309C156

    MultipleVestHelper

    0x267b7A1d56d624293Ba1819f30B5bf0F12A524E4

    ReservePoolV2

    0xb592E01dd77084b36430ffCB9c9D2F76fDE32631

    FxChainlinkTwapOracle ezETH/ETH

    0x376669aFa692A2c6961813C854c78542A3488f55

    30min twap

    FxChainlinkTwapOracle BTC/USD

    0x82012139b29BC5Ac2ff4066832c836122bC6c690

    30min twap

    FxChainlinkTwapOracle WBTC/BTC

    0xe3202d6029320b6592B439bD67b7E2C154441413

    30min twap

    FxChainlinkTwapOracle CVX/USD

    0x1964Dc4ee572631c6947096736238716b15Ce0EE

    30min twap

    FxStETHTwapOracle

    0xa84360896cE9152d1780c546305BB54125F962d9

    30min twap

    FxFrxETHTwapOracle

    0x939c38921c961DecB3cc16f601C32d07C41cd25C

    deprecated

    FxEETHTwapOracle

    0x834E87262A00b0aC38eD49Cb1110838866bE4a20

    deprecated

    FxEzETHTwapOracle

    0x51Ef9FD457b9607911fB6cB72B9E47ffd5f053a6

    deprecated

    FxWBTCTwapOracle

    0x7e94c07C6C3b2C931E9517529F56553770a7C0D2

    deprecated

    SpotPriceOracle

    0xc2312CaF0De62eC9b4ADC785C79851Cb989C9abc

    FxStETHOracleV2

    0x83bDc459Ac3887B2A61aA47DCA3Acac26a333D20

    30min twap

    FxFrxETHOracleV2

    0xffe563c168C01e05DA4f3d81938AF158466ad793

    30min twap

    FxEETHOracleV2

    0xE1B11bb0B6d1b321EEb7e0298A3f9EB92171693B

    30min twap

    FxEzETHOracleV2

    0x564a464c9C357de593Fa48EfD784048a9e366523

    30min twap

    FxWBTCOracleV2

    0x4f8330946669d71014efdce30ef19a256643fba8

    30min twap

    FxCVXOracle

    0x7267277682FFC281B00B0Ec56D8de22e8Ae88E13

    30min twap

    crvUSD+fxUSD

    0x8ffc7b89412efd0d17edea2018f6634ea4c2fcb2

    0xF4Bd6D66bAFEA1E0500536d52236f64c3e8a2a84

    dual farm

    PYUSD+fxUSD

    0xd6982da59F1D26476E259559508f4135135cf9b8

    0xeD113B925AC3f972161Be012cdFEE33470040E6a

    dual farm

    DOLA+fxUSD

    0x189B4e49B5cAf33565095097b4B960F14032C7D0

    0x61F32964C39Cca4353144A6DB2F8Efdb3216b35B

    dual farm

    GRAI+fxUSD

    0x69Cf42F15F9325986154b61A013da6E8feC82CCF

    0xfa4761512aaf899b010438a10C60D01EBdc0eFcA

    dual farm

    FRAX+fxUSD

    0x1EE81c56e42EC34039D993d12410d437DdeA341E

    0x31b630B21065664dDd2dBa0eD3a60D8ff59501F0

    dual farm

    GHO+fxUSD

    0x74345504Eaea3D9408fC69Ae7EB2d14095643c5b

    0xf0A3ECed42Dbd8353569639c0eaa833857aA0A75

    dual farm

    mkUSD+fxUSD

    0xca554e2e2948a211d4650fe0f4e271f01f9cb5f1

    0xDbA9a415bae1983a945ba078150CAe8b690c9229

    dual farm

    ULTRA+fxUSD

    0xf33ab11e5c4e55dacb13644f0c0a9d1e199a796f

    0x0d3e9A29E856CF00d670368a7ab0512cb0c29FAC

    dual farm

    fxUSD+rUSD

    0x2116bfad62b383043230501f6a124c6ea60ccfa5

    0x697DDb8e742047561C8e4bB69d2DDB1b8Bb42b60

    dual farm

    alUSD+fxUSD

    0x27cb9629ae3ee05cb266b99ca4124ec999303c9d

    0x9c7003bC16F2A1AA47451C858FEe6480B755363e

    dual farm

    eUSD+fxUSD

    0x16b54e3aC8e3ba088333985035b869847e36E770

    0x5801Bb8f568979C722176Df36b1a74654A9C52b5

    dual farm

    rgUSD+fxUSD

    0x6fC7eA6CA8Cd2759803eb78159C931a8FF5E0557

    0x4CA79F4FE25BCD329445CDBE7E065427ACa98380

    dual farm

    MIM+fxUSD

    0xD7Bf9bb6Bd088317Effd116E2B70ea3A054cBceb

    0xDF7fbDBAE50C7931a11765FAEd9fe1A002605B55

    zunUSD+fxUSD

    0x13eA95Ce68185e334d3747539845A3b7643a8cab

    0x9516c367952430371A733E5eBb587E01eE082F99

    dual farm

    USDC+fxUSD

    0x5018BE882DccE5E3F2f3B0913AE2096B9b3fB61f

    0xf1E141C804BA39b4a031fDF46e8c08dBa7a0df60

    USD0+fxUSD

    0x74c204520c9e88aA3EB9d61788ABA11Be1e0193F

    0x0B700C60de435D522081cC5eB12B63875FE7e65a

    feETH

    0xf594bDfafE4197144C6459FcA611d7B868d36bEa

    0x835191186745e63f9e325E741B273ff925174d7e

    fezETH

    0xb2E43ECecA7c110c74Cf13Ba35105B0633B74E91

    0xb259515748c75A7216a4849e67cEB166b0DAa98b

    fWBTC

    0x4E6A1dC233f264dd07b63E206Fc451d986bA9908

    0x93670efe073e0d75BE16445779a8399E6b418004

    fCVX

    0xb5152D159fce50a7576eBa7FAb61C2B98F0Ed692

    0x05c630E9FC8A064f0e8E6fBB9e2B5D2215Da5653

    WstETHRateProvider

    0x81A777c4aB65229d1Bf64DaE4c831bDf628Ccc7f

    FxInitialFund

    0xe6b953BB4c4B8eEd78b40B81e457ee4BDA461D55

    RebalancePoolRegistry

    0x86e987a89Fd7345457d97b9e82906f346D61Df39

    RebalancePoolSplitter

    0x78Ef19714c8b3c71997970C156f59605A99C3ff3

    RebalancePool.wstETH

    0x9aD382b028e03977D446635Ba6b8492040F829b7

    RebalancePool.xstETH

    0x0417CE2934899d7130229CDa39Db456Ff2332685

    LeveragedTokenWrapper

    0x6AF422087aBF42819F764FF8DE95269036b9A8F9

    ERC4626RateProvider sfrxETH

    0x7ceD6167b5A08111dC8d0D2f9F7E482c4Da62506

    FxInitialFund

    0xFC3862c33b54E0BBA61d966Ff51973C20be4fC62

    RebalancePoolRegistry

    0x345a345DAd48c3504113539ce83c0cB765627B54

    RebalancePoolSplitter

    0xb26cA48fe4Ee94a4Fe8815F7E54E99124f997540

    RebalancePool.sfrxETH

    0xb925F8CAA6BE0BFCd1A7383168D1c932D185A748

    RebalancePool.xfrxETH

    0x4a2ab45D27428901E826db4a52Dae00594b68022

    LeveragedTokenWrapper

    0x823BaF74524b707d649A2a78E66DF106f5A131aB

    FxInitialFund

    0x6dc7a100d09DDbF344FC4Dd0398f79500D0c2716

    RebalancePoolRegistry

    0xb1dD23468a69DFDDb7211298e609C0DB1522B2D6

    RebalancePoolSplitter

    0x015729C84A1C5E541DFbF6f0dDc59AE66527B5eD

    RebalancePool.weETH

    0xc2DeF1E39FF35367F2F2a312a793477C576fD4c3

    RebalancePool.xeETH

    0x7EB0ed173480299e1310d55E04Ece401c2B06626

    LeveragedTokenWrapper

    0xA9414Ee8b2b2563E70174972FAa2E8B5197Feb5D

    BalancerV2CachedRateProvider ezETH

    0xE3fF08070aB3aD7eeE7a1cab35105F27DF8EfF10

    FxInitialFund

    0x7612bCAbd3D66c71fF740472e063be6a74f126D1

    RebalancePoolRegistry

    0x5e3ca2A5736fb093328e4CA19A9A1966025f3905

    RebalancePoolSplitter

    0x2755EEbf220BFD31B83Fd9244B6D061bCa225311

    RebalancePool.ezETH

    0xf58c499417e36714e99803Cb135f507a95ae7169

    RebalancePool.xezETH

    0xBa947cba270D30967369Bf1f73884Be2533d7bDB

    LeveragedTokenWrapper

    0xBeb4289491EBFE8452CfAc8830a6285E42A4742b

    FxInitialFund

    0x29eE4B752fE14B0BC1F279DCA98415f2Fa6F3A8d

    RebalancePoolRegistry

    0x163283D59FE2A579f2920A7F8eA19F7799B32fA0

    RebalancePoolSplitter

    0x054fAC7aA44F85A59FD41c33006336EC8b03E916

    RebalancePool.WBTC

    0xf291EC9C2F87A41386fd94eC4BCdC3270eD04482

    RebalancePool.xWBTC

    0xBB549046497364A1E26F94f7e93685Dc29FAd8c0

    LeveragedTokenWrapper

    0x1A17Ccf198E03858227c27205f15a4b388235DB7

    ERC4626RateProvider aCVX

    0x6Eb03222179F83126735D7E9FdE94571D716D399

    FxInitialFund

    0x05abFAD11c275F91Cc79f6ec507CB273e9f59dE7

    RebalancePoolRegistry

    0x63B038A7298FbDCf0945068637Ec59B8A5E9C6Bd

    RebalancePoolSplitter

    0xce5A14C662f00C614aA467b82c654548540F2fcA

    RebalancePool.aCVX

    0x0AB9Dc99a33Cd02A776a9117f211803Fb69Fd7C4

    RebalancePool.xCVX

    0xA04d761adad1029e4f2F60ac973a76c5307EfceA

    LeveragedTokenWrapper

    0x08A602616593b79591cFC88A130c8825a0fcbd94

    ReservePool

    0x5d0Aacf75116d1645Db2B3d1Ca4b303ef0CA3752

    deprecated

    FxGateway

    0x5c28b966aB37cFB9397bBc04595f91F0fBf06d9b

    deprecated

    stETHGateway

    0x9bF5fFABbF97De0a47843A7Ba0A9DDB40f2e2ed5

    deprecated

    wstETHWrapper

    0xb09e34dD25d5E88a1E9Ff6F6418109927675B658

    StETHAndxETHWrapper

    0xC2BdBF323304eaBd9260b42E4d0d429Ca3481d6E

    TokenSale Round1

    0x3eB6Da2d3f39BA184AEA23876026E0747Fb0E17f

    TokenSale Round2

    0x674A745ADb09c3333D655cC63e2d77ACbE6De935

    bFXN TokenSale 1

    0x3E9CDbC08b09579BbC8b5b901d88c27eE60e6498

    bFXN TokenSale 2

    0xBBa4114F182E0b33FFBeB538A680639516b647ab

    ChainlinkTwapOracleV3 ETH/USD

    0x460B3CdE57DfbA90DBed02fd83d3990a92DA1230

    30min twap

    ChainlinkTwapOracleV3 stETH/USD

    0xD24AC180e6769Fd5F624e7605B93084171074A77

    30min twap

    FxChainlinkTwapOracle ETH/USD

    0x2EB56aA6A6E48b142287f723E547c687281580bD

    30min twap

    FxChainlinkTwapOracle weETH/ETH

    0x56bC0Ec4049f25E7dd455B64d1c6318c1D9Ce789

    30min twap

    ETH+FXN

    0xE06A65e09Ae18096B99770A809BA175FA05960e2

    0xA5250C540914E012E22e623275E290c4dC993D11

    dual farm

    FXN+cvxFXN

    0x1062FD8eD633c1f080754c19317cb3912810B5e5

    0xfEFafB9446d84A9e58a3A2f2DDDd7219E8c94FbB

    dual farm

    FXN+sdFXN

    0x28Ca243dc0aC075dD012fCf9375C25D18A844d96

    0x5b1D12365BEc01b8b672eE45912d1bbc86305dba

    fETH

    0x9710ca7f3edd4893f399c89ea184d92cc7172e28

    0x81243a88Dd9Fb963c643bD3f2194c2cA9CCFc428

    fstETH

    0xf422446F7730e50B9CAb4618343425d9927b35ED

    0xCa0563ab14a87ee64d6b097B0dfC46E9B56820aD

    ffrxETH

    0xB3886b8c94C8635B786b1CA88942337669BB1e1E

    0x4ae3BE52c411CC08434d28645FD391497C69c815

    Treasury

    0xED803540037B0ae069c93420F89Cd653B6e3Df1f

    Market

    0xAD9A0E7C08bc9F747dF97a3E7E7f620632CB6155

    fstETH

    0xD6B8162e2fb9F3EFf09bb8598ca0C8958E33A23D

    xstETH

    0x5a097b014C547718e79030a077A91Ae37679EfF5

    Treasury

    0xcfEEfF214b256063110d3236ea12Db49d2dF2359

    Market

    0x714B853b3bA73E439c652CfE79660F329E6ebB42

    ffrxETH

    0xa87F04c9743Fd1933F82bdDec9692e9D97673769

    xfrxETH

    0x2bb0C32101456F5960d4e994Bac183Fe0dc6C82c

    Treasury

    0x781BA968d5cc0b40EB592D5c8a9a3A4000063885

    Market

    0x267C6A96Db7422faA60Aa7198FfEeeC4169CD65f

    feETH

    0x9216272158F563488FfC36AFB877acA2F265C560

    xeETH

    0xACB3604AaDF26e6C0bb8c720420380629A328d2C

    Treasury

    0x38965311507D4E54973F81475a149c09376e241e

    Market

    0x69518D1D70AD537C41401303BDf96032338E40dE

    fezETH

    0x50B4DC15b34E31671c9cA40F9eb05D7eBd6b13f9

    xezETH

    0x2e5A5AF7eE900D34BCFB70C47023bf1d6bE35CF5

    Treasury

    0x63Fe55B3fe3f74B42840788cFbe6229869590f83

    Market

    0x56B85438F1E16a91eAc5Fe2DAAb2C3Dd57690175

    fWBTC

    0x576b4779727F5998577bb4e25bf726abE742b9F7

    xWBTC

    0x9f23562ec47249761222EF7Ac02b327a8C45Ba7D

    FxInitialFund

    0x1D20671A21112E85b03B00F94Fd760DE0Bef37Ba

    Treasury

    0xdFac83173A96b06C5D6176638124d028269cfCd2

    Market

    0x8e3815Ef103B8d8528778969cD53baa2E94bE25e

    fCVX

    0x9Fcb2c47DaB11e38fec4b8c886F63741bfED4c41

    xCVX

    0xB90D347e10a085B591955Cbd0603aC7866fCADC8

    fETH

    0x53805A76E1f5ebbFE7115F16f9c87C2f7e633726

    xETH

    0xe063F04f280c60aECa68b38341C2eEcBeC703ae2

    stETHTreasury

    0x0e5CAA5c889Bdf053c9A76395f62267E653AFbb0

    Market

    0xe7b9c7c9cA85340b8c06fb805f7775e3015108dB

    RebalancePool.wstETH

    0xa677d95B91530d56791FbA72C01a862f1B01A49e

    0x17f21f468d77E6e35702a9Ae7a9da50Db7F6a4f4

    deprecated

    BoostableRebalancePool.wstETH

    0xc6dEe5913e010895F3702bc43a40d661B13a40BD

    0x74E9234A6e03c382A01Bb942B1aF05B639371309

    BoostableRebalancePool.xETH

    0xB87A8332dFb1C76Bb22477dCfEdDeB69865cA9f9

    0x5a161B94c737326cA115eC46f4Eaf4eEC5037dBE

    PlatformFeeSplitter

    0x0084C2e1B1823564e597Ff4848a88D61ac63D703

    FeeDistributor stETH

    0x851AAEA3A2757D457E1Ce88C3808C1690213e432

    deprecated

    FeeDistributor wstETH

    0xd116513EEa4Efe3908212AfBAeFC76cb29245681

    PlatformFeeBurner

    0x6440e21A3634C319c69CEf8d17601DBC4E97C3dB

    wstETH

    Ethereum

    0x53805A76E1f5ebbFE7115F16f9c87C2f7e633726

    Arbitrum

    0xc608Dfb90A430Df79a8a1eDBC8be7f1A0Eb4E763

    BSC

    0xF9E10DAA647E540BF3d1334377a88361aB980e94

    Optimistic

    0xc608Dfb90A430Df79a8a1eDBC8be7f1A0Eb4E763

    Polygon

    0xc608Dfb90A430Df79a8a1eDBC8be7f1A0Eb4E763

    Ethereum

    0xe063F04f280c60aECa68b38341C2eEcBeC703ae2

    Arbitrum

    0x55380fe7A1910dFf29A47B622057ab4139DA42C5

    BSC

    0x62C6867e4f2e63302B15cbf9b8540214a13beeac

    Optimistic

    0xa7580d4AdC6D302D2D4C7C3dB93E9aE3F82C4617

    Polygon

    0xa7580d4AdC6D302D2D4C7C3dB93E9aE3F82C4617

    Ethereum

    0x365AccFCa291e7D3914637ABf1F7635dB165Bb09

    Arbitrum

    0x179F38f78346F5942E95C5C59CB1da7F55Cf7CAd

    BSC

    0xa64f68c089B3E69d48F6047d3Be513349E74b3De

    Optimistic

    0xC752C6DaA143e1a0ba3E7Df06f3117182432b991

    Polygon

    0xC752C6DaA143e1a0ba3E7Df06f3117182432b991

    Ethereum

    0x07D1718fF05a8C53C8F05aDAEd57C0d672945f9a

    Blast

    0xc608Dfb90A430Df79a8a1eDBC8be7f1A0Eb4E763

    Linea

    0xc608Dfb90A430Df79a8a1eDBC8be7f1A0Eb4E763

    Fx.Governance
    Fx.stETH
    https://github.com/AladdinDAO/fx-protocol-contracts/tree/main
    https://github.com/AladdinDAO/fx-protocol-contracts/blob/main/ignition/deployments/ethereum/deployed_addresses.json

    dual farm