Add Initialized event at aToken and Debt Token Base to match interfaces in newer versions of Aave Protocol.

This commit is contained in:
David Racero 2021-04-15 17:33:15 +02:00
parent ee04de7636
commit 9afc1d002a
4 changed files with 70 additions and 1 deletions

View File

@ -14,6 +14,28 @@ interface IAToken is IERC20, IScaledBalanceToken {
**/ **/
event Mint(address indexed from, uint256 value, uint256 index); event Mint(address indexed from, uint256 value, uint256 index);
/**
* @dev Emitted when an aToken is initialized
* @param underlyingAsset The address of the underlying asset
* @param pool The address of the associated lending pool
* @param treasury The address of the treasury
* @param incentivesController The address of the incentives controller for this aToken
* @param aTokenDecimals the decimals of the underlying
* @param aTokenName the name of the aToken
* @param aTokenSymbol the symbol of the aToken
* @param params A set of encoded parameters for additional initialization
**/
event Initialized(
address indexed underlyingAsset,
address indexed pool,
address treasury,
address incentivesController,
uint8 aTokenDecimals,
string aTokenName,
string aTokenSymbol,
bytes params
);
/** /**
* @dev Mints `amount` aTokens to `user` * @dev Mints `amount` aTokens to `user`
* @param user The address receiving the minted tokens * @param user The address receiving the minted tokens

View File

@ -0,0 +1,24 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
interface IDebtTokenBase {
/**
* @dev Emitted when a debt token is initialized
* @param underlyingAsset The address of the underlying asset
* @param pool The address of the associated lending pool
* @param incentivesController The address of the incentives controller for this aToken
* @param debtTokenDecimals the decimals of the debt token
* @param debtTokenName the name of the debt token
* @param debtTokenSymbol the symbol of the debt token
* @param params A set of encoded parameters for additional initialization
**/
event Initialized(
address indexed underlyingAsset,
address indexed pool,
address incentivesController,
uint8 debtTokenDecimals,
string debtTokenName,
string debtTokenSymbol,
bytes params
);
}

View File

@ -84,6 +84,17 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken {
_setName(tokenName); _setName(tokenName);
_setSymbol(tokenSymbol); _setSymbol(tokenSymbol);
_setDecimals(underlyingAssetDecimals); _setDecimals(underlyingAssetDecimals);
emit Initialized(
UNDERLYING_ASSET_ADDRESS,
address(POOL),
RESERVE_TREASURY_ADDRESS,
address(_incentivesController),
underlyingAssetDecimals,
tokenName,
tokenSymbol,
''
);
} }
/** /**

View File

@ -3,6 +3,7 @@ pragma solidity 0.6.12;
import {ILendingPool} from '../../../interfaces/ILendingPool.sol'; import {ILendingPool} from '../../../interfaces/ILendingPool.sol';
import {ICreditDelegationToken} from '../../../interfaces/ICreditDelegationToken.sol'; import {ICreditDelegationToken} from '../../../interfaces/ICreditDelegationToken.sol';
import {IDebtTokenBase} from '../../../interfaces/IDebtTokenBase.sol';
import { import {
VersionedInitializable VersionedInitializable
} from '../../libraries/aave-upgradeability/VersionedInitializable.sol'; } from '../../libraries/aave-upgradeability/VersionedInitializable.sol';
@ -18,7 +19,8 @@ import {Errors} from '../../libraries/helpers/Errors.sol';
abstract contract DebtTokenBase is abstract contract DebtTokenBase is
IncentivizedERC20, IncentivizedERC20,
VersionedInitializable, VersionedInitializable,
ICreditDelegationToken ICreditDelegationToken,
IDebtTokenBase
{ {
address public immutable UNDERLYING_ASSET_ADDRESS; address public immutable UNDERLYING_ASSET_ADDRESS;
ILendingPool public immutable POOL; ILendingPool public immutable POOL;
@ -62,6 +64,16 @@ abstract contract DebtTokenBase is
_setName(name); _setName(name);
_setSymbol(symbol); _setSymbol(symbol);
_setDecimals(decimals); _setDecimals(decimals);
emit Initialized(
UNDERLYING_ASSET_ADDRESS,
address(POOL),
address(_incentivesController),
decimals,
name,
symbol,
''
);
} }
/** /**