aave-protocol-v2/contracts/protocol/libraries/helpers/Helpers.sol

40 lines
1.0 KiB
Solidity
Raw Normal View History

2020-08-06 07:52:15 +00:00
// SPDX-License-Identifier: agpl-3.0
2020-11-20 10:45:20 +00:00
pragma solidity 0.6.12;
2020-08-06 07:52:15 +00:00
import {IERC20} from '../../../dependencies/openzeppelin/contracts/IERC20.sol';
import {DataTypes} from '../types/DataTypes.sol';
2020-08-06 07:52:15 +00:00
/**
* @title Helpers library
* @author Aave
*/
library Helpers {
/**
2020-11-25 17:33:49 +00:00
* @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
2020-08-06 07:52:15 +00:00
**/
function getUserCurrentDebt(address user, DataTypes.ReserveData storage reserve)
2020-08-06 07:52:15 +00:00
internal
view
returns (uint256, uint256)
{
return (
IERC20(reserve.stableDebtTokenAddress).balanceOf(user),
IERC20(reserve.variableDebtTokenAddress).balanceOf(user)
2020-08-06 07:52:15 +00:00
);
}
2020-10-28 14:41:31 +00:00
function getUserCurrentDebtMemory(address user, DataTypes.ReserveData memory reserve)
2020-10-28 14:41:31 +00:00
internal
view
returns (uint256, uint256)
{
return (
IERC20(reserve.stableDebtTokenAddress).balanceOf(user),
IERC20(reserve.variableDebtTokenAddress).balanceOf(user)
2020-10-28 14:41:31 +00:00
);
}
2020-08-06 07:52:15 +00:00
}