Borrow against collateral
Borrow an asset from Aave using a Credit Account.
Bundles an optional swap, collateral supply, and borrow into a single atomic Safe transaction.
- If
token_inequalscollateral_token, the tokens are supplied directly as collateral. - If
token_indiffers fromcollateral_token, a swap is performed first via 1inch.
The Credit Account must already be created via /v2/credit/create_account and funded with token_in.
Documentation Index
Fetch the complete documentation index at: https://docs.compasslabs.ai/llms.txt
Use this file to discover all available pages before exploring further.
Body
The address that owns the Credit Account.
Blockchain network.
base, ethereum, arbitrum, hyperevm Asset to borrow from Aave.
"DAI"
"0x6b175474e89094c44da98b954eedeac495271d0f"
Amount to borrow (in token units, not wei).
x > 050
A token identifier - either a supported symbol (e.g., USDC, WETH) or a valid Ethereum address (0x...)
"USDC"
Amount of token_in to use (in token units, not wei). Omit together with token_in and collateral_token for borrow-only mode.
x > 0100
A token identifier - either a supported symbol (e.g., USDC, WETH) or a valid Ethereum address (0x...)
"WETH"
The interest rate mode for the borrow position.
stable, variable "variable"
Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%). Only used when a swap is needed.
0 <= x <= 1000.5
If true, returns EIP-712 signature data instead of an unsigned transaction.
Optional fee configuration. If provided, a fee will be deducted from the borrowed amount and sent to the specified recipient address.
The EOA owner's signature of the Permit2 PermitTransferFrom typed data. When provided, the borrow bundle will first pull token_in from the owner's EOA into the Credit Account via Permit2. Obtain by calling /v2/credit/transfer and signing the returned EIP-712 data.
The nonce used in the Permit2 signature (from the signed typed data).
x >= 0The deadline timestamp used in the Permit2 signature (from the signed typed data).
x >= 0Response
Successful Response
Unsigned transaction to execute the borrow bundle. Present when gas_sponsorship is false.
{
"chainId": "0x2105",
"data": "0x6a761202000000000000000000000000...",
"from": "0xc98949522db2eE403d6c75E91DDEe875a824bB10",
"gas": "0xb71b0",
"maxFeePerGas": "0x3b9aca00",
"maxPriorityFeePerGas": "0x5f5e100",
"nonce": "0x2b",
"to": "0xaB5801a7D398351b8bE11C439e05C5B3259aeC9B",
"value": "0x0"
}EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship is true.
{
"domain": {
"chainId": 8453,
"verifyingContract": "0x6B90E8B4E3E971E74C1A47a3a20976377E2dB4b1"
},
"message": {
"baseGas": "0",
"data": "0x8d80ff0a0000000000000000000000000000000000000000000000000000000000000020",
"gasPrice": "0",
"gasToken": "0x0000000000000000000000000000000000000000",
"nonce": "7",
"operation": 1,
"refundReceiver": "0x0000000000000000000000000000000000000000",
"safeTxGas": "0",
"to": "0x93C23AAE4793C14D6DF35D2A2A2234204e1559dA",
"value": "0"
},
"primaryType": "SafeTx",
"types": {
"EIP712Domain": [
{ "name": "chainId", "type": "uint256" },
{
"name": "verifyingContract",
"type": "address"
}
],
"SafeTx": [
{ "name": "to", "type": "address" },
{ "name": "value", "type": "uint256" },
{ "name": "data", "type": "bytes" },
{ "name": "operation", "type": "uint8" },
{ "name": "safeTxGas", "type": "uint256" },
{ "name": "baseGas", "type": "uint256" },
{ "name": "gasPrice", "type": "uint256" },
{ "name": "gasToken", "type": "address" },
{
"name": "refundReceiver",
"type": "address"
},
{ "name": "nonce", "type": "uint256" }
]
}
}Estimated amount of collateral token received from swap. Only present when token_in differs from collateral_token.
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$"99.8500000000"
The fee amount charged on the borrow, in borrow token units. Present when a fee was applied.
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$"0.1500000000"