Deframe
  • 🏠Getting Started
  • 🏗️Architecture Overview
  • Tutorial Guides
    • Loans
      • How to quote for a new loan
      • How to execute a new loan
      • How to get current position of a loan
      • How to repay a loan
    • Yield
      • How to check protocol info
      • How to deposit
      • How to check open positions
      • How to withdraw
    • Swaps
      • EVM
        • How to execute a swap
        • How to get a quote
      • Solana
        • How to execute a swap
        • How to get a quote
  • ⚙️API
    • GET /strategies
    • GET /strategies/:id
    • GET /strategies/:id/bytecode
    • GET /wallets/:address
  • 🔒Protocols
  • 🗳️Widget Integration
Powered by GitBook
On this page
  • Overview
  • Common Flow Patterns
  • 1. Protocol Data
  • 2. Transaction Data
  • 3. Sign & Propagate Bytecode
  • 4. Position Monitoring
  • 5. Alerts & Notifications
  • 6. Integration Features
  • Rate Limiting
  • Error Handling
  • Summary

Architecture Overview

PreviousGetting StartedNextTutorial Guides

Last updated 3 months ago

Overview

This document provides a structured explanation of the API flow for interacting with the Deframe service. The flow consists of several stages, each responsible for specific actions across loans, swaps, and yield products.

Common Flow Patterns

1. Protocol Data

Description

Retrieve quotes and protocol information using the API.

Endpoints

GET /strategies/:id
GET /strategies

Purpose

  • Fetch available protocols and their current rates

  • Get quotes for loans, swaps, or yield positions

  • Compare rates across different protocols

2. Transaction Data

Description

Request transaction data (bytecode) needed for execution.

Endpoint

GET /strategies/:id/bytecode

Purpose

  • Provides the bytecode for executing transactions

  • Supports multiple transaction types:

    • Loans (borrow/repay)

    • Swaps

    • Yield positions (deposit/withdraw)

3. Sign & Propagate Bytecode

Description

  • Transaction signature and propagation are handled entirely on your side

  • Deframe does not hold, manage, or pass any funds through its smart contracts

Responsibilities

  • Users sign transactions themselves

  • Transaction propagation is handled by the user

  • Full custody remains with the user

4. Position Monitoring

Description

After transaction execution, Deframe monitors positions and provides updates.

Endpoints

GET /wallets/:address          # General position info
GET /wallets/:address/yield    # Yield positions

Purpose

  • Track wallet activity and positions

  • Monitor health factors for loans

  • Track yield earnings

  • View swap history

5. Alerts & Notifications

Description

Configure alerts for position monitoring.

Features

  • Webhook notifications

  • Push notifications

  • Email alerts

  • Liquidation warnings for loans

  • APY change notifications for yield positions

6. Integration Features

Description

Additional features to enhance user protection and experience.

Available Features

  • Integration with DeFiSaver for loan protection

  • Optional liquidation protection

  • Auto-compounding for yield positions

  • Best-rate routing for swaps

Rate Limiting

  • 100 requests per minute per IP address

  • 1000 requests per hour per API key

Error Handling

The API uses standard HTTP response codes:

  • 200: Success

  • 400: Bad Request

  • 401: Unauthorized

  • 429: Too Many Requests

  • 500: Internal Server Error

Summary

This architecture ensures:

  • Trustless operations with no fund custody

  • Comprehensive position monitoring

  • Real-time alerts and notifications

  • Integration with protection mechanisms

  • Support for multiple DeFi products (loans, swaps, yield)


For detailed implementation guides, see:

  • Swap Tutorials

🏗️
Loan Tutorials
Yield Tutorials
System flow and architecture