bloXroute and Cron Finance united to bring traders TWAMM data streams

bloXroute Team
6 min readJul 28, 2023

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 at their disposal, 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 overtime 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 internal management of the swap is handled by the TWAMM pool. The key benefit is that users get a fixed price at the time of executing the order.

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 particularly useful for arbitrage and locking in profits from trades on TWAMM pools.

Account/Pool Management

These transactions involve actions such 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

The execution of long-term orders can cause the price of the embedded AMM to diverge from prices on other markets over time. When such divergence occurs, traders (searchers) must engage in trades against the embedded AMM’s price to realign it with the prevailing market prices. This process ensures that long-term orders are executed effectively.

The TWAMM bloXroute service

bloXroute offers a comprehensive TWAMM service that provides users with multiple new data streams, empowering them to identify and seize opportunities quickly. Further information about these streams is available below.

Sending TWAMM orders involves a fee payable to Cron Finance, as per their fee schedule.

Users of the bloXroute TWAMM service are eligible for a discounted fee (specifics provided below).

By utilizing the TWAMM bloXroute service, users gain access to crucial information, enabling informed decision-making while conducting swaps within TWAMM pools. Leveraging the BDN (Blockchain Distribution Network), this service stands as the fastest and most efficient source for relevant information from TWAMM pools.

TWAMM Data Streams Details

Virtual Pool Stream

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

Response Event

VirtualPool

Here’s a sample of a 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 consistently trends upwards every block due to the selling of wstETH into the pool for rETH.
  2. Updated reserve information and sales price for each token are available at every block.
  3. Arbitrage opportunities can be identified by comparing the sales price of this pool with other AMMs like 1inch, UniSwap, SushiSwap, PancakeSwap, etc.

Order Stream

The Order Stream endpoint provides targeted information concerning transactions currently in the mempool. This valuable data encompasses details about other wallets that have submitted long-term swaps and short-term swaps. By gaining insights into the trades happening within the mempool and understanding the specifics of these transactions, traders can gain a competitive advantage when submitting arbitrage orders in the subsequent block.

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"
}
}

Resource

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

--

--

bloXroute Team

Scaling blockchains to thousands of on-chain transactions per second. Today.