Looping Strategy

Automated Multi-Risk ERC-4626 Vaults with Ditto Execution Engine

https://docs.dittonetwork.io/overview/protocol-overview

Overview

Ditto Automation Labs is designing the first iteration of its automated vault system, standardized on ERC-7540 (asynchronous deposits and withdrawals), extending ERC-4626. This design ensures that deposits and withdrawals can be processed asynchronously, enabling smooth management of liquidity in complex looped strategies.

The vault will be controlled by a VaultOperator, set to the multisig safe of the Ditto Vaults Curator. This multisig issues a session via the Ditto Validator module, granting the right to trigger automations (activations, deactivations, rebalances) on the vault in a controlled, permissioned manner.

The product’s positioning remains the same: a hands-free yield automation platform with execution guarantees powered by Ditto’s decentralized operator network.

Core Development Items

PoC Spec

  1. Position Valuation

    • A smart contract to deliver the current value of the vault’s position on a lending borrowing protocol.

    • Alternatively, an automation that periodically refetches and updates values.

    • Especially relevant for cross-chain liquidity allocations, ensuring share accounting remains correct across deposits and withdrawals.

  2. Strategy Selector Script

    • A JavaScript service that fetches APYs from supported protocols.

    • Compares the profitability of different pool configurations.

    • Decides whether to rebalance, deactivate, or activate assets.

    • Loop logic: calculates the target loop number dynamically, subject to a minimum improvement threshold (e.g., skip looping if boost <0.2%).

  3. Router Smart Contract

    • Handles position winding and unwinding.

    • Uses lending pools, uni pools, slippage parameters, and target loop numbers.

    • More efficient than flashloans (0.05% cost of flashloan).

    • Can also unwind without flashloans, making exit safer and cheaper.

  4. Withdrawal Processor

    • Monitors the size of the withdrawal queue and unwinds the required amount marking them available to claim according to current position value and share-to-asset rate.

Oracle & Valuation

To ensure accurate vault accounting:

  • Ditto proposes using an on-chain lens oracle to track total position value at any moment.

  • This enables:

    • Fair deposit share issuance.

    • Precise share burns on withdrawals.

    • Transparent, tamper-proof vault valuation for all participants.

Guards & Security

Ditto introduces a dual-guard system to protect vaults and ensure execution integrity:

  • Off-chain guard

    • Consensus of top-tier operators validating automated actions.

    • Provides an extra layer of human and institutional oversight.

  • On-chain guard

    • Smart session permissions restrict what automations can execute.

    • Whitelisting of protocols ensures assets are only deployed into approved strategies.

Together, these guarantee security, accountability, and resilience.

User Journeys

1. Asset Managers / Curators

  • Use Ditto Execution Engine and ERC-4626 vaults as building blocks to design yield strategies.

  • Can set up new vaults or upgrade existing ones by configuring:

    • Number of loops / target LTV.

    • Strategy parameters (assets and protocols whitelisted).

  • Management is simplified through modular automation shortcuts for deposits, withdrawals, rebalances, and emergency exits.

2. End Users

  • Deposit into vaults.

  • Monitor balance, APY, liquidation thresholds, and vault activity through the dashboard.

  • Withdraw via the queue mechanism, with full transparency on status and timing.

Future Availability

Currently, Ditto offers custom private vaults built in collaboration with selected partners during the alpha phase.

After alpha:

  • The Ditto Validator Module and Ditto Automation Vault framework will be opened to curators and asset managers.

  • This will allow the wider community to deploy their own strategies on top of Ditto’s infrastructure.

  • Curators will leverage the same automation stack (activator, deactivator, rebalance, compounding, guards) with plug-and-play tools.

Math

Theory

