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


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
- The sales price of token0 goes up consistently every block due to the swapping of wstETH for rETH in the pool.
- Every block provides updated reserve information and sales price for each token.
- 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
- How to connect to streams and submit arbitrage transactions https://docs.bloxroute.com/streams/twamm-streams
- About Cron Finance TWAMM
https://www.paradigm.xyz/2021/07/twamm - Example of a TWMM pool For actually submitting the swap, you need to construct a “short-term swap” write call on the balancer contract (https://etherscan.io/address/0xBA12222222228d8Ba445958a75a0704d566BF2C8). We have some code samples below that can help you do this.
- Golang: https://github.com/bloXroute-Labs/eth-trader-api/blob/develop/cmd/scripts/twamm_generator_mainnet/main.go
- Python: https://github.com/bloXroute-Labs/twamm-trader-bot/blob/develop/src/bloxroute_dex.py#L388
- The partner address that is bloXroute’s partner address is: 0xa3bf741ea039C1A6Da55CE91958fceF2bBC1930d
- The Arbitrage Partner Contract can be found here. https://etherscan.io/address/0x01Ce5b536e6629F3ABC664f7EF530108BcBb6A9B. This contract controls who can be added to a “partner” list, but for all intents and purposes, you should use the bloXroute partner address above for the lower fee tier.
For any additional help, you can reach out on the bloXroute discord!
Author
bloXroute Labs is a leading blockchain software company. The 5-year-old Chicago-based tech startup is on a mission to bring transactions and data transmission on blockchain to the next level. bloXroute's proprietary blockchain distribution network (BDN) with hyper-connectivity on Ethereum, BNB Chain, Polygon, and Solana enables ultra-low-latency DeFi with unmatched speed and performance to actors in DeFi and MEV ecosystems.
Over 350 DeFi trading firms connect their trading infrastructure to bloXroute's BDN to get the fastest mempool data in the industry for more trade opportunities and substantially increase their chance of winning trades with a high inclusion rate and the most competitive transaction propagation speed.
Read Next
- bloXroute Partners with DLN to Open New Opportunities for Cross-Chain DeFi TradersNov 16, 2023Cross ChainDeFiPartnership
- DLN has established a strategic partnership with bloXroute, a DeFi trading service provider.Oct 16, 2023In The Media
- Ethereum Is Becoming More Concentrated After a Key Infrastructure Provider Dropped OutSep 30, 2023In The Media
- Ethereum decentralization takes hit as Blocknative discontinues its relayerSep 27, 2023In The Media
- SUPERHIGHWAY TRADING: The Fastest Blockchain Distribution Network | Uri KlarmanSep 13, 2023In The Media
- Future of the RPC Landscape by LlamaNodesSep 6, 2023DeFi DoJo
- BundlesAug 30, 2023DeFi DoJo
- Internal TXsAug 30, 2023DeFi DoJo
- Mempool dataAug 30, 2023DeFi DoJo
- PancakeSwap Joins Forces with bloXroute to Safeguard Users from MEV Bots on Ethereum BlockchainAug 9, 2023In The Media
- PancakeSwap and bloXroute Announce User Front-running Protection PartnershipAug 7, 2023Partnerships
- bloXroute Teams up with Kudasai to Enter the Japanese MarketJul 5, 2023Partnerships
- Unlocking MEV for BSC — Launching Bundle Submission on Binance Smart ChainJun 7, 2023Product
- Even-Faster Mempool Data with MEVlink AcquisitionMay 25, 2023Product
- bloXroute launches Internal TXs Mempool stream on BSCMay 9, 2023Product
- Blockdaemon integrates bloXroute's BDN Enhancing Blockchain PerformanceApr 3, 2023Partnerships
- Last Ethereum Block Before Merge Minted $47K NFTSep 15, 2022In The Media
- SoftBank leads $70 million round for DeFi infrastructure firm BloXrouteApr 12, 2022In The Media
- DeFi Firm BloXroute Raises $70M to Fund Expansion in SoftBank-Led RoundApr 12, 2022In The Media