# Treasury Diversification: Swap 400 wstETH -> rETH via TWAMM

## tldr;
Help execute treasury diversification of the [Nouns DAO treasury](https://etherscan.io/address/0x0BC3807Ec262cB779b38D65b38158acC3bfedE10), specifically `wstETH => rETH`. We have built a tool that’s tailor-made to help execute these trades: *TWAMM.* The trade will be executed completely on-chain, transparently with very low fees and minimal gas costs.

## **Background**
TWAMM is a concept introduced by [Paradigm](https://www.paradigm.xyz/2021/07/twamm) in July 2021. *"It works by breaking long-term orders into infinitely many infinitely small pieces and executing them against an embedded constant-product AMM smoothly over time."*

An on-chain AMM protocol to enable large token swap is essential to increase DeFi adoption and anti-fragility. Some interesting use cases for TWAMMs include [treasury diversification](https://twitter.com/HelloShreyas/status/1502177286170185735)*,* [whale liquidations](https://twitter.com/solendprotocol/status/1538553654575214592)*,* [peg maintenance](https://www.notion.so/fd88cb37208d4b0f9abaca4e276f9ddd)*, etc*.

## **Product Design & Incentives**
We have been researching and developing TWAMMs since November 2021 and recently launched our protocol: [announcement](https://twitter.com/cronfinance/status/1645802789006876672). The code has been audited by SpearbitDAO, open-sourced, and verified on Etherscan. There’s more detail on the protocol on our [docs page](https://docs.cronfi.com/twamm/).
- AMM: we built our TWAMM as a custom pool on top of Balancer V2 Vaults given the *security, liquidity, flexibility, and gas advantages* of leveraging Balancer. Additionally, Balancer has become a Schelling point for protocols that want to leverage their AMM, thus creating network effects & composability advantages.
- Traders: as a long-term trader (Nouns DAO), you only have to pay gas for starting, canceling, or withdrawing proceeds from your order. All the other sub-orders of the DCA are done virtually and cost the Nouns DAO no gas fees. Virtual orders are only written on-chain when the next user interacts with the protocol (generally an arbitrageur).
- Arbitrageurs: as seen on other AMMs like Uniswap, arbitrageurs are important to keep the price of the assets in line with external venues. Arbitrageurs are critical for TWAMMs because trade sizes are significantly larger and last for multiple blocks. Therefore we partnered with dedicated arbitrageurs (BloXRoute) to ensure pools are frequently arbitraged thus giving you a smooth fill.
- Liquidity: Balancer already has over ***$131M*** in wstETH and ***$62M*** in rETH in the vault. We have successfully received a [liquidity + gauge](https://forum.balancer.fi/t/bip-265-enable-wsteth-reth-gauge-ethereum/4643) to direct some of the liquidity to our TWAMM pool to provide the resting liquidity needed to execute this trade. TWAMMs are extremely capital efficient given that the trades are split across multiple blocks and arbitrageurs consistently bring new liquidity back to the system to correct price deviations.

## **Advantages**
- Low fees: wstETH/rETH is a stable pair and long-term swappers pay a one-time **0.03% fee.**
- Fully on-chain: zero dependencies on off-chain services, oracles, compute etc.
- Flexible: issue, change, and cancel orders with ease.
    - Example new order: `sell 14_000 wstETH for rETH in 100_000 blocks` ~roughly 2 weeks
    - Easy to use Gnosis Safe custom transaction UX
- Full control of orders and assets: non-custodial, cancellable, and withdraw proceeds at any time.
- Withdraw multiple times: users can withdraw once at the end, or every set number of blocks – they just pay gas fees.
- DCA over 1000’s of blocks gas-free: Nouns DAO would only pay gas for starting and ending orders, and arbitrageurs pay for placing suborders on-chain.
- Analytics: we will have an analytics dashboard that shows how the order is being filled so the DAO can monitor the trade.

## **Risks & Mitigations**
The first trade will be for a relatively *small* amount of roughly 400 wstETH -> rETH to ensure TWAMM executes the trade as expected. Below are a few potential risks of the system and how we have and plan to mitigate them:
- Smart contract:
    - Fully audited: see SpearbitDAO report [here](https://github.com/spearbit/portfolio/blob/master/pdfs/CronFinance-Spearbit-Security-Review.pdf).
    - Hack Risks: built on Balancer V2 Vaults which have been battle-tested for 2+ years.
    - Bricked Pools: we’ve done extensive research and mitigations for gas, order DDoS, numerical underflows, incorrect TWAMM parameters etc – more info here: [0slippage](https://mirror.xyz/0slippage.eth).
    - Loss of Funds: open-source code, audited, verified, non-custodial, users in full control of funds, trade happens over multiple blocks so it can be canceled at any time by the user.
    - Malicious Pool Admin: all pool administrators can do is pause the pool or change fees at which point Nouns DAO can cancel and withdraw their funds.
- Lack of Arbitrage: we have teamed up with BloXroute to provide dedicated arbitrage service. On the off chance neither service arbitrages the pool, the open market will arbitrage the pool.
- Poor Execution: orders are cancellable at any time i.e if the price escapes preferred bounds restart the order at another time. Also, DCA is generally a better strategy than spot purchase for large orders.
  - Monitoring: we will be actively monitoring the trade as the `delegate` to ensure the order is being filled at an optimal price. In case the trade escapes the optimal threshold, we will cancel the trade on behalf of the DAO and proceeds will be refunded to the Nouns DAO wallet.
- Information Leakage: this is not a big concern for a stable pair like wstETH/rETH which are like assets and have deep liquidity pools.
- MEV/Sandwich Attacks: orders are broken into small pieces and thus the benefit of front/back running orders is minimal – see the Paradigm paper for further details.

## **Competition**

Here are the alternatives and how they stack up against TWAMM. Note this isn’t a comprehensive list, but a short summary.

- Gnosis Auction:
    - Pros: well-tested technology
    - Cons: reliant on well-funded keepers, minimum buy lots, price upside capped, infrastructure overhead, limited timeframe, poor execution vs DCA over long periods.
- Manual DCA:
    - Pros: can execute it today
    - Cons: need to write a smart contract or fat finger mistakes, fees for each sub-order, gas costs of sub-orders, limited # of sub-orders
- DEX/Aggregators:
    - Pros: complete trade in a single block
    - Cons: slippage, MEV attack vectors
- OTC:
    - Pros: limit orders and other novel trade execution algorithms
    - Cons: off-chain, opaque, high fees, custodial, KYC, regulations, etc

Outcome: CANCELLED