How to repay a loan

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

Last updated