GET /strategies/:id/bytecode
🔹 Get Strategy Bytecode
🌐 Endpoint
GET https://client.deframe.io/v1/strategies/:id/bytecode
📝 Overview
Retrieve ready-to-use transaction data (bytecode) for executing operations like loans, swaps, or yield positions with a specific strategy.
🔑 Authentication
This API requires authentication using an API key. Include your API key in the request headers:
📋 Path Parameters
id
string
Unique identifier for strategy
Aave-USDT-polygon
📋 Query Parameters
action
string
Yes
Type of operation to execute
borrow
, repay
, deposit
, withdraw
chainId
string
Yes
Network chain ID
137
(Polygon)
amount
string
Yes
Amount with decimals
1000000000000000000
(1 ETH)
asset
string
Yes
Asset symbol
ETH
, USDC
collateralAsset
string
For loans
Collateral asset symbol (for loans)
ETH
collateralAmount
string
For loans
Collateral amount with decimals (for loans)
900000000000000000000000
slippage
number
For swaps
Maximum price slippage percentage (for swaps)
0.5
deadline
number
For swaps
Transaction deadline in seconds (for swaps)
1800
📦 Response
Returns a JSON object containing:
bytecode
: Array of transaction objects with the following properties:to
: Target contract addressvalue
: Amount of native tokens to send (in wei)data
: Transaction bytecode
Example Response for Loan:
Example Response for Swap:
❌ Error Responses
400
Bad Request - Invalid parameters
401
Unauthorized - Invalid or missing API key
404
Strategy not found
429
Too many requests - Rate limit exceeded
500
Internal server error
Example Error Response:
📝 Notes
The bytecode response may contain one or more transactions that need to be executed in sequence
All amounts should include the appropriate number of decimals for the asset
For loans, both collateralAsset and collateralAmount are required
For swaps, slippage and deadline parameters are recommended to prevent unfavorable executions
Last updated