Skip to main content

Splitting

Zyfai agents optimize asset allocation efficiently across the yield and risk dimensions by allocating funds proportionally across multiple liquidity pools based on whale weight and pool capacity constraints.

Each agent runs a multi-scenario optimization that scores all active markets by expected yield, liquidity depth, and stability metrics, then reallocates based on weighted average returns or other customized functions across validated pools.

1. Weight Calculation

For portfolios in the same tier, each wallet receives a proportional share of pool capacity:

Weight = wallet_balance / total_tier_balance

Variables:

  • wallet_balance: Total portfolio value for this wallet.
  • total_tier_balance: Sum of all wallet balances in the same tier.
  • Default: Weight defaults to 1.0 if tier balance is unavailable.

This ensures fair allocation: larger wallets get proportionally larger shares without monopolizing pools.

2. APY Simulation with TVL Impact

Raw APY doesn't account for how a deposit affects pool returns. The agent simulates the post-deposit APY by accounting for the proper Interest Rate Model (IRM) of the pool.

Yield Dilution

This process captures yield dilution: large deposits into smaller pools reduce the effective APY.

3. Risk Constraint Validation

Each candidate pool must pass a multi-factor validation gate $V(p)$:

V(p) = ⋀j Rj(p)

Where each $Rj$ is a binary risk check, accounting for:

  • Pool exposure
  • APY and TVL stability
  • Liquidity depth
  • Protocol security

A pool is valid for scenario $k$ only if:

V(p, k) = true ∧ Δi > 0

4. Greedy Allocation Logic

Pools are sorted by simulated APY (highest first). The algorithm allocates greedily:

For each pool (sorted by APY):
allocAmount = min(remaining_balance, fairShare)

If passes validation:
allocate allocAmount to pool
remaining_balance = remaining_balance - allocAmount

Any remaining balance is added to the highest APY pool if capacity allows.

5. Rebalance Threshold

Before executing, the agent verifies sufficient improvement to justify gas costs:

Āk* - Āold ≥ ε

Parameters:

  • Āold: Current portfolio weighted average APY.
  • ε: Minimum improvement threshold (default: 0.1%).

This prevents churn from marginal gains that don't justify transaction fees.

6. Multi-Whale Fairness

Fair share prevents pool monopolization.

Example: $500k Tier

Example with 2 whales in a $500k tier:

  • Whale A ($150k): 30% weight → gets 30% of each pool's capacity.
  • Whale B ($350k): 70% weight → gets 70% of each pool's capacity.

Pool with $100k capacity:

  • Whale A: $30k max.
  • Whale B: $70k max.

This ensures proportional access while respecting pool safety limits.