# Protocol Data Provider

Еhe purpose of this contract is to help integrators and developers more easily leverage the Aave Protocol data and features.

If you need development support, join the #developers channel on the [Aave community Discord server](https://discord.gg/CJm5Jt3).

The source code can be found [on Github here](https://github.com/aave/protocol-v2/blob/ice/mainnet-deployment-03-12-2020/contracts/misc/AaveProtocolDataProvider.sol).

Each market has a separate Protocol Data Provider. To get the address for a particular market, call [`getAddress()`](https://docs.aave.com/developers/the-core-protocol/addresses-provider#getaddress) using the value `0x1.`

## Methods <a href="#methods" id="methods"></a>

### getAllReservesToken&#x73;**()** <a href="#getallreservestokens" id="getallreservestokens"></a>

**`function getAllReservesTokens()`**

Returns an array of all reserve tokens for the current market, in the form of a TokenData struct consisting of the token symbol and token address.

#### Return values <a href="#return-values" id="return-values"></a>

| Type          | Description                                                                         |
| ------------- | ----------------------------------------------------------------------------------- |
| TokenData\[ ] | A struct consisting of a `symbol` of type string and `tokenAddress` of type address |

### getAllAToken&#x73;**()** <a href="#getallatokens" id="getallatokens"></a>

**`function getAllATokens()`**

Returns an array of all aTokens for the current market, in the form of a TokenData struct consisting of the token symbol and token address.

#### Return values <a href="#return-values-1" id="return-values-1"></a>

| Type          | Description                                                                         |
| ------------- | ----------------------------------------------------------------------------------- |
| TokenData\[ ] | A struct consisting of a `symbol` of type string and `tokenAddress` of type address |

### getReserveConfigurationDat&#x61;**()** <a href="#getreserveconfigurationdata" id="getreserveconfigurationdata"></a>

**`function getReserveConfigurationData(address asset)`**

Returns the configuration data for `asset`.

#### Return values <a href="#return-values-2" id="return-values-2"></a>

| Type    | Description                                                            |
| ------- | ---------------------------------------------------------------------- |
| uint256 | decimals: the decimals used by the reserve                             |
| uint256 | ltv: the Loan To Value                                                 |
| uint256 | liquidationThreshold: the liquidation threshold of the reserve         |
| uint256 | liquidationBonus: the bonus awarded to liquidators                     |
| uint256 | reserveFactor: the reserve factor                                      |
| bool    | usageAsCollateralEnabled: whether the reserve is enabled as collateral |
| bool    | borrowingEnabled: whether borrowing is enabled on the reserve          |
| bool    | stableBorrowRateEnabled: whether stable borrowing is enabled           |
| bool    | isActive: whether the reserve is active                                |
| bool    | isFrozen: whether the reserve is frozen / disabled                     |

### getReserveDat&#x61;**()** <a href="#getreservedata" id="getreservedata"></a>

**`function getReserveData(address asset)`**

Returns the associated data for `asset`.

#### Return values <a href="#return-values-3" id="return-values-3"></a>

| Type    | Description                                                               |
| ------- | ------------------------------------------------------------------------- |
| uint256 | availableLiquidity: the amount of liquidity available                     |
| uint256 | totalStableDebt: the total amount of debt borrowed at the stable rate     |
| uint256 | totalVariableDebt: the total amount of debt borrowed at the variable rate |
| uint256 | liquidityRate: the interest rate for deposits / adding liquidity          |
| uint256 | variableBorrowRate: the interest rate for borrowing at a variable rate    |
| uint256 | stableBorrowRate: the interest rate for borrowing at a stable rate        |
| uint256 | averageStableBorrowRate: the current average stable borrow rate           |
| uint256 | liquidityIndex: the index used in liquidity calculations                  |
| uint256 | variableBorrowIndex: the index used in variable debt calculations         |
| uint40  | lastUpdateTimestamp: the timestamp of the reserve's last update           |

### getUserReserveDat&#x61;**()** <a href="#getuserreservedata" id="getuserreservedata"></a>

**`function getUserReserveData(address asset, address user)`**

Returns the `user`'s reserve data for `asset`.

#### Return values <a href="#return-values-4" id="return-values-4"></a>

| Type    | Description                                                                             |
| ------- | --------------------------------------------------------------------------------------- |
| uint256 | currentATokenBalance: current aToken balance of `user`                                  |
| uint256 | currentStableDebt: current stable debt the `user`                                       |
| uint256 | currentVariableDebt: current variable debt of the `user`                                |
| uint256 | principalStableDebt: the principal stable debt of the `user`                            |
| uint256 | scaledVariableDebt: the scaled variable debt of the `user`                              |
| uint256 | stableBorrowRate: the stable borrow rate of the `user`                                  |
| uint256 | liquidityRate: the interest rate being earned by the user for deposits                  |
| uint40  | stableRateLastUpdated: the timestamp of the last stable rate update                     |
| bool    | usageAsCollateralEnabled: whether the `reserve` is enabled as collateral for the `user` |

### getReserveTokensAddresse&#x73;**()** <a href="#getreservetokensaddresses" id="getreservetokensaddresses"></a>

**`function getReserveTokensAddresses(address asset)`**

Returns the associated addresses for an `asset`

#### Return values <a href="#return-values-5" id="return-values-5"></a>

| Type    | Description                                                               |
| ------- | ------------------------------------------------------------------------- |
| address | aTokenAddress: the address of the tokenised deposit                       |
| address | stableDebtTokenAddress: the address of the tokenised stable rate debt     |
| address | variableDebtTokenAddress: the address of the tokenised variable rate debt |
