Lending & borrowing

Lend & borrow across multiple chains.

Overview

Lending

Supply assets to lending pools & earn interest on your deposits.

Borrowing

Borrow assets using supplied collateral with competitive interest rates.

Health Factor

Monitor your borrowing position health factor to avoid liquidation.

Supported Markets

Ethereum Mainnet
Base
Arbitrum
Polygon
Optimism

Integration

lending-integration.ts
import { 
  supply, 
  withdraw,
  borrow,
  repay,
  getLendingPosition 
} from '@/lib/torque'

// Supply assets
const supplyTx = await supply({
  asset: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
  amount: '1000000000', // 1000 USDC
  chainId: 1,
  userAddress: userAddress,
})

// Borrow assets
const borrowTx = await borrow({
  asset: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
  amount: '500000000', // 500 USDC
  interestRateMode: 'VARIABLE',
  chainId: 1,
  userAddress: userAddress,
})

// Check position
const position = await getLendingPosition({
  userAddress,
  chainId: 1,
})

console.log('Supplied:', position.supplied)
console.log('Borrowed:', position.borrowed)
console.log('Health Factor:', position.healthFactor)
Was this helpful?