mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Merge branch 'master' into 'feat/pausable'
# Conflicts: # contracts/tokenization/AToken.sol
This commit is contained in:
commit
89ca48e0b2
|
@ -108,6 +108,9 @@ contract AToken is VersionedInitializable, ERC20, IAToken {
|
||||||
//transfers the underlying to the target
|
//transfers the underlying to the target
|
||||||
ERC20(UNDERLYING_ASSET_ADDRESS).safeTransfer(receiverOfUnderlying, amount);
|
ERC20(UNDERLYING_ASSET_ADDRESS).safeTransfer(receiverOfUnderlying, amount);
|
||||||
|
|
||||||
|
//transfer event to track balances
|
||||||
|
emit Transfer(user, address(0), amount);
|
||||||
|
|
||||||
emit Burn(msg.sender, receiverOfUnderlying, amount, index);
|
emit Burn(msg.sender, receiverOfUnderlying, amount, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,6 +130,8 @@ contract AToken is VersionedInitializable, ERC20, IAToken {
|
||||||
//mint an equivalent amount of tokens to cover the new deposit
|
//mint an equivalent amount of tokens to cover the new deposit
|
||||||
_mint(user, scaledAmount);
|
_mint(user, scaledAmount);
|
||||||
|
|
||||||
|
//transfer event to track balances
|
||||||
|
emit Transfer(address(0), user, amount);
|
||||||
emit Mint(user, amount, index);
|
emit Mint(user, amount, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,14 +9,14 @@ import {SafeMath} from '../libraries/math/SafeMath.sol';
|
||||||
/**
|
/**
|
||||||
* @title ERC20
|
* @title ERC20
|
||||||
* @notice Basic ERC20 implementation
|
* @notice Basic ERC20 implementation
|
||||||
* @author Aave
|
* @author Aave, inspired by the Openzeppelin ERC20 implementation
|
||||||
**/
|
**/
|
||||||
contract ERC20 is Context, IERC20, IERC20Detailed {
|
contract ERC20 is Context, IERC20, IERC20Detailed {
|
||||||
using SafeMath for uint256;
|
using SafeMath for uint256;
|
||||||
|
|
||||||
mapping(address => uint256) private _balances;
|
mapping(address => uint256) internal _balances;
|
||||||
mapping(address => mapping(address => uint256)) private _allowances;
|
mapping(address => mapping(address => uint256)) private _allowances;
|
||||||
uint256 private _totalSupply;
|
uint256 internal _totalSupply;
|
||||||
string private _name;
|
string private _name;
|
||||||
string private _symbol;
|
string private _symbol;
|
||||||
uint8 private _decimals;
|
uint8 private _decimals;
|
||||||
|
@ -74,6 +74,7 @@ contract ERC20 is Context, IERC20, IERC20Detailed {
|
||||||
**/
|
**/
|
||||||
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
|
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
|
||||||
_transfer(_msgSender(), recipient, amount);
|
_transfer(_msgSender(), recipient, amount);
|
||||||
|
emit Transfer(msg.sender, recipient, amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +122,7 @@ contract ERC20 is Context, IERC20, IERC20Detailed {
|
||||||
_msgSender(),
|
_msgSender(),
|
||||||
_allowances[sender][_msgSender()].sub(amount, 'ERC20: transfer amount exceeds allowance')
|
_allowances[sender][_msgSender()].sub(amount, 'ERC20: transfer amount exceeds allowance')
|
||||||
);
|
);
|
||||||
|
emit Transfer(sender, recipient, amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +171,6 @@ contract ERC20 is Context, IERC20, IERC20Detailed {
|
||||||
|
|
||||||
_balances[sender] = _balances[sender].sub(amount, 'ERC20: transfer amount exceeds balance');
|
_balances[sender] = _balances[sender].sub(amount, 'ERC20: transfer amount exceeds balance');
|
||||||
_balances[recipient] = _balances[recipient].add(amount);
|
_balances[recipient] = _balances[recipient].add(amount);
|
||||||
emit Transfer(sender, recipient, amount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _mint(address account, uint256 amount) internal virtual {
|
function _mint(address account, uint256 amount) internal virtual {
|
||||||
|
@ -179,7 +180,6 @@ contract ERC20 is Context, IERC20, IERC20Detailed {
|
||||||
|
|
||||||
_totalSupply = _totalSupply.add(amount);
|
_totalSupply = _totalSupply.add(amount);
|
||||||
_balances[account] = _balances[account].add(amount);
|
_balances[account] = _balances[account].add(amount);
|
||||||
emit Transfer(address(0), account, amount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _burn(address account, uint256 amount) internal virtual {
|
function _burn(address account, uint256 amount) internal virtual {
|
||||||
|
@ -189,7 +189,6 @@ contract ERC20 is Context, IERC20, IERC20Detailed {
|
||||||
|
|
||||||
_balances[account] = _balances[account].sub(amount, 'ERC20: burn amount exceeds balance');
|
_balances[account] = _balances[account].sub(amount, 'ERC20: burn amount exceeds balance');
|
||||||
_totalSupply = _totalSupply.sub(amount);
|
_totalSupply = _totalSupply.sub(amount);
|
||||||
emit Transfer(account, address(0), amount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _approve(
|
function _approve(
|
||||||
|
|
|
@ -132,6 +132,9 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase {
|
||||||
|
|
||||||
_mint(user, amount.add(balanceIncrease));
|
_mint(user, amount.add(balanceIncrease));
|
||||||
|
|
||||||
|
// transfer event to track balances
|
||||||
|
emit Transfer(address(0), user, amount);
|
||||||
|
|
||||||
emit MintDebt(
|
emit MintDebt(
|
||||||
user,
|
user,
|
||||||
amount,
|
amount,
|
||||||
|
@ -180,6 +183,9 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase {
|
||||||
_burn(user, amount.sub(balanceIncrease));
|
_burn(user, amount.sub(balanceIncrease));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// transfer event to track balances
|
||||||
|
emit Transfer(user, address(0), amount);
|
||||||
|
|
||||||
emit BurnDebt(user, amount, previousBalance, currentBalance, balanceIncrease);
|
emit BurnDebt(user, amount, previousBalance, currentBalance, balanceIncrease);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,7 @@ contract VariableDebtToken is DebtTokenBase, IVariableDebtToken {
|
||||||
require(newUserIndex < (1 << 128), 'Debt token: Index overflow');
|
require(newUserIndex < (1 << 128), 'Debt token: Index overflow');
|
||||||
_usersData[user] = newUserIndex;
|
_usersData[user] = newUserIndex;
|
||||||
|
|
||||||
|
emit Transfer(address(0), user, amount);
|
||||||
emit MintDebt(user, amount, previousBalance, currentBalance, balanceIncrease, newUserIndex);
|
emit MintDebt(user, amount, previousBalance, currentBalance, balanceIncrease, newUserIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +109,8 @@ contract VariableDebtToken is DebtTokenBase, IVariableDebtToken {
|
||||||
}
|
}
|
||||||
_usersData[user] = newUserIndex;
|
_usersData[user] = newUserIndex;
|
||||||
|
|
||||||
|
// transfer event to track the balances
|
||||||
|
emit Transfer(user, address(0), amount);
|
||||||
emit BurnDebt(user, amount, previousBalance, currentBalance, balanceIncrease, newUserIndex);
|
emit BurnDebt(user, amount, previousBalance, currentBalance, balanceIncrease, newUserIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user