Parameters:P0(initial principal)rs(supply APY)rb(borrow APY)(loan-to-value ratio)n(number of loops)Loop Dynamics:Sk=P0k1,(k=1,2,)Bk=P0kΠksup=rsSkCkbor=rbBkΠk=ΠksupCkbor=Sk(rsrb)Cumulative Profit:Π1:n=P0(rsrb)1n1Final APY:APYn=Π1:nP0=(rsrb)1n1“Finish (no borrow)” Variant:Π1:nfinish=P01[rs(1n+1)rb(1n)]APYnfinish=Π1:nfinishP0=rs(1n+1)rb(1n)1Theoretical Maximum:limnAPYn=limnAPYnfinish=rsrb1\begin{aligned}&\textbf{Parameters:} \\[4pt]&P_0 \quad \text{(initial principal)} \\ &r_s \quad \text{(supply APY)} \\ &r_b \quad \text{(borrow APY)} \\ &\ell \quad \text{(loan-to-value ratio)} \\ &n \quad \text{(number of loops)} \\[12pt] &\textbf{Loop Dynamics:} \\[4pt]&S_k = P_0 \cdot \ell^{\,k-1}, \quad (k=1,2,\dots) \\ &B_k = P_0 \cdot \ell^{\,k} \\ &\Pi^{\text{sup}}_k = r_s \cdot S_k \\ &C^{\text{bor}}_k = r_b \cdot B_k \\ &\Pi_k = \Pi^{\text{sup}}_k - C^{\text{bor}}_k = S_k \,(r_s - \ell r_b) \\[12pt] &\textbf{Cumulative Profit:} \\[4pt]&\Pi_{1:n} = P_0 \,(r_s - \ell r_b)\,\frac{1-\ell^n}{1-\ell} \\[12pt] &\textbf{Final APY:} \\[4pt]&\mathrm{APY}_n = \frac{\Pi_{1:n}}{P_0}= (r_s - \ell r_b)\,\frac{1-\ell^n}{1-\ell} \\[12pt] &\textbf{“Finish (no borrow)” Variant:} \\[4pt]&\Pi^{\text{finish}}_{1:n}= \frac{P_0}{1-\ell}\Big[r_s\,(1-\ell^{\,n+1}) - r_b\ell\,(1-\ell^n)\Big] \\[6pt]&\mathrm{APY}^{\text{finish}}_n= \frac{\Pi^{\text{finish}}_{1:n}}{P_0}= \frac{r_s(1-\ell^{\,n+1}) - r_b\ell(1-\ell^n)}{1-\ell} \\[12pt] &\textbf{Theoretical Maximum:} \\[4pt]&\lim_{n\to\infty} \mathrm{APY}_n= \lim_{n\to\infty} \mathrm{APY}^{\text{finish}}_n= \frac{r_s - \ell r_b}{1-\ell}\end{aligned}

Looping vs Flashloan:

  • Take deposit + flashloan = max looped supply

  • Borrow max loop borrow amount when boost < threshhold

  • Repay flashloan and lose 0.05% on Aave v3 so direct looping is recommended.

Total supply

Total Supply (as n):Stotal,=limnP01n1=P01 \textbf{Total Supply (as $n \to \infty$):} \\[6pt] S_{\text{total},\infty} = \lim_{n \to \infty} P_0 \,\frac{1-\ell^{\,n}}{1-\ell} = \frac{P_0}{1-\ell}

Total borrow

Total Borrow (as n):Btotal,=limnP0(1n)1=P01\textbf{Total Borrow (as $n \to \infty$):} \\[6pt] B_{\text{total},\infty} = \lim_{n \to \infty} P_0 \,\frac{\ell\,(1-\ell^{\,n})}{1-\ell} = \frac{P_0 \,\ell}{1-\ell}

Core Features

1. Automated Liquidity Activation

  • Deposits from users enter a liquidity queue.

  • Once the queue surpasses a defined threshold ($10,000), the Ditto Execution Engine automatically:

    • Activates the queued liquidity.

    • Allocates it into the respective strategy loops.

    • Updates the vault state with new locked amounts.

2. Withdrawal Queue

  • Users can initiate withdrawals through the vault portal.

  • Withdrawals are placed in a queue system.

  • Once the withdrawal threshold is reached, the Ditto Execution Engine executes asset deactivation, releasing the necessary liquidity.

  • Users see:

    • Their individual withdrawal request status.

    • The total withdrawal queue.

    • Estimated execution timeline.

3. Ditto Execution Engine Automations

The Ditto Execution Engine powers all operational aspects of the vaults:

  • Asset Activation: moving deposits into strategies once thresholds are hit.

  • Autocompounding: reinvesting strategy rewards to maximize APY.

  • Emergency Unlooping: exit strategy operation in case of critical events.

  • Asset Deactivation: processing withdrawal queues by freeing liquidity.

4. Transparent Manager Dashboard

The portal provides full visibility into vault activity, risk exposure, and user balances:

  • Current APY per vault.

  • Amount of funds locked in strategies.

  • Liquidation thresholds and their current status.

  • Latest rebalances and strategy operations.

  • Auto-compounds and activations history.

  • Latest withdrawals processed.

  • Real-time withdrawal status and queue insights.

User journey

  1. Deposit:

    • User selects a vault.

    • Deposit is added to liquidity queue.

    • User claims his shares.

  2. Activation:

    • When the queue threshold is reached, assets are looped into the chosen strategy.

  3. Growth:

    • Rewards are autocompounded by the Ditto Execution Engine.

    • Users track APY, activations, and portfolio performance through the portal.

  4. Withdrawal:

    • User requests withdrawal via the portal.

    • Request enters the withdrawal queue.

    • Once the threshold is reached, assets are deactivated and released.

    • User monitors live withdrawal progress until assets are received.

Value Proposition

  • Automated yield optimization without user intervention.

  • Flexible risk exposure through configurable vault strategies (risk parameter - target LTV).

  • Transparency-first design: all operations, queues, and thresholds are visible to users.

  • Secure withdrawal mechanism with clear expectations.

  • Failsafe management via emergency unlooping powered by the Ditto Execution Engine.

Last updated