mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
40 lines
1.0 KiB
Solidity
40 lines
1.0 KiB
Solidity
// SPDX-License-Identifier: agpl-3.0
|
|
pragma solidity 0.6.12;
|
|
|
|
import {IERC20} from '../../../dependencies/openzeppelin/contracts/IERC20.sol';
|
|
import {DataTypes} from '../types/DataTypes.sol';
|
|
|
|
/**
|
|
* @title Helpers library
|
|
* @author Aave
|
|
*/
|
|
library Helpers {
|
|
/**
|
|
* @dev Fetches the user current stable and variable debt balances
|
|
* @param user The user address
|
|
* @param reserve The reserve data object
|
|
* @return The stable and variable debt balance
|
|
**/
|
|
function getUserCurrentDebt(address user, DataTypes.ReserveData storage reserve)
|
|
internal
|
|
view
|
|
returns (uint256, uint256)
|
|
{
|
|
return (
|
|
IERC20(reserve.stableDebtTokenAddress).balanceOf(user),
|
|
IERC20(reserve.variableDebtTokenAddress).balanceOf(user)
|
|
);
|
|
}
|
|
|
|
function getUserCurrentDebtMemory(address user, DataTypes.ReserveData memory reserve)
|
|
internal
|
|
view
|
|
returns (uint256, uint256)
|
|
{
|
|
return (
|
|
IERC20(reserve.stableDebtTokenAddress).balanceOf(user),
|
|
IERC20(reserve.variableDebtTokenAddress).balanceOf(user)
|
|
);
|
|
}
|
|
}
|