Tenzro
Tutorial — DeFi

Build a yield router

A yield router scans staking, lending, and LP venues, scores them by net APR adjusted for risk, and moves capital to the winner — automatically, within a delegation scope you control.
Level
Advanced
Time
~45 min
Prerequisites
Funded wallets across chains
Stack
TypeScript
01

Enumerate venues

Aggregate from on-chain reads and any registered yield-data providers.

// Pull from your own yield-data source (DefiLlama, custom aggregator, on-chain reads).
const venues: Venue[] = await fetchVenues(["tenzro", "ethereum", "solana"]);
02

Apply risk filters

Drop venues that exceed your TVL, audit, or counterparty thresholds.

const eligible = venues.filter(v => v.tvl > 1e6 && v.riskScore < 0.4);
03

Pick the winner net of bridge cost

Compute net APR — APR minus expected bridge fees to reach the venue.

const ranked = eligible
  .map(v => ({ v, net: v.apr - bridgeFee(v.chain) }))
  .sort((a, b) => b.net - a.net);
04

Move capital

Route through the bridge adapter, then deposit on arrival.

const winner = ranked[0].v;
await client.bridge().bridgeTokens("tenzro", winner.chain, "USDC", amount, winner.depositAddress, "layerzero");
// Venue-specific deposit call lives on the destination chain's contract — issue via your wallet client there.
Related
← All tutorials