← docs

Lending execution

Generate unsigned transaction calldata for supply, borrow, withdraw, and repay on Aave v3 and Spark. Syenite returns the raw transactionRequest plus ERC-20 approval transactions where needed. The agent or user signs and submits.

supported protocols and chains

ProtocolChains
Aave v3Ethereum, Arbitrum, Base
SparkEthereum

the four tools

lending.supply

Deposit an asset into the lending pool. The response includes the pool transaction and the ERC-20 approve transaction (submit the approval first, then the supply).

{
  "protocol": "aave-v3",
  "chain": "ethereum",
  "asset": "USDC",
  "amount": "1000",
  "onBehalfOf": "0xYourAddress"
}

lending.borrow

Borrow against deposited collateral. Variable rate only (stable rate is deprecated in Aave v3). No approval needed for borrow.

{
  "protocol": "aave-v3",
  "chain": "arbitrum",
  "asset": "USDC",
  "amount": "500",
  "onBehalfOf": "0xYourAddress"
}

lending.withdraw

Withdraw a supplied asset. Set amount to "max" to withdraw everything. Check lending.position.monitor first to confirm safe withdrawal margins.

{
  "protocol": "aave-v3",
  "chain": "base",
  "asset": "USDC",
  "amount": "max",
  "to": "0xYourAddress"
}

lending.repay

Repay outstanding debt. Set amount to "max" to repay all debt (uses uint256.max). Includes the ERC-20 approval transaction.

{
  "protocol": "aave-v3",
  "chain": "ethereum",
  "asset": "USDC",
  "amount": "max",
  "onBehalfOf": "0xYourAddress"
}

full execution loop

The recommended agent workflow for a lending position:

  1. find.strategy or lending.rates.query to identify the best market
  2. lending.risk.assess to evaluate the position before committing
  3. lending.supply to deposit collateral (submit approval tx first, then supply tx)
  4. tx.receipt to confirm the supply transaction landed
  5. lending.borrow to draw down the loan
  6. tx.receipt again to confirm the borrow
  7. lending.position.monitor to verify health factor and LTV
  8. alerts.watch with optional webhookUrl for ongoing monitoring
Every transactionRequest can be passed through tx.verify, tx.simulate, and tx.guard before signing. The trust layer works on lending transactions the same way it works on swap and bridge transactions.

response shape

All four tools return the same structure:

related