
Wait, how does Fibrous work?
Hello Fib Gang! Today, we will understand how Fibrous works and what makes it special in the StarkNet ecosystem.
As we announced in our previous blog post, Fibrous is a DEX Aggregator that offers the best swap rates on StarkNet validity Rollup. Now let’s try to understand how Fibrous is giving the best rates for your swaps across the StarkNet ecosystem.
Firstly, Fibrous is not a traditional AMM. No liquidity is provided to Fibrous. Fibrous is just a tool that finds optimal routing across all AMMs of StarkNet. With Fibrous, you don’t need to search for the best Liquidity and price for your tokens between different StarkNet AMMs. Fibrous will automate this process for you.
So, how? Genuinely, Fibrous uses an advanced optimized order routing algorithm to find better prices for you across StarkNet. One way that the Fibrous Router achieves better prices is by splitting your funds across multiple pools and different AMMs through all of the StarkNet rollup.

In the legacy routing, as you know from traditional AMMs, a swap was always executed through a single route. If you want to swap TokenA for TokenB, traditional AMMs execute this transaction from a single pool with highest liquidity possible. If there is not enough liquidity for this transaction, you’ll face high negative slippage rates and price impact of your transaction will cause a loss.

Even if an AMM executes a swap with multiple routing, It will only route from the pools on itself. Similar to Uniswap v3’s Smart Order Router. Although this route is perfect for an AMM, it is not sufficient. Because the current routing takes place only in pools on a single AMM.
Fibrous, on the other hand, follows a different path. Fibrous scans every AMM on StarkNet, regardless of any AMMs any pool, and finds the best price for you. In short, Fibrous is an AMM agnostic algorithm that cares only best swap rates for the trader by splitting your funds.
How will splitting funds make my trades profitable?
Before answering the question, let’s try to explain the situation with a brief example:
Imagine that market price of 1 ETH equals to 2000 USD so let’s say there is a liquidity pool with 100 ETH and 200000 DAI in it.
You want to swap your 10000 DAI for ETH. In current market conditions, your expectation is to swap 10000 DAI for 5 ETH.
But you will get ~4.7619 ETH for this trade. How?
In AMM’s there is a “Constant product formula” that the product of the number of both tokens added to the pool must equal a fixed number. The formula is:
TokenAPoolSize x TokenBPoolSize = ConstantProduct
So in our scenario:
There are 100 ETH and 200000 DAI in the pool, so,
100 x 200000 = 20000000 is our constant product.
The “constant product” is always a fixed number, regardless of the tokens exchanged.
When you swap, 10000 DAI for ETH, you added 10000 DAI to the pool and total DAI in the pool become 210000 DAI. To fix the 20000000 constant product;
20000000 / 210000 = 95.238095238 ETH must be in the pool.
There was 100 ETH in the pool before your swap; so you’ll receive
100 – 95.238095238 = 4.761904762 ETH.

We call this “Price Impact” in AMMs and calm down, Fibrous is here to help you.
Now, think that there are two seperate AMMs and they have pools with the same amount of liquidity. This time, imagine that market price of 1 ETH equals to 2000 USD again and say there is two liquidity pool with 100 ETH and 200000 DAI in it.
Again, you want to swap 10000 DAI for ETH. If you use Fibrous in these conditions, Fibrous will split your 10000 DAI for 5000 / 5000 for two different pools (as they have the same amount of liquidity if they are not the same Fibrous will split it accordingly) and swap two portions of 5000 DAI with the two different pools simultaneously.
If you make the calculations that we give above for both of the pools, you will see that for 10000 DAI, you’ll grab 4.87804878 ETH.
Congrats, you just saved 0.116144018 ETH for just using Fibrous!
This was a simple example to illustrate the advantages of optimized routing and splitting your money. Now imagine Fibrous doing this for every AMM protocol and every liquidity added to StarkNet. All in all, with Fibrous, your every trade will be more profitable, and you will be able to trade with very low slippage rates especially for larger trades.
Well, how about Gas costs?
Thanks to StarkNet, fees will be extremely low, ensuring Ethereum security. However, every fund split by Fibrous will be an extra cost for the user. To minimize this, Fibrous will split your funds up to five paths and will bring another solution for lower trades.
Sometimes, lower trades do not need splitting, and routing lower amounts may not be advantageous. This may not be preferred as each AMM applies its commission paid by you and each route taken by Fibrous will incur a small extra gas fee. Even Fibrous is using a gas cost optimized algorithm that ensures every new step is net positive for your swaps.
In such a case, especially for small trades, Fibrous brings the “Swap Cheapest” feature. This feature only serves to trade from the best liquidity pool in one go. By this, Fibrous will allow you to swap for the cheapest gas price possible, as it will draw a single route from the best place that has the highest liquidity.

In short, we designed Fibrous to be your swap buddy. Instead of searching for the best rate for your tokens, let Fibrous do the work for you. In a way that will make both the best rate and the cheapest.
Our goal is to make Fibrous one of the best user-experienced dApps and we continue to work for it. In our next blog post, we can talk about the commission fees that Fibrous applies and what it wants to do better for you.
Get in touch with us
Website: fibrous.finance
Twitter: Fibrous
Mail: [email protected]
Our Telegram and Discord channels are not active. Please do NOT trust anyone who invites you these channels. We’ll announce them later on.