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
  • A) Protocol-Specific Approach (Explicit)
  • B) Protocol-Agnostic Approach (Less Explicit)
  • Next Steps
  1. Tutorial Guides
  2. Yield

How to deposit

PreviousHow to check protocol infoNextHow to check open positions

Last updated 3 months ago

In this section, you'll learn how to request ready-to-use transaction data (bytecode) for depositing into a yield position.

Prerequisites

As in the section, you can choose either the explicit path or the protocol-agnostic (less explicit) path to get the transaction data.

A) Protocol-Specific Approach (Explicit)

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

  1. Request Transaction Data Fetch specific protocol information using:

    GET /strategies/:id/bytecode

    Required Parameters:

    Parameter
    Description
    Example

    action

    Type of operation

    deposit

    chainId

    Blockchain network ID

    137 (Polygon)

    protocol

    Protocol name

    aave

    amount

    Deposit amount

    1000000000000000000 (1 ETH with decimals)

    asset

    Asset to deposit

    ETH

    wallet

    Wallet that will be the owner of the position

    0x1234567890123456789012345678901234567890

    Example Request:

    GET /strategies/3341412233111/bytecode?action=deposit&chainId=137&protocol=aave&amount=1000000000000000000&asset=ETH&wallet=0x1234567890123456789012345678901234567890

    Response:

    {
     "bytecode": [
        {
            "to": "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
            "value": "1000000000000000000",
            "data": "0xe8eda9df0000000000000000000000003c499c542cef5e3811e1192ce70d8cc03d5c33590000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000"
        }
     ]
    }

Our API returns the transaction data as an object containing to, value, and data fields.

B) Protocol-Agnostic Approach (Less Explicit)

Let our system automatically select the optimal protocol for your needs.

  1. Use the Generic Endpoint

    GET /strategies/0x0/bytecode

    Use the same parameters as above, excluding protocol.

    Example Request:

    GET /strategies/0x0/bytecode?action=deposit&chainId=137&amount=1000000000000000000&asset=ETH&wallet=0x1234567890123456789012345678901234567890

    Response:

    {
     "bytecode": [
        {
            "to": "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
            "value": "1000000000000000000",
            "data": "0xe8eda9df0000000000000000000000003c499c542cef5e3811e1192ce70d8cc03d5c33590000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000"
        }
     ]
    }

Our API returns the transaction data as an object containing to, value, and data fields.

Next Steps

After getting the transaction data, you can:

How to Check Protocol Info
How to Get a Quote
Execute the Transaction
Open a New Position