IT’S’ ALIIIIIVE!!!

The first fully trustless, reward-earning AMM pool on StarkEx layer 2 has just opened on rhino.fi.

Building fully trustless AMMs on our StarkEx layer 2 rollup has been one of the toughest technical challenges we’ve ever faced. It’s been audited and tested under every imaginable scenario, without shortcuts. 

And now the technology is open to everyone, starting with a DVF:ETH showcase.

The pool blends L2 rollup logic with Ethereum mainnet Solidity smart contracts. And we’ve built the first-ever mainnet use case for L1 limit orders – a novel building block provided by StarkEx – to make our technology truly capital-efficient.

Now anyone, anywhere can swap in the pools and seize arbitrage opportunities, or provide liquidity to the pools to start earning fees and AMM liquidity mining rewards. As well as the speed and cost benefits of L2, you get the full benefits of L1.

This means total trustlessness, without compromise.

The technical challenges of our AMMs (and how we overcame them)

 

In retrospect, building on StarkEx presented a number of challenges that weren’t evident at the outset of the project.

StarkEx is designed for high-performance trading. By giving up some of the flexibility of a Turing-complete virtual machine (which is available on StarkNet but not StarkEx), we instead gain the potential for higher throughput and lower cost per transaction. 

We determined early on in 2021 that it was indeed technically possible to build AMMs over StarkEx. One of the major benefits of doing so would be to combine the AMM liquidity with existing order-book liquidity, and route users’ orders to get the best price from both sources.

What we underestimated was the level of complexity involved in doing so. 

In total the project took over a year to complete. Time and again we butted the limits of what we could do with StarkEx, requiring multiple upgrades of the smart contracts and proving system to deliver the final result.

The main technical components are as follows:

  • A forked Uniswap V2 solidity smart contract system, upgraded to connect with the StarkEx bridge.
  • A smart contract transpiler to C++, which feeds into rhino.fi’s off-chain matching engine.
  • All the AMM operations (supply liquidity, remove liquidity, and swap) replicated on StarkEx using limit orders.
  • A complicated syncing process between L2 and L1, which ensures that the state of each AMM pool on L1 always matches the pool’s state on StarkEx at the point of proofs being submitted.

The system was audited by Peckshield and heavily tested. The longest period of public mainnet testing lasted six months (yep, six whole months!), with six pools available for trading but with whitelisted liquidity provision, and without the syncing process to L1.

As a result of this long, long period of testing, we have high confidence in the robustness of the solution. 

As always, if rhino.fi were to go offline as an operator of StarkEx, users would be able to exit their funds back to L1 and withdraw from the AMM pools, giving the ultimate guarantee of trustlessness.

 

The most difficult challenge: syncing using L1 limit orders

 

In order to build our AMMs we used the StarkEx L1 limit order. This is a concept that has been theorised multiple times by the StarkWare team, and has several potential use cases (you can read more about them here).

However, we believe we are the first-ever team to use limit orders at scale in production.

This tool allows the capital-efficient borrowing of funds from StarkEx on L1. Essentially, each time a user provides or removes liquidity on L2, we authorise the borrowing of their funds from the StarkEx bridge contract on L1, using the AMM contract. 

This mechanism allows the syncing to remain trustless, with all user activity taking place on L2 at low cost.

Why do these AMM pools matter for the future of rhino.fi as a platform?

Our new liquidity pool AMMs are potentially transformative for several reasons.

1. DVF is transformed into a yield-bearing asset, with liquidity provision rewards

 

As well as providing governance rights, DVF is now a productive asset, earning yield and offering a showcase of what is possible using these AMM pools

We’ve added a low level of rewards to incentivise liquidity providers to deposit DVF and ETH, starting at 2,000 DVF per month. This is targeting a relatively small TVL for the pool, but can be increased in future if there is demand.

And, as an extra incentive, anyone who deposits a minimum amount may also get a nice little surprise, as a pioneer of L2 AMMs. 

 

