ProtocolDataProvider

Peripheral contract to collect and pre-process information from the Pool.

MKR

address MKR

ETH

address ETH

ADDRESSES_PROVIDER

contract IPoolAddressesProvider ADDRESSES_PROVIDER

constructor

constructor(contract IPoolAddressesProvider addressesProvider) public

getAllReservesTokens

function getAllReservesTokens() external view returns (struct DataTypes.TokenData[])

Returns the list of the existing reserves in the pool.

Handling MKR and ETH in a different way since they do not have standard symbol functions.

Return Values

Name
Type
Description

[0]

struct DataTypes.TokenData[]

The list of reserves, pairs of symbols and addresses

getAllXTokens

function getAllXTokens() external view returns (struct DataTypes.TokenData[])

Returns the list of the existing XTokens(PToken+NToken) in the pool.

Return Values

Name
Type
Description

[0]

struct DataTypes.TokenData[]

The list of XTokens, pairs of symbols and addresses

getReserveConfigurationData

function getReserveConfigurationData(address asset) external view returns (struct DataTypes.ReserveConfigData reserveData)

Returns the configuration data of the reserve

Not returning borrow and supply caps for compatibility, nor pause flag

Parameters

Name
Type
Description

asset

address

The address of the underlying asset of the reserve

getReserveCaps

function getReserveCaps(address asset) external view returns (uint256 borrowCap, uint256 supplyCap)

Returns the caps parameters of the reserve

Parameters

Name
Type
Description

asset

address

The address of the underlying asset of the reserve

Return Values

Name
Type
Description

borrowCap

uint256

borrowCap The borrow cap of the reserve

supplyCap

uint256

supplyCap The supply cap of the reserve

getSiloedBorrowing

function getSiloedBorrowing(address asset) external view returns (bool)

Returns the siloed borrowing flag

Parameters

Name
Type
Description

asset

address

The address of the underlying asset of the reserve

Return Values

Name
Type
Description

[0]

bool

True if the asset is siloed for borrowing

getLiquidationProtocolFee

function getLiquidationProtocolFee(address asset) external view returns (uint256)

Returns the protocol fee on the liquidation bonus

Parameters

Name
Type
Description

asset

address

The address of the underlying asset of the reserve

Return Values

Name
Type
Description

[0]

uint256

The protocol fee on liquidation

getReserveData

function getReserveData(address asset) external view returns (uint256 accruedToTreasuryScaled, uint256 totalPToken, uint256 totalVariableDebt, uint256 liquidityRate, uint256 variableBorrowRate, uint256 liquidityIndex, uint256 variableBorrowIndex, uint40 lastUpdateTimestamp)

Returns the reserve data

Parameters

Name
Type
Description

asset

address

The address of the underlying asset of the reserve

Return Values

Name
Type
Description

accruedToTreasuryScaled

uint256

The scaled amount of tokens accrued to treasury that is to be minted

totalPToken

uint256

The total supply of the xToken

totalVariableDebt

uint256

The total variable debt of the reserve

liquidityRate

uint256

The liquidity rate of the reserve

variableBorrowRate

uint256

The variable borrow rate of the reserve

liquidityIndex

uint256

The liquidity index of the reserve

variableBorrowIndex

uint256

The variable borrow index of the reserve

lastUpdateTimestamp

uint40

The timestamp of the last update of the reserve

getXTokenTotalSupply

function getXTokenTotalSupply(address asset) external view returns (uint256)

Returns the total supply of xTokens for a given asset

Parameters

Name
Type
Description

asset

address

The address of the underlying asset of the reserve

Return Values

Name
Type
Description

[0]

uint256

The total supply of the xToken

getTotalDebt

function getTotalDebt(address asset) external view returns (uint256)

Returns the total debt for a given asset

Parameters

Name
Type
Description

asset

address

The address of the underlying asset of the reserve

Return Values

Name
Type
Description

[0]

uint256

The total debt for asset

getUserReserveData

function getUserReserveData(address asset, address user) external view returns (uint256 currentXTokenBalance, uint256 scaledXTokenBalance, uint256 collateralizedBalance, uint256 currentVariableDebt, uint256 scaledVariableDebt, uint256 liquidityRate, bool usageAsCollateralEnabled)

Returns the user data in a reserve

Parameters

Name
Type
Description

asset

address

The address of the underlying asset of the reserve

user

address

The address of the user

Return Values

Name
Type
Description

currentXTokenBalance

uint256

The current XToken balance of the user

scaledXTokenBalance

uint256

The scaled XToken balance of the user

collateralizedBalance

uint256

The collateralized balance of the user

currentVariableDebt

uint256

The current variable debt of the user

scaledVariableDebt

uint256

The scaled variable debt of the user

liquidityRate

uint256

The liquidity rate of the reserve

usageAsCollateralEnabled

bool

True if the user is using the asset as collateral, false otherwise

getReserveTokensAddresses

function getReserveTokensAddresses(address asset) external view returns (address xTokenAddress, address variableDebtTokenAddress)

Returns the token addresses of the reserve

Parameters

Name
Type
Description

asset

address

The address of the underlying asset of the reserve

Return Values

Name
Type
Description

xTokenAddress

address

The PToken address of the reserve

variableDebtTokenAddress

address

The VariableDebtToken address of the reserve

getStrategyAddresses

function getStrategyAddresses(address asset) external view returns (address interestRateStrategyAddress, address auctionStrategyAddress)

Returns the address of the Interest Rate strategy

Parameters

Name
Type
Description

asset

address

The address of the underlying asset of the reserve

Return Values

Name
Type
Description

interestRateStrategyAddress

address

The address of the Interest Rate strategy

auctionStrategyAddress

address

The address of the Auction strategy