2020-08-06 07:52:15 +00:00
|
|
|
// SPDX-License-Identifier: agpl-3.0
|
|
|
|
pragma solidity ^0.6.8;
|
|
|
|
|
2020-08-20 07:51:21 +00:00
|
|
|
import {DebtTokenBase} from '../../tokenization/base/DebtTokenBase.sol';
|
|
|
|
import {ReserveLogic} from '../logic/ReserveLogic.sol';
|
2020-08-06 07:52:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @title Helpers library
|
|
|
|
* @author Aave
|
|
|
|
* @notice Implements calculation helpers.
|
|
|
|
*/
|
|
|
|
library Helpers {
|
|
|
|
/**
|
|
|
|
* @dev fetches the user current stable and variable debt balances
|
2020-08-21 12:54:07 +00:00
|
|
|
* @param user the user
|
|
|
|
* @param reserve the reserve object
|
2020-08-06 07:52:15 +00:00
|
|
|
* @return the stable and variable debt balance
|
|
|
|
**/
|
2020-08-21 12:54:07 +00:00
|
|
|
function getUserCurrentDebt(address user, ReserveLogic.ReserveData storage reserve)
|
2020-08-06 07:52:15 +00:00
|
|
|
internal
|
|
|
|
view
|
|
|
|
returns (uint256, uint256)
|
|
|
|
{
|
|
|
|
return (
|
2020-08-21 12:54:07 +00:00
|
|
|
DebtTokenBase(reserve.stableDebtTokenAddress).balanceOf(user),
|
|
|
|
DebtTokenBase(reserve.variableDebtTokenAddress).balanceOf(user)
|
2020-08-06 07:52:15 +00:00
|
|
|
);
|
|
|
|
}
|
2020-10-28 14:41:31 +00:00
|
|
|
|
2020-11-02 16:01:47 +00:00
|
|
|
function getUserCurrentDebtMemory(address user, ReserveLogic.ReserveData memory reserve)
|
2020-10-28 14:41:31 +00:00
|
|
|
internal
|
|
|
|
view
|
|
|
|
returns (uint256, uint256)
|
|
|
|
{
|
|
|
|
return (
|
|
|
|
DebtTokenBase(reserve.stableDebtTokenAddress).balanceOf(user),
|
|
|
|
DebtTokenBase(reserve.variableDebtTokenAddress).balanceOf(user)
|
|
|
|
);
|
|
|
|
}
|
2020-08-06 07:52:15 +00:00
|
|
|
}
|