# AaveV3Adapter

*The implementation of Aave.Finance MoneyMarket that integrates with AssetManager.*

### assetManager

```solidity
address assetManager
```

*the AssetManager contract address*

### market

```solidity
contract AMarket3 market
```

*Aave Market contract*

### lendingPool

```solidity
contract LendingPool3 lendingPool
```

*Aave Lending pool contract*

### tokenToAToken

```solidity
mapping(address => address) tokenToAToken
```

*Mapping of token to aToken*

### floorMap

```solidity
mapping(address => uint256) floorMap
```

*Mapping of token to floor amount*

### ceilingMap

```solidity
mapping(address => uint256) ceilingMap
```

*Mapping of token to ceiling amount*

### LogSetAssetManager

```solidity
event LogSetAssetManager(address sender, address assetManager)
```

### LogSetFloor

```solidity
event LogSetFloor(address sender, address tokenAddress, uint256 floor)
```

### LogSetCeiling

```solidity
event LogSetCeiling(address sender, address tokenAddress, uint256 ceiling)
```

### \_\_AaveV3Adapter\_init

```solidity
function __AaveV3Adapter_init(address _assetManager, contract LendingPool3 _lendingPool, contract AMarket3 _market) public
```

### TokenNotSupported

```solidity
error TokenNotSupported()
```

### SenderNotAssetManager

```solidity
error SenderNotAssetManager()
```

### checkTokenSupported

```solidity
modifier checkTokenSupported(address tokenAddress)
```

*Check supplied token address is supported*

### onlyAssetManager

```solidity
modifier onlyAssetManager()
```

*Check sender is the asset manager*

### setAssetManager

```solidity
function setAssetManager(address _assetManager) external
```

*Set the asset manager contract address Only callable by the admin*

#### Parameters

| Name           | Type    | Description                   |
| -------------- | ------- | ----------------------------- |
| \_assetManager | address | AssetManager contract address |

### setFloor

```solidity
function setFloor(address tokenAddress, uint256 floor) external
```

*Set floor amount Only callable by the admin*

#### Parameters

| Name         | Type    | Description                               |
| ------------ | ------- | ----------------------------------------- |
| tokenAddress | address | Address of the token to set the floor for |
| floor        | uint256 | Floor amount                              |

### setCeiling

```solidity
function setCeiling(address tokenAddress, uint256 ceiling) external
```

*Set ceiling amount Only callable by the admin*

#### Parameters

| Name         | Type    | Description                                 |
| ------------ | ------- | ------------------------------------------- |
| tokenAddress | address | Address of the token to set the ceiling for |
| ceiling      | uint256 | ceiling amount                              |

### getRate

```solidity
function getRate(address tokenAddress) external view returns (uint256)
```

*Get the underlying market rate*

#### Parameters

| Name         | Type    | Description                  |
| ------------ | ------- | ---------------------------- |
| tokenAddress | address | The underlying token address |

### getSupply

```solidity
function getSupply(address tokenAddress) external view returns (uint256)
```

*Get total supply of this Contracts*

#### Parameters

| Name         | Type    | Description                   |
| ------------ | ------- | ----------------------------- |
| tokenAddress | address | The token to check supply for |

### getSupplyView

```solidity
function getSupplyView(address tokenAddress) external view returns (uint256)
```

*Get total supply of this Contracts including any balance that has been deposited into the underlying market*

#### Parameters

| Name         | Type    | Description                   |
| ------------ | ------- | ----------------------------- |
| tokenAddress | address | The token to check supply for |

### supportsToken

```solidity
function supportsToken(address tokenAddress) external view returns (bool)
```

*Check if this token is supported*

#### Parameters

| Name         | Type    | Description        |
| ------------ | ------- | ------------------ |
| tokenAddress | address | The token to check |

### mapTokenToAToken

```solidity
function mapTokenToAToken(address tokenAddress) external
```

*Add aToken to the token mapping for a supported token*

#### Parameters

| Name         | Type    | Description   |
| ------------ | ------- | ------------- |
| tokenAddress | address | Token address |

### deposit

```solidity
function deposit(address tokenAddress) external
```

*Deposit tokens into the underlying Aave V3 lending pool*

#### Parameters

| Name         | Type    | Description   |
| ------------ | ------- | ------------- |
| tokenAddress | address | Token address |

### withdraw

```solidity
function withdraw(address tokenAddress, address recipient, uint256 tokenAmount) external
```

*Withdraw tokens from this adapter Only callable by the AssetManager*

#### Parameters

| Name         | Type    | Description                  |
| ------------ | ------- | ---------------------------- |
| tokenAddress | address | Token to withdraw            |
| recipient    | address | Recieved by                  |
| tokenAmount  | uint256 | Amount of tokens to withdraw |

### withdrawAll

```solidity
function withdrawAll(address tokenAddress, address recipient) external
```

*Withdraw all tokens from this adapter Only callable by the AssetManager*

#### Parameters

| Name         | Type    | Description       |
| ------------ | ------- | ----------------- |
| tokenAddress | address | Token to withdraw |
| recipient    | address | Recieved by       |

### claimRewards

```solidity
function claimRewards(address tokenAddress, address recipient) external
```

*Claim rewards from the Aave rewards controller*

#### Parameters

| Name         | Type    | Description   |
| ------------ | ------- | ------------- |
| tokenAddress | address | Token address |
| recipient    | address | The recipient |

### \_getSupply

```solidity
function _getSupply(address tokenAddress) internal view returns (uint256)
```

### \_supportsToken

```solidity
function _supportsToken(address tokenAddress) internal view returns (bool)
```


---

# 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.union.finance/developers/core/aavev3adapter.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.
