Skip to main content

Yield Lifecycle

Every yield operation follows the same pattern: prepare, sign, execute, track.

1. Prepare

Call yield_prepare with an operation and your agent address. Rhaios returns strategy data plus setup/execution payloads.
{
  "operation": "deposit",
  "asset": "USDC",
  "amount": "1000",
  "agentAddress": "0x...",
  "strategy": "balanced"
}
The response includes intentId, needsSetup, and strategy metadata. If setup is needed, a setup block is returned (intentEnvelope: null); otherwise an execution block with intentEnvelope is returned.

2. Sign

If intentEnvelope is present, your agent signs intentEnvelope.signing with its own key (EIP-712).
If needsSetup=true, execute the returned setup type-4 transaction first, then call yield_prepare again to get an executable intentEnvelope.

3. Execute

Pass the signed envelope to yield_execute.
{
  "intentEnvelope": {
    "version": "1",
    "chainId": 8453,
    "userOps": [{ "userOperation": { "sender": "0x...", "nonce": "0x1", "callData": "0x...", "signature": "0x..." } }],
    "destinationExecutions": [],
    "expiry": 1739932000,
    "validAfter": 1739931100,
    "merkleRoot": "0x...",
    "proofs": [[]]
  },
  "intentSignature": "0x...",
  "intentId": "0x<same-as-merkleRoot>"
}
Rhaios validates and submits through the bundler path. intentId is optional and must match intentEnvelope.merkleRoot when present. The intent signer must match intentEnvelope.userOps[0].userOperation.sender.

4. Track

Call yield_status to monitor your positions.
{ "userAddress": "0x..." }
Returns all active positions with current value, unrealized yield, and APY. Use yield_history to see historical APY data for any vault.

5. Withdraw

When ready to exit, call yield_prepare with operation: "redeem" to prepare withdrawal calldata.
{
  "operation": "redeem",
  "vaultId": "42",
  "percentage": 100,
  "agentAddress": "0x..."
}
Then sign and pass the result to yield_execute — same flow as depositing. You can also rebalance between vaults using operation: "rebalance", which atomically redeems from one vault and deposits into a better one.