2. We can now add any Ethereum-based market quickly, so we can use our AMMs and liquidity pools to introduce token incentives tactically

 

AMMs allow us to expand the number of markets available on rhino.fi and react quickly to new trends and narratives. 

So if Optimism’s hot, we can create an OP liquidity pool. When StarkNet launches its token, you’ll be able to deposit your airdrop to provide liquidity on STARK:USDC. 

However, whilst this is a useful tool, we don’t think the time is right to launch a full-scale liquidity mining rewards programme. This is something that was planned in the past, but given the market conditions and rhino.fi’s new cross-chain strategy, we don’t believe this is a good use of DVF.

Our cross-chain integrations make many more tokens available to rhino.fi users, allowing them to access liquidity across a number of DEXes on different chains. This means that DVF holders do not need to fund a large AMM liquidity mining programme to ensure good prices on the majority of tokens. 

Instead, AMMs and incentives can be used tactically, to target high-value AMM pools and respond to fast-breaking market conditions.

3. These AMMs enable a future ‘frontier zone’ with L1 and L2 modes.

 

The design of our AMM pools means that each pool can operate in both ‘L1 mode’ and ‘L2 mode’.

When in L1 mode the liquidity pool exists on Ethereum L1, and looks, feels and acts exactly like a pool on Sushi or Uniswap V2. 

This is great from a compatibility point of view, because existing DEX aggregators, and MEV bots, can interact with the pools. This means that there is no opportunity cost for liquidity providers.

Providers offer their liquidity on L1, making it accessible if your funds are already held there, and it is possible to make the creation of these L1 pools completely permissionless.

When L2 mode is activated, however, all existing liquidity is migrated to L2, so swaps and liquidity provision are performed exclusively on L2. However, the pools can no longer be traded against on L1, but only on rhino.fi.

The frontier zone is something we will explore in the future on rhino.fi, and would allow the creation of permissionless pools on any L1 assets. This could mean an almost unlimited number of AMM pools, similar to Sushi and Uniswap today. 

Once a pool reaches a certain size, we can then enable it for L2 mode, migrating liquidity to L2 and making it available to all users for gas-free swapping.

4. We’ve created the potential for fee collection and distribution to xDVF holders

 

Each of our AMM pools has configurable fees, which can be split between LP providers, the StarkEx operator, and xDVF holders. 

Our initial pools allocate 100% of fees to LP providers, but in future, once we have more pools, this can be reconfigured to channel AMM pool fees to xDVF holders. Stay tuned for governance proposals on this topic.

So, in summary…

We’ve flexed the full extent of our technological prowess on this one, pushing our team and StarkEx to the limits to achieve fully trustless AMMs

Now, we are asking you to join us and try the result.

Share this post

Latest Posts

Sign up now!Sign up to our newsletter now to hear all about rhino.fi’s upcoming mystery airdrop, new chain launches and yield opportunities and be in with a chance of winning $5000.
Sign up now!Sign up to our newsletter now to hear all about rhino.fi’s upcoming mystery airdrop, new chain launches and yield opportunities and be in with a chance of winning $5000.
Sign up now!Sign up to our newsletter now to hear all about rhino.fi’s upcoming mystery airdrop, new chain launches and yield opportunities and be in with a chance of winning $5000.
Sign up now!Sign up to our newsletter now to hear all about rhino.fi’s upcoming mystery airdrop, new chain launches and yield opportunities and be in with a chance of winning $5000.
Sign up now!Sign up to our newsletter now to hear all about rhino.fi’s upcoming mystery airdrop, new chain launches and yield opportunities and be in with a chance of winning $5000.
Sign up now!Sign up to our newsletter now to hear all about rhino.fi’s upcoming mystery airdrop, new chain launches and yield opportunities and be in with a chance of winning $5000.

Earn 19% APY on your stablecoins