Skip to main content
POST
/
v1
/
transaction_bundler
/
aave
/
loop
Python (SDK)
from compass_api_sdk import CompassAPI, models


with CompassAPI(
    api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:

    res = compass_api.transaction_bundler.transaction_bundler_aave_loop(chain=models.AaveLoopRequestChain.BASE, sender="0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B", collateral_token="USDC", borrow_token="WETH", initial_collateral_amount="1000", multiplier="2.5", max_slippage_percent=2.5, loan_to_value=20.5, estimate_gas=True, signed_authorization={
        "nonce": 1000,
        "address": "0xcA11bde05977b3631167028862bE2a173976CA11",
        "chain_id": 42161,
        "r": "0x5f9f3f3226ac91bc01a72dd117141f6c6de1ed30d3af9f95c3423316dc21d615",
        "s": "0x78f7982ede9dabc53d7153974c5692fda8a21fc73bdafc42aaf135505e22817c",
        "y_parity": 0,
    }, is_account_abstraction=True)

    # Handle response
    print(res)
{
  "transaction": {
    "chainId": "<string>",
    "data": "<string>",
    "from": "<string>",
    "gas": "<string>",
    "to": "<string>",
    "value": "<string>",
    "nonce": "<string>",
    "maxFeePerGas": "<string>",
    "maxPriorityFeePerGas": "<string>",
    "authorizationList": []
  }
}

Authorizations

x-api-key
string
header
required

Your Compass API Key. Get your key here.

Body

application/json

Request model for executing an Aave loop strategy.

chain
enum<string>
required
Available options:
arbitrum,
base,
ethereum
sender
string
required

The address of the transaction sender.

Examples:

"0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B"

collateral_token
string
required

Symbol or address of token to supply to Aave..

Examples:

"USDC"

"WETH"

borrow_token
string
required

Symbol or address of token to borrow from Aave..

Examples:

"WETH"

"USDC"

initial_collateral_amount
required

Amount of collateral token to supply to Aave

Required range: x > 0
Examples:

"1000"

"1000000"

multiplier
required

Leverage multiplier. Total loop collateral will be calculated as multiplier x initial_collateral_amount

Required range: x > 1
Examples:

"2.5"

"3.8"

"4.1"

max_slippage_percent
required

Maximum allowed slippage for token swaps in percentage

Required range: 0 < x <= 100
Examples:

2.5

0.5

10

loan_to_value
required

Loan To Value percentage of the loop

Required range: 0 < x <= 100
Examples:

20.5

50.6

70

estimate_gas
boolean
default:true

Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.

signed_authorization
object | null

EIP-7702 authorization. Required when is_account_abstraction is False.

Examples:
{
"address": "0xcA11bde05977b3631167028862bE2a173976CA11",
"chainId": 42161,
"nonce": 1000,
"r": "0x5f9f3f3226ac91bc01a72dd117141f6c6de1ed30d3af9f95c3423316dc21d615",
"s": "0x78f7982ede9dabc53d7153974c5692fda8a21fc73bdafc42aaf135505e22817c",
"yParity": 0
}
is_account_abstraction
boolean
default:false

Whether to use account abstraction for the transaction.

Examples:

true

false

Response

Successful Response

  • BundlerTransactionResponse
  • BatchedUserOperationsResponse
transaction
object
required

The unsigned multicall transaction data. User must sign and broadcast to network.