> For the complete documentation index, see [llms.txt](https://uliquid.gitbook.io/uliquid_v1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://uliquid.gitbook.io/uliquid_v1/core-contracts/leverager.md).

# Leverager

## Leverager

The Uliquid V1 Protocol has one type of Leverage contract for Aave. Leverage contracts deployed for Aave forks inherit this contract

### AaveLeverager

### Structs

#### WindArgs

| Param Name                         | Type         | Description                                                                      |
| ---------------------------------- | ------------ | -------------------------------------------------------------------------------- |
| lendingPool                        | ILendingPool | Aave lending pool                                                                |
| priceOracle                        | IPriceOracle | Aave price oracle                                                                |
| collateral                         | address      | address of token to be leveraged                                                 |
| debt                               | address      | address of debt token to be incured                                              |
| collateralAmount                   | address      | initial amount of collateral token                                               |
| estimatedLeveragedCollateralAmount | uint         | estimated leveraged collateral amount                                            |
| cRatio                             | uint         | collateralization ratio scaled by 10\*\*6                                        |
| collateralDecimals                 | uint         | decimals of collateral token                                                     |
| debtDecimals                       | uint         | decimals of debt token                                                           |
| interestRateMode                   | uint         | interest rate mode, 1 for Stable debt or 2 for Variable debt                     |
| loops                              | uint         | specifies the number of collateral deposits, borrows and swaps to be carried out |
| swapData                           | bytes        | encoded data for swap of debt to collateral                                      |

### Write Methods

### wind

#### function wind(WindArgs memory args)

deposits collateral and borrows debt in a series of loops

{% hint style="info" %}
Caller must have approved Leverage contract to spend collateral
{% endhint %}

| Param Name | Type     | Description                                  |
| ---------- | -------- | -------------------------------------------- |
| args       | WindArgs | Contains all arguments required for leverage |

### setSwapper

#### function setSwapper(address payable \_swapper)

Sets a new swapper contract

{% hint style="info" %}
Only callable by Admin
{% endhint %}

| Param Name | Type            | Description                         |
| ---------- | --------------- | ----------------------------------- |
| \_swapper  | address payable | address of the new Leverage Swapper |

### setAdmin

#### function setAdmin(address \_admin)

Sets a new admin

{% hint style="info" %}
Only callable by Admin
{% endhint %}

| Param Name | Type    | Description              |
| ---------- | ------- | ------------------------ |
| \_admin    | address | address of the new admin |

### approveLendingPool

#### function approveLendingPool(address pool)

approves an Aave (or fork) lending pool

{% hint style="info" %}
Only callable by Admin
{% endhint %}

| Param Name | Type    | Description          |
| ---------- | ------- | -------------------- |
| pool       | address | lending pool address |

### disapproveLendingPool

#### function disapproveLendingPool(address pool)

disapproves an Aave (or fork) lending pool

{% hint style="info" %}
Only callable by Admin
{% endhint %}

| Param Name | Type    | Description          |
| ---------- | ------- | -------------------- |
| pool       | address | lending pool address |

### getCash

#### function getCash(address \_token)

withdraws stray token amounts to admin

{% hint style="info" %}
Only callable by Admin
{% endhint %}

| Param Name | Type    | Description               |
| ---------- | ------- | ------------------------- |
| \_token    | address | address of an ERC20 token |
