# Aave V2

### Supported Chains

Available on **Ethereum , Avalanche and Polygon.**

### Available Endpoints:

*Click on the endpoint to jump to the section with full details*

* [**/**](#getprice)[<mark style="color:blue;">**getpool**</mark><mark style="color:blue;">`GET`</mark>](#getpool) - Get the lend and borrow APY for the given pool from AAVE protocol.
* [<mark style="color:blue;">**/**</mark>](#getuserliquidity)[<mark style="color:blue;">**getpools**</mark>](#getpools) <mark style="color:blue;">`GET`</mark> - Get the list of supply and borrow APYs of the mentioned assets.&#x20;
* <mark style="color:blue;">**/**</mark>[<mark style="color:blue;">**getuseraccountdata**</mark>](#getuseraccountdata) <mark style="color:blue;">`GET`</mark> - Get the repay, borrow, withdraw amount and health factor details for the given user.
* [<mark style="color:blue;">**/getuserpositions**</mark>](#getuserpositions) <mark style="color:blue;">`GET`</mark> - Retrieves the lending and borrowing positions of a user, including details such as token balances and collateral usage status.
* [<mark style="color:blue;">**/borrow**</mark>](#borrow) <mark style="color:green;">`POST`</mark> - Trigger the borrow transaction from the given protocol.
* [**/**<mark style="color:blue;">**d**</mark>](#addliquidity)[<mark style="color:blue;">**eposit**</mark>](#deposit) <mark style="color:green;">`POST`</mark> - Trigger the deposit transaction from the given protocol.
* [<mark style="color:blue;">**/r**</mark>](#removeliquidity)[<mark style="color:blue;">**epay**</mark>](#repay)<mark style="color:green;">`POST`</mark> - Trigger the repay transaction from the given protocol.
* [<mark style="color:blue;">**/**</mark>](#removeliquidity)[<mark style="color:blue;">**withdraw**</mark>](#withdraw)<mark style="color:green;">`POST`</mark> - Trigger the withdraw transaction from the given protocol.

### Lending Protocol IDs

Many endpoints have a parameter where you can provide a lendborrow ID.&#x20;

Below is a list of lendborrow IDs related to Aave V2. Please see the [lendborrowID](/ids/lending-protocol-ids.md) for a complete Lending Protocol ID list and more information.

| Lending Protocol Name | Chain     | Lending Protocol ID |
| --------------------- | --------- | ------------------- |
| Aave V2               | Ethereum  | 1000                |
| Aave V2               | Avalanche | 1003                |
| Aave V2               | Polygon   | 1005                |

## Endpoint Details

### /getpool

#### Get the lend and borrow APY for the given pool from AAVE protocol.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/lendborrow/getpool`

#### Query Parameters

| Name                                    | Type   | Description                                                                |
| --------------------------------------- | ------ | -------------------------------------------------------------------------- |
| rpc                                     | String | Remote procedural call URL.                                                |
| lendborrowId                            | String | Refer to the [Lend and Borrow ID](#lending-protocol-ids) page for details. |
| asset<mark style="color:red;">\*</mark> | String | Token address to get the details of.                                       |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/lendborrow/getpool?lendborrowId=1000&asset=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "tokenAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
        "variableBorrowRate": "2.46",
        "stableBorrowRate": "4.54",
        "variableSupplyRate": "0",
        "stableSupplyRate": "0.38",
        "ltv": "82.5",
        "availableLiquidity": "113254567932739787526717",
        "reserveSize": "163635814986025319212051"
    }
}
```

{% endtab %}
{% endtabs %}

[back to top](#endpoints-available)

### /getpools

#### Get the list of supplies and borrow APYs from the AAVE V2 protocol.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/lendborrow/getpools`

#### Query Parameters

| Name         | Type   | Description                                                                                      |
| ------------ | ------ | ------------------------------------------------------------------------------------------------ |
| lendborrowId | String | Refer to the [lend borrow Id](/ids/lending-protocol-ids.md) page for details.                    |
| assets       | String | <p>Comma-separated token address.<br>If not provided, it will fetch all the supported assets</p> |
| address      | String | User wallet address                                                                              |

{% tabs %}
{% tab title="Sample Request" %}

```
https://api.expand.network/lendborrow/getpools?lendborrowId=1000
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "LUSD": {
            "tokenAddress": "0x5f98805a4e8be255a32880fdec7f6728c6568ba0",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "32.12",
            "stableBorrowRate": "17.29",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "0",
            "availableLiquidity": "77006726623077655725248",
            "reserveSize": "103632381824927576871858",
            "tokenSymbol": "LUSD"
        },
        "MKR": {
            "tokenAddress": "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "20.00",
            "stableBorrowRate": "3.02",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "0",
            "availableLiquidity": "1278729306125753953202",
            "reserveSize": "1279822124508185051839",
            "tokenSymbol": "MKR"
        },
        "GUSD": {
            "tokenAddress": "0x056fd409e1d7a124bd7017459dfea2f387b6d5cd",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "83.39",
            "stableBorrowRate": "40.69",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "0",
            "availableLiquidity": "32623758",
            "reserveSize": "61125095",
            "tokenSymbol": "GUSD"
        },
        "LINK": {
            "tokenAddress": "0x514910771af9ca656af840dff83e8264ecf986ca",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "0.68",
            "stableBorrowRate": "3.97",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "0",
            "availableLiquidity": "1193700896741468562426997",
            "reserveSize": "1248472656103005124023274",
            "tokenSymbol": "LINK"
        },
        "FRAX": {
            "tokenAddress": "0x853d955acef822db058eb8505911ed77f175b99e",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "12.61",
            "stableBorrowRate": "0.00",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "0",
            "availableLiquidity": "511987804049522861930697",
            "reserveSize": "587777132902145320152786",
            "tokenSymbol": "FRAX"
        },
        "1INCH": {
            "tokenAddress": "0x111111111117dc0aa78b770fa6a738034120c302",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "20.00",
            "stableBorrowRate": "0.00",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "0",
            "availableLiquidity": "55357019076770918062629",
            "reserveSize": "56496898095330410902989",
            "tokenSymbol": "1INCH"
        },
        "BUSD": {
            "tokenAddress": "0x4fabb145d64652a948d72533023f6e7a623c7c53",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "10.00",
            "stableBorrowRate": "150.02",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "0",
            "availableLiquidity": "575265740349124045010809",
            "reserveSize": "792752563426923457825588",
            "tokenSymbol": "BUSD"
        },
        "DAI": {
            "tokenAddress": "0x6b175474e89094c44da98b954eedeac495271d0f",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "41.30",
            "stableBorrowRate": "47.80",
            "variableSupplyRate": "0",
            "stableSupplyRate": "5.55",
            "ltv": "63",
            "availableLiquidity": "3045235489027835392126555",
            "reserveSize": "29144822136454532498888813",
            "tokenSymbol": "DAI"
        },
        "USDT": {
            "tokenAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "71.41",
            "stableBorrowRate": "77.91",
            "variableSupplyRate": "0",
            "stableSupplyRate": "9.98",
            "ltv": "0",
            "availableLiquidity": "5814305491313",
            "reserveSize": "85276118847760",
            "tokenSymbol": "USDT"
        },
        "SNX": {
            "tokenAddress": "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "20.00",
            "stableBorrowRate": "0.00",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "0",
            "availableLiquidity": "401177398555774938702130",
            "reserveSize": "402156407105711365442784",
            "tokenSymbol": "SNX"
        },
        "TUSD": {
            "tokenAddress": "0x0000000000085d4780b73119b644ae5ecd22b376",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "10.00",
            "stableBorrowRate": "159.69",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "0",
            "availableLiquidity": "366460360656447246350806",
            "reserveSize": "504142753697157517092861",
            "tokenSymbol": "TUSD"
        },
        "stETH": {
            "tokenAddress": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "0.00",
            "stableBorrowRate": "0.00",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "72",
            "availableLiquidity": "53089770724921131090223",
            "reserveSize": "53089770724921131090223",
            "tokenSymbol": "stETH"
        },
        "AAVE": {
            "tokenAddress": "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "0.00",
            "stableBorrowRate": "0.00",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "66",
            "availableLiquidity": "36950678362513807739186",
            "reserveSize": "36950678362513807739186",
            "tokenSymbol": "AAVE"
        },
        "DPI": {
            "tokenAddress": "0x1494ca1f11d487c2bbe4543e90080aeba4ba3c2b",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "37.73",
            "stableBorrowRate": "0.00",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "0",
            "availableLiquidity": "381243732115848862926",
            "reserveSize": "811684752053466357550",
            "tokenSymbol": "DPI"
        },
        "ENS": {
            "tokenAddress": "0xc18360217d8f7ab5e7c516566761ea12ce7f9d72",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "20.00",
            "stableBorrowRate": "0.00",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "0",
            "availableLiquidity": "9430517331780300697697",
            "reserveSize": "9449742786126396612494",
            "tokenSymbol": "ENS"
        },
        "USDP": {
            "tokenAddress": "0x8e870d67f660d95d5be530380d0ec0bd388289e1",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "134.72",
            "stableBorrowRate": "0.00",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.01",
            "ltv": "0",
            "availableLiquidity": "56679821554076798473774",
            "reserveSize": "170862462194523456791818",
            "tokenSymbol": "USDP"
        },
        "WBTC": {
            "tokenAddress": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "0.26",
            "stableBorrowRate": "3.65",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "72",
            "availableLiquidity": "408059770286",
            "reserveSize": "425924045364",
            "tokenSymbol": "WBTC"
        },
        "UNI": {
            "tokenAddress": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "20.00",
            "stableBorrowRate": "0.99",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "0",
            "availableLiquidity": "75770894175151538323669",
            "reserveSize": "78703335365737857005517",
            "tokenSymbol": "UNI"
        },
        "USDC": {
            "tokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "32.08",
            "stableBorrowRate": "37.58",
            "variableSupplyRate": "0",
            "stableSupplyRate": "4.54",
            "ltv": "75",
            "availableLiquidity": "4891442618167",
            "reserveSize": "87825965324087",
            "tokenSymbol": "USDC"
        },
        "sUSD": {
            "tokenAddress": "0x57ab1ec28d129707052df4df418d58a2d46d5f51",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "71.29",
            "stableBorrowRate": "0.00",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "0",
            "availableLiquidity": "207116631044337396149030",
            "reserveSize": "354289141610132196147068",
            "tokenSymbol": "sUSD"
        },
        "CRV": {
            "tokenAddress": "0xd533a949740bb3306d119cc777fa900ba034cd52",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "20.00",
            "stableBorrowRate": "3.12",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.00",
            "ltv": "0",
            "availableLiquidity": "2516817169977279859419238",
            "reserveSize": "2524844760028715574320036",
            "tokenSymbol": "CRV"
        },
        "WETH": {
            "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "poolAddress": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
            "variableBorrowRate": "1.91",
            "stableBorrowRate": "3.95",
            "variableSupplyRate": "0",
            "stableSupplyRate": "0.05",
            "ltv": "82.5",
            "availableLiquidity": "64464470844963744307589",
            "reserveSize": "79678322543407769925227",
            "tokenSymbol": "WETH"
        }
    }
}
```

{% endtab %}
{% endtabs %}

[back to top](#endpoints-available)

### /getuseraccountdata

#### Get the repay, borrow, withdraw amount and health factor details for the given user.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/lendborrow/getuseraccountdata`

#### Query Parameters

| Name                                               | Type   | Description                                                                          |
| -------------------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| rpc                                                | String | Remote procedural call URL.                                                          |
| lendborrowId                                       | String | Refer to the [lend borrow Id](broken://pages/XoZTiUkj66UXxqYVd64n) page for details. |
| asset<mark style="color:red;">\*</mark>            | String | Token address.                                                                       |
| address<mark style="color:red;">\*</mark>          | String | Public address of sender.                                                            |
| interestRateMode<mark style="color:red;">\*</mark> | String | Interest mode as per Aave. Is set '1' as default.                                    |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/lendborrow/getuseraccountdata?address=0x6Fb447Ae94F5180254D436A693907a1f57696900&asset=0x514910771af9ca656af840dff83e8264ecf986ca&lendborrowId=1000&interestRateMode=1
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "tokenAddress": "0x514910771af9ca656af840dff83e8264ecf986ca",
        "repayAmount": "0",
        "borrowAmount": "473877059646280",
        "borrowErrorMessage": "The Stable Rate is not enabled for this currency",
        "withdrawAmount": "0",
        "healthFactor": "1086711741859975271"
    }
}
```

{% endtab %}
{% endtabs %}

[back to top](#endpoints-available)

### /getuserpositions

#### Retrieves the lending and borrowing positions of a user, including details such as token balances and collateral usage status.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/lendborrow/getuserpositions`

#### Query Parameters

| Name                                      | Type   | Description                                                                                                                    |
| ----------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------ |
| rpc                                       | String | Remote procedural call URL.                                                                                                    |
| address<mark style="color:red;">\*</mark> | String | Public address of sender.                                                                                                      |
| lendborrowId                              | String | Refer to the [lend borrow Id](broken://pages/XoZTiUkj66UXxqYVd64n) page for details.                                           |
| assets                                    | String | Comma-separated list of token addresses to filter specific assets. If omitted, data for all supported assets will be returned. |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/lendborrow/getuserpositions?address=0x6Fb447Ae94F5180254D436A693907a1f57696900&lendborrowId=1000
```

{% endtab %}

{% tab title="Sample Response " %}

```json
{
    "status": 200,
    "msg": "success",
    "data": [
        {
            "aToken": "0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811",
            "underlyingAsset": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
            "usageAsCollateralEnabledOnUser": false,
            "scaledVariableDebt": "4326910",
            "currentDebt": "7214119",
            "interestAPRPercentage": "5.15",
            "accruedInterest": "2887209",
            "prices": {
                "usd": [
                    {
                        "0xdac17f958d2ee523a2206206994597c13d831ec7": "0.9997896672336982"
                    }
                ]
            }
        },
        {
            "aToken": "0x030bA81f1c18d280636F32af80b9AAd02Cf0854e",
            "underlyingAsset": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
            "usageAsCollateralEnabledOnUser": true,
            "scaledATokenBalance": "3131488563803911",
            "currentBalance": "3253286676056609",
            "rewardsAPYPercentage": "0.05",
            "accruedRewards": "121798112252698",
            "prices": {
                "usd": [
                    {
                        "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": "4290.504286934678"
                    }
                ]
            }
        },
        {
            "aToken": "0x028171bCA77440897B824Ca71D1c56caC55b68A3",
            "underlyingAsset": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
            "usageAsCollateralEnabledOnUser": true,
            "scaledATokenBalance": "6489053723655984138",
            "currentBalance": "7700568680878044808",
            "rewardsAPYPercentage": "0.96",
            "accruedRewards": "1211514957222060670",
            "prices": {
                "usd": [
                    {
                        "0x6b175474e89094c44da98b954eedeac495271d0f": "0.9998016230315524"
                    }
                ]
            }
        }
    ]
}
```

{% endtab %}
{% endtabs %}

[back to top](#endpoints-available)

### /borrow

#### Trigger the borrow transaction from the given protocol.

<mark style="color:green;">`POST`</mark> `https://api.expand.network/lendborrow/borrow`

#### Request Body

| Name                                               | Type   | Description                                                                              |
| -------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------- |
| lendborrowId                                       | String | Refer to the [Lend and Borrow ID](broken://pages/XoZTiUkj66UXxqYVd64n) page for details. |
| asset<mark style="color:red;">\*</mark>            | String | Token address to borrow.                                                                 |
| amount<mark style="color:red;">\*</mark>           | String | Number of tokens to be borrowed.                                                         |
| interestRateMode<mark style="color:red;">\*</mark> | String | Interest mode as per Aave. 0 for static and 1 for variable.                              |
| onBehalfOf<mark style="color:red;">\*</mark>       | String | Required in case borrow need to be done on behalf of other public address.               |
| from<mark style="color:red;">\*</mark>             | String | Sender public address.                                                                   |
| gas                                                | String | Maximum gas to be approved for transaction.                                              |
| rpc                                                | String | Remote procedural call URL.                                                              |
| gasPriority                                        | String | low, medium, or high.                                                                    |

{% tabs %}
{% tab title="Sample Request" %}

```json
{
    "lendborrowId": "1000",
    "asset": "0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F",
    "amount": "100",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "onBehalfOf": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "interestRateMode": "2",
    "gas": "408298"
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
        "to": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
        "value": "0",
        "gas": "408298",
        "data": "0xa415bcad000000000000000000000000c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f00000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000063056e00436da25bcf48a40dfbbdcc7089351006",
        "referenceId": "73d8435c30b6432aa661e8c90215e863"
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample Request" %}
**With gasPriority(medium):**

```json
{
    "lendborrowId": "1000",
    "asset": "0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F",
    "amount": "100",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "onBehalfOf": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "interestRateMode": "2",
    "gas": "408298",
    "gasPriority": "medium"
}
```

{% endtab %}

{% tab title="Sample Response" %}
**With gasPriority:**

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
        "to": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
        "value": "0",
        "gas": "408298",
        "data": "0xa415bcad000000000000000000000000c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f00000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000063056e00436da25bcf48a40dfbbdcc7089351006",
        "gasPrice": "4115928188",
        "referenceId": "a9c5748d49b44d0581111f7ea11c8a61"
    }
}
```

{% endtab %}
{% endtabs %}

[back to top](#endpoints-available)

### /deposit

#### Trigger the deposit transaction from the given protocol.

<mark style="color:green;">`POST`</mark> `https://api.expand.network/lendborrow/deposit`

#### Request Body

| Name                                         | Type   | Description                                                                              |
| -------------------------------------------- | ------ | ---------------------------------------------------------------------------------------- |
| lendborrowId                                 | String | Refer to the [Lend and Borrow ID](broken://pages/XoZTiUkj66UXxqYVd64n) page for details. |
| asset<mark style="color:red;">\*</mark>      | String | Token address to deposit.                                                                |
| amount<mark style="color:red;">\*</mark>     | String | Number of tokens to deposit.                                                             |
| onBehalfOf<mark style="color:red;">\*</mark> | String | Required in case deposit need to be done on behalf of other public address.              |
| from<mark style="color:red;">\*</mark>       | String | Sender public address.                                                                   |
| gas                                          | String | Maximum gas to be approved for the transaction.                                          |
| rpc                                          | String | Remote procedural call URL.                                                              |
| involveBaseToken                             | String | <p>0 for any ERC-20 token,<br>1 for ETH.</p>                                             |
| gasPriority                                  | String | low, medium, or high.                                                                    |

{% tabs %}
{% tab title="Sample Request" %}

```json
{
    "lendborrowId": "1000",
    "asset": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "amount": "10000000000000000",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "onBehalfOf": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "408298"
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
        "to": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
        "value": "0",
        "gas": "408298",
        "data": "0xe8eda9df000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000002386f26fc1000000000000000000000000000063056e00436da25bcf48a40dfbbdcc70893510060000000000000000000000000000000000000000000000000000000000000000",
        "referenceId": "e7354f7c396f451f98359be5db31bd4a"
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample Request" %}
**With gasPriority (low):**

```json
{
    "lendborrowId": "1000",
    "asset": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    "amount": "10000000000000",
    "from": "0x356db816602c85e2075774bb77d13995c8bab023",
    "onBehalfOf": "0x356db816602c85e2075774bb77d13995c8bab023",
    "gas": "520000",
    "gasPriority": "low"
}
```

{% endtab %}

{% tab title="Sample Response" %}
**With gasPriority:**

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0x356db816602c85e2075774bb77d13995c8bab023",
        "to": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
        "value": "0",
        "gas": "520000",
        "data": "0xe8eda9df0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000000000000009184e72a000000000000000000000000000356db816602c85e2075774bb77d13995c8bab0230000000000000000000000000000000000000000000000000000000000000000",
        "gasPrice": "3459319856",
        "referenceId": "240aa659656d499699de5fa6ff05fefa"
    }
}
```

{% endtab %}
{% endtabs %}

[back to top](#endpoints-available)

### /repay

#### Trigger the repay transaction from the given protocol.

<mark style="color:green;">`POST`</mark> `https://api.expand.network/lendborrow/repay`

#### Request Body

| Name                                               | Type   | Description                                                                              |
| -------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------- |
| lendborrowId                                       | String | Refer to the [Lend and Borrow ID](broken://pages/XoZTiUkj66UXxqYVd64n) page for details. |
| asset<mark style="color:red;">\*</mark>            | String | Token address to repay.                                                                  |
| interestRateMode<mark style="color:red;">\*</mark> | String | Interest mode as per Aave. 0 for static and 1 for variable.                              |
| onBehalfOf<mark style="color:red;">\*</mark>       | String | Required in case repay need to be done on behalf of other public address.                |
| from<mark style="color:red;">\*</mark>             | String | Sender public address.                                                                   |
| gas                                                | String | Maximum gas to be approved for the transaction.                                          |
| amount<mark style="color:red;">\*</mark>           | String | Number of tokens to repay.                                                               |
| rpc                                                | String | Remote procedural call URL.                                                              |
| gasPriority                                        | String | low, medium, or high.                                                                    |

{% tabs %}
{% tab title="Sample Request" %}

```json
{
    "lendborrowId": "1000",
    "asset": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
    "amount": "100000",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "onBehalfOf": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "interestRateMode": "2",
    "gas": "408298"
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
        "to": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
        "value": "0",
        "gas": "408298",
        "data": "0x573ade81000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000063056e00436da25bcf48a40dfbbdcc7089351006",
        "referenceId": "40901b075cf4426bb13daa25adb69d72"
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample Request" %}
**With gasPriority (medium):**

```json
{
    "lendborrowId": "1000",
    "asset": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    "amount": "10000000000",
    "from": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
    "onBehalfOf": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
    "interestRateMode": "2",
    "gas": "408298",
    "gasPriority":"medium"
}
```

{% endtab %}

{% tab title="Sample Response" %}
**With gasPriority:**

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
        "to": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
        "value": "0",
        "gas": "408298",
        "data": "0x573ade810000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000002540be4000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000fae7d9854995e28beb1b1da864ee2a1e2ec17f07",
        "gasPrice": "3904209506",
        "referenceId": "d37a6d9d3a084066a980aaafd2ca5e61"
    }
}
```

{% endtab %}
{% endtabs %}

[back to top](#endpoints-available)

### /withdraw

#### Trigger the withdraw transaction from the given protocol.

<mark style="color:green;">`POST`</mark> `https://api.expand.network/lendborrow/withdraw`

#### Request Body

| Name                                     | Type   | Description                                                                              |
| ---------------------------------------- | ------ | ---------------------------------------------------------------------------------------- |
| lendborrowId                             | String | Refer to the [Lend and Borrow ID](broken://pages/XoZTiUkj66UXxqYVd64n) page for details. |
| asset<mark style="color:red;">\*</mark>  | String | Token address to be withdraw.                                                            |
| amount<mark style="color:red;">\*</mark> | String | Number of tokens to withdraw.                                                            |
| to<mark style="color:red;">\*</mark>     | String | Recipient public address.                                                                |
| from<mark style="color:red;">\*</mark>   | String | Sender public address.                                                                   |
| gas                                      | String | Maximum gas to be approved for the transaction.                                          |
| rpc                                      | String | Remote procedural call URL.                                                              |
| gasPriority                              | String | low, medium, or high.                                                                    |

{% tabs %}
{% tab title="Sample Request" %}

```json
{
    "lendborrowId": "1000",
    "asset": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    "amount": "1000000000000000000",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "408298"
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
        "to": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
        "value": "0",
        "gas": "408298",
        "data": "0x69328dec0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000063056e00436da25bcf48a40dfbbdcc7089351006",
        "referenceId": "3fd62ffec3264f33962ef2978b6e0892"
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample Request" %}
**With gasPriority (low):**

```json
{
    "lendborrowId": "1000",
    "asset": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    "amount": "100000000000",
    "from": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
    "to": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
    "gas": "408298",
    "gasPriority":"low"
}
```

{% endtab %}

{% tab title="Sample Response" %}
**With gasPriority:**

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
        "to": "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
        "value": "0",
        "gas": "408298",
        "data": "0x69328dec0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000000000000000174876e800000000000000000000000000fae7d9854995e28beb1b1da864ee2a1e2ec17f07",
        "gasPrice": "3312899520",
        "referenceId": "d7fd42b08f9344b79511bf4fc13970f9"
    }
}
```

{% endtab %}
{% endtabs %}

[back to top](#endpoints-available)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.expand.network/integrations/lending-protocols/aave-v2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
