bloXroute and Cron Finance teamed up to uncover new trading opportunities with TWAMM data streams

Article title image

bloXroute and Cron Finance have united to bring traders an exceptional suite of TWAMM data streams. This powerful collaboration empowers traders to swiftly and efficiently spot opportunities and capitalize on them like never before. With the cutting-edge TWAMM bloXroute service, users unlock a wealth of crucial information, enabling informed decision-making while navigating TWAMM pools. By harnessing the power of bloXroute’s cutting-edge BDN (Blockchain Distribution Network), this service sets a new standard for speed and efficiency in accessing pertinent information from TWAMM pools.

About Cron Finance Ethereum TWAMM

Cron Finance has developed a novel TWAMM (Time-Weighted Average Market Making) algorithm on the Ethereum blockchain. The TWAMM algorithm aims to break down long-term swaps of two tokens into infinitely small pieces and execute them smoothly over time against an embedded constant-product AMM (Automated Market Maker). For more detailed information about the project, click here.

Types of Swap Transactions on TWAMM:

Long-term Swap

A long-term swap is an order to sell a fixed amount of one asset over a specified number of blocks. TWAMM divides these long-term orders into numerous virtual sub-orders, which are then traded against the embedded AMM at a consistent rate over time. Users can set block intervals and durations for the swap execution, but the TWAMM pool handles the internal management of the swap. The key benefit is that users get a fixed price at the time of the order execution.

Short-term Swap (Partner Swap)

A short-term swap is primarily used for arbitrage purposes. It enables instant execution of a swap on the TWAMM pool based on the current state of liquidity/reserves in the pool. To submit short-term swaps on the pool, users need to be added to an ArbitrageList contract as a Partner. These short-term swaps are beneficial for arbitrage and locking in profits from trades on TWAMM pools.

Account/Pool Management

These transactions involve such actions as withdrawing executed assets and adding or removing pool liquidities. Although these are not the primary transactions monitored for applications, changes in pool liquidity can impact price movements. While there isn’t a dedicated stream to monitor such events, they can still be observed through the virtualOrder stream, specifically under the fields “virtualToken0Reserve”“virtualToken1Reserve”, salesPriceToken0, and salsePriceToken1.

Identifying Arbitrage Opportunities

In simple terms, when a long-term swap is executed, it indicates that the price will need to change during the blocks where the swap is ongoing (based on the direction/quantity of the swap). Short-term swaps, performed in conjunction with long-term swaps, help maintain the stability of the pool’s price and create profitable opportunities for traders.

Below is an example of arbitrage opportunities on Gorlie testnet. For more details, watch this demo video.

            ---------------- BLOCK UPDATE ----------------
received uniswap price: 177097334.96409023
received bloxroute price: 86954.74572865869
arb opportunity found, uniswap price is greater than bloxroute price
swapping 0.01 WETH for USDC on uniswap pool
swapping 869.5474572865869 USDC for WETH on twamm pool
WARNING:uniswap.uniswap:No fee set, assuming 0.3%
Sending transaction...0x5a0b36eaae362c7247d84c57fafbf446b9b8ec2d4335812af3a3ec44e0286d27

---------------- BLOCK UPDATE ----------------
received uniswap price: 177097334.96409023
received bloxroute price: 86958.4365576502
arb opportunity found, uniswap price is greater than bloxroute price
swapping 0.01 WETH for USDC on uniswap pool
swapping 869.584365576502 USDC for WETH on twamm pool
WARNING:uniswap.uniswap:No fee set, assuming 0.3%
Sending transaction...0xa5b0658472895cb8d6bc43df71e698e3d96c77eeb56f281f9f16cdd8bf26732a

WARNING:uniswap.uniswap:No fee set, assuming 0.3%
---------------- BLOCK UPDATE ----------------
received uniswap price: 177097334.96409023
received bloxroute price: 86963.2436570033
arb opportunity found, uniswap price is greater than bloxroute price
swapping 0.01 WETH for USDC on uniswap pool
swapping 869.6324365700331 USDC for WETH on twamm pool
WARNING:uniswap.uniswap:No fee set, assuming 0.3%
Sending transaction...0xdf9925826493f12c369e44b0ea4a258ab4867fb7827381ddd87b9efee406d14b

---------------- BLOCK UPDATE ----------------
received uniswap price: 177097334.96409023
received bloxroute price: 86984.41344506199
arb opportunity found, uniswap price is greater than bloxroute price
swapping 0.01 WETH for USDC on uniswap pool
swapping 869.8441344506199 USDC for WETH on twamm pool
WARNING:uniswap.uniswap:No fee set, assuming 0.3%
Sending transaction...0xf0e306cdad1ec96df3d3b2ca5aea37a8ca54eee453a0f3e483b6d5c1f86211be          

