Merge branch 'master' of gitlab.com:aave-tech/protocol-v2 into feat/109-config-aave-token

This commit is contained in:
David Racero 2020-11-02 14:52:11 +01:00
commit 077078b084
3 changed files with 15 additions and 14 deletions

View File

@ -108,7 +108,7 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken {
//transfer event to track balances //transfer event to track balances
emit Transfer(user, address(0), amount); emit Transfer(user, address(0), amount);
emit Burn(_msgSender(), receiverOfUnderlying, amount, index); emit Burn(user, receiverOfUnderlying, amount, index);
} }
/** /**

View File

@ -142,11 +142,11 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase {
emit Mint( emit Mint(
user, user,
amount, amount,
previousBalance,
currentBalance, currentBalance,
balanceIncrease, balanceIncrease,
vars.newStableRate, vars.newStableRate,
vars.currentAvgStableRate vars.currentAvgStableRate,
vars.nextSupply
); );
return currentBalance == 0; return currentBalance == 0;
@ -166,16 +166,17 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase {
uint256 previousSupply = totalSupply(); uint256 previousSupply = totalSupply();
uint256 newStableRate = 0; uint256 newStableRate = 0;
uint256 nextSupply = 0;
//since the total supply and each single user debt accrue separately, //since the total supply and each single user debt accrue separately,
//there might be accumulation errors so that the last borrower repaying //there might be accumulation errors so that the last borrower repaying
//might actually try to repay more than the available debt supply. //might actually try to repay more than the available debt supply.
//in this case we simply set the total supply and the avg stable rate to 0 //in this case we simply set the total supply and the avg stable rate to 0
if (previousSupply <= amount) { if (previousSupply <= amount) {
newStableRate = _avgStableRate = 0; _avgStableRate = 0;
_totalSupply = 0; _totalSupply = 0;
} else { } else {
uint256 nextSupply = _totalSupply = previousSupply.sub(amount); nextSupply = _totalSupply = previousSupply.sub(amount);
newStableRate = _avgStableRate = _avgStableRate newStableRate = _avgStableRate = _avgStableRate
.rayMul(previousSupply.wadToRay()) .rayMul(previousSupply.wadToRay())
.sub(_usersData[user].rayMul(amount.wadToRay())) .sub(_usersData[user].rayMul(amount.wadToRay()))
@ -201,7 +202,7 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase {
// transfer event to track balances // transfer event to track balances
emit Transfer(user, address(0), amount); emit Transfer(user, address(0), amount);
emit Burn(user, amount, previousBalance, currentBalance, balanceIncrease, newStableRate); emit Burn(user, amount, currentBalance, balanceIncrease, newStableRate, nextSupply);
} }
/** /**

View File

@ -17,38 +17,38 @@ interface IStableDebtToken {
* @dev emitted when new stable debt is minted * @dev emitted when new stable debt is minted
* @param user the address of the user * @param user the address of the user
* @param amount the amount minted * @param amount the amount minted
* @param previousBalance the previous balance of the user
* @param currentBalance the current balance of the user * @param currentBalance the current balance of the user
* @param balanceIncrease the debt increase since the last update * @param balanceIncrease the the increase in balance since the last action of the user
* @param newRate the rate of the debt after the minting * @param newRate the rate of the debt after the minting
* @param avgStableRate the new average stable rate after the minting * @param avgStableRate the new average stable rate after the minting
* @param newTotalSupply the new total supply of the stable debt token after the action
**/ **/
event Mint( event Mint(
address indexed user, address indexed user,
uint256 amount, uint256 amount,
uint256 previousBalance,
uint256 currentBalance, uint256 currentBalance,
uint256 balanceIncrease, uint256 balanceIncrease,
uint256 newRate, uint256 newRate,
uint256 avgStableRate uint256 avgStableRate,
uint256 newTotalSupply
); );
/** /**
* @dev emitted when new stable debt is burned * @dev emitted when new stable debt is burned
* @param user the address of the user * @param user the address of the user
* @param amount the amount minted * @param amount the amount minted
* @param previousBalance the previous balance of the user
* @param currentBalance the current balance of the user * @param currentBalance the current balance of the user
* @param balanceIncrease the debt increase since the last update * @param balanceIncrease the the increase in balance since the last action of the user
* @param avgStableRate the new average stable rate after the minting * @param avgStableRate the new average stable rate after the minting
* @param newTotalSupply the new total supply of the stable debt token after the action
**/ **/
event Burn( event Burn(
address indexed user, address indexed user,
uint256 amount, uint256 amount,
uint256 previousBalance,
uint256 currentBalance, uint256 currentBalance,
uint256 balanceIncrease, uint256 balanceIncrease,
uint256 avgStableRate uint256 avgStableRate,
uint256 newTotalSupply
); );
/** /**