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
  • Prerequisites
  • How to Repay a Loan
  • Next Steps
  1. Tutorial Guides
  2. Loans

How to repay a loan

PreviousHow to get current position of a loanNextYield

Last updated 3 months ago

In this section, you'll learn how to request ready-to-use transaction data (bytecode) for repaying a loan.

Prerequisites

How to Repay a Loan

Use this when you want to work with a specific lending protocol.

  1. Request Transaction Data Fetch specific protocol information using:

    GET /strategies/:id/bytecode

    Required Parameters:

    Parameter
    Description
    Example

    action

    Type of operation

    repay

    chainId

    Blockchain network ID

    137 (Polygon)

    protocol

    Protocol name

    aave

    amount

    Repay amount

    10000000 (with decimals)

    asset

    Asset to repay

    USDC

    loanId

    ID of the loan

    123456

    Example Request:

    GET /strategies/3341412233111/bytecode?action=repay&chainId=137&protocol=aave&amount=10000000&asset=USDC&loanId=123456

    Response:

    {
     "bytecode": [
        {
            "to": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
            "value": "0",
            "data": "0xa9059cbb0000000000000000000000005900efdd79bc1541cf1f9fd0f56c0a869194430300000000000000000000000000000000000000000000000000000000000003e8"
        },
        {
            "to": "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
            "value": "0",
            "data": "0x573ade81000000000000000000000000000000000000000000000000000000000000000"
        }
     ]
    }

Our API returns the transaction data as an array of objects. Each object contains to, value, and data fields.

Next Steps

How to Get Current Position of a Loan
How to Execute a New Loan
How to Get Current Position of a Loan
How to Quote for a New Loan