Capturing Arbitrage Opportunities

Long-term swap execution can create mispricings between the TWAMM price and the market price. In order to counteract liquidity pool imbalances, arbitrageurs are needed so long-term swappers can get correct pricing.

The TWAMM bloXroute Service

bloXroute’s TWAMM service offers DeFi traders multiple new data streams, allowing the discovery and execution of opportunities with ultra low latency. Further information about these streams is available below.

Cron Finance charges a fee for sending TWAMM orders per their fee schedule.

bloXroute users of the TWAMM service can receive a fee discount depending upon eligibility (specifics provided below).

bloXroute’s TWAMM service empowers DeFi traders to receive valuable mempool data and attain the best execution pricing. In addition, this service utilizes the BDN, making it the fastest and most accurate source for TWAMM pools data.

TWAMM Data Stream Details

This stream provides real-time statuses of particular TWAMM pools on a per-block basis.

Response Event

VirtualPool

Here’s a sample of stream subscription during wstETH-rETH Long Term Swap: 

            "<"{
   "jsonrpc":"2.0",
   "id":1,
   "method":"subscribe",
   "params":{
      "subscription":"deb2745c-069b-46c5-84ff-6acc1c35531b",
      "result":{
         "blockHeight":"17713460",
         "pool":{
            "poolID":"0x6910c4e32d425a834fb61e983c8083a84b0ebd01000200000000000000000532",
            "token0Symbol":"wstETH",
            "token0Address":"0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
            "virtualToken0Reserve":"43657075532859213491",
            "salesPriceToken0":0.9523822291060057,
            "salesPriceToken0Predicted":0.9528147456113629,
            "salesRateToken0":"9910999226942060",
            "token1Symbol":"rETH",
            "token1Address":"0xae78736Cd615f374D3085123A210448E74Fc6393",
            "virtualToken1Reserve":"45839867858349053214",
            "salesPriceToken1":1.0499985924125157,
            "salesPriceToken1Predicted":1.0495219607021942,
            "salesRateToken1":"0",
            "orders":[

            ]
         }
      }
   }
}"<"{
   "jsonrpc":"2.0",
   "id":1,
   "method":"subscribe",
   "params":{
      "subscription":"deb2745c-069b-46c5-84ff-6acc1c35531b",
      "result":{
         "blockHeight":"17713461",
         "pool":{
            "poolID":"0x6910c4e32d425a834fb61e983c8083a84b0ebd01000200000000000000000532",
            "token0Symbol":"wstETH",
            "token0Address":"0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
            "virtualToken0Reserve":"43666985045436271509",
            "salesPriceToken0":0.9528145991892115,
            "salesPriceToken0Predicted":0.9532472138324185,
            "salesRateToken0":"9910999226942060",
            "token1Symbol":"rETH",
            "token1Address":"0xae78736Cd615f374D3085123A210448E74Fc6393",
            "virtualToken1Reserve":"45829466805603394446",
            "salesPriceToken1":1.0495221219856838,
            "salesPriceToken1Predicted":1.049045814652442,
            "salesRateToken1":"0",
            "orders":[
            ]
         }
      }
   }
}          

Key Observations 

 

  1. The sales price of token0 goes up consistently every block due to the swapping of wstETH for rETH in the pool.
  2. Every block provides updated reserve information and sales price for each token.
  3. Arbitrage opportunities can easily be identified by comparing the token sales price with other AMMs such as Uniswap, SushiSwap, and PancakeSwap.

Order Stream

The Order Stream endpoint gives DeFi traders insightful data on pending transactions sitting in the mempool, shedding light on wallet addresses that have conducted both long-term and short-term swaps. By quickly and meticulously analyzing pending mempool transactions, traders can find arbitrage opportunities and profitably capture them.

Response Event

Order

            {
    "blockHeight":"8819399",
    "order":{
        "confirmationLevel":"CL_PENDING",
        "orderType":"OT_NEW",
        "swapType":"ST_LONG_TERM",
        "poolID":"0x69269Fe1945e018727Dd301790a465E357a9063B",
        "sender":"0x4836668594Ad7a6bae5ed39Eec1A0eB9e1e01dB6",
        "tokenIn":"0x07865c6E87B9F70255377e024ace6630C1Eaa37F",
        "tokenOut":"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
        "amount":"1000000",
        "adjustedAmount":1000000,
        "intervals":"3",
        "blockCount":"771",
        "txHash":"0xe2…96d7"
    }
}          

Resources

For any additional help, you can reach out on the bloXroute discord!

 

Read Next