mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Added change to the stabledebttoken
This commit is contained in:
parent
570a81a1b2
commit
bcdef6fa7e
|
@ -110,7 +110,8 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase {
|
||||||
uint256 balanceIncrease
|
uint256 balanceIncrease
|
||||||
) = _calculateBalanceIncrease(user);
|
) = _calculateBalanceIncrease(user);
|
||||||
|
|
||||||
vars.currentSupply = totalSupply();
|
//accrueing the interest accumulation to the stored total supply and caching it
|
||||||
|
vars.currentSupply = _totalSupply = totalSupply();
|
||||||
vars.currentAvgStableRate = _avgStableRate;
|
vars.currentAvgStableRate = _avgStableRate;
|
||||||
vars.nextSupply = vars.currentSupply.add(amount);
|
vars.nextSupply = vars.currentSupply.add(amount);
|
||||||
|
|
||||||
|
@ -125,12 +126,13 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase {
|
||||||
require(vars.newStableRate < (1 << 128), 'Debt token: stable rate overflow');
|
require(vars.newStableRate < (1 << 128), 'Debt token: stable rate overflow');
|
||||||
_usersData[user] = vars.newStableRate;
|
_usersData[user] = vars.newStableRate;
|
||||||
|
|
||||||
|
//updating the user and supply timestamp
|
||||||
//solium-disable-next-line
|
//solium-disable-next-line
|
||||||
_totalSupplyTimestamp = _timestamps[user] = uint40(block.timestamp);
|
_totalSupplyTimestamp = _timestamps[user] = uint40(block.timestamp);
|
||||||
|
|
||||||
//calculates the updated average stable rate
|
//calculates the updated average stable rate
|
||||||
_avgStableRate = vars.currentAvgStableRate
|
_avgStableRate = vars.currentAvgStableRate
|
||||||
.rayMul(vars.currentPrincipalSupply.wadToRay())
|
.rayMul(vars.currentSupply.wadToRay())
|
||||||
.add(rate.rayMul(vars.amountInRay))
|
.add(rate.rayMul(vars.amountInRay))
|
||||||
.rayDiv(vars.nextSupply.wadToRay());
|
.rayDiv(vars.nextSupply.wadToRay());
|
||||||
|
|
||||||
|
@ -224,8 +226,9 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPrincipalSupplyAndAvgRate() public override view returns (uint256, uint256) {
|
function getSupplyData() public override view returns (uint256, uint256, uint256) {
|
||||||
return (super.totalSupply(), _avgStableRate);
|
uint256 avgRate = _avgStableRate;
|
||||||
|
return (super.totalSupply(), _calcTotalSupply(avgRate), avgRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTotalSupplyAndAvgRate() public override view returns (uint256, uint256) {
|
function getTotalSupplyAndAvgRate() public override view returns (uint256, uint256) {
|
||||||
|
|
|
@ -86,9 +86,9 @@ interface IStableDebtToken {
|
||||||
function getUserLastUpdated(address user) external view returns (uint40);
|
function getUserLastUpdated(address user) external view returns (uint40);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev returns the principal total supply and the average stable rate
|
* @dev returns the principal, the total supply and the average stable rate
|
||||||
**/
|
**/
|
||||||
function getPrincipalSupplyAndAvgRate() external view returns (uint256, uint256);
|
function getSupplyData() external view returns (uint256, uint256, uint256);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev returns the timestamp of the last update of the total supply
|
* @dev returns the timestamp of the last update of the total supply
|
||||||
|
|
Loading…
Reference in New Issue
Block a user