mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Updated AToken, ERC20
This commit is contained in:
parent
227c0b4962
commit
b963afb0fb
|
@ -103,6 +103,8 @@ 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);
|
||||||
}
|
}
|
||||||
|
@ -121,6 +123,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(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user