From 9afc1d002a95005c862fc3535e14cd950b41b7a5 Mon Sep 17 00:00:00 2001 From: David Racero Date: Thu, 15 Apr 2021 17:33:15 +0200 Subject: [PATCH] Add Initialized event at aToken and Debt Token Base to match interfaces in newer versions of Aave Protocol. --- contracts/interfaces/IAToken.sol | 22 +++++++++++++++++ contracts/interfaces/IDebtTokenBase.sol | 24 +++++++++++++++++++ contracts/protocol/tokenization/AToken.sol | 11 +++++++++ .../tokenization/base/DebtTokenBase.sol | 14 ++++++++++- 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 contracts/interfaces/IDebtTokenBase.sol diff --git a/contracts/interfaces/IAToken.sol b/contracts/interfaces/IAToken.sol index 72f5ad3a..cbe1cbb8 100644 --- a/contracts/interfaces/IAToken.sol +++ b/contracts/interfaces/IAToken.sol @@ -14,6 +14,28 @@ interface IAToken is IERC20, IScaledBalanceToken { **/ 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` * @param user The address receiving the minted tokens diff --git a/contracts/interfaces/IDebtTokenBase.sol b/contracts/interfaces/IDebtTokenBase.sol new file mode 100644 index 00000000..e5e4ed9c --- /dev/null +++ b/contracts/interfaces/IDebtTokenBase.sol @@ -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 + ); +} diff --git a/contracts/protocol/tokenization/AToken.sol b/contracts/protocol/tokenization/AToken.sol index a695857d..545d68b1 100644 --- a/contracts/protocol/tokenization/AToken.sol +++ b/contracts/protocol/tokenization/AToken.sol @@ -84,6 +84,17 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken { _setName(tokenName); _setSymbol(tokenSymbol); _setDecimals(underlyingAssetDecimals); + + emit Initialized( + UNDERLYING_ASSET_ADDRESS, + address(POOL), + RESERVE_TREASURY_ADDRESS, + address(_incentivesController), + underlyingAssetDecimals, + tokenName, + tokenSymbol, + '' + ); } /** diff --git a/contracts/protocol/tokenization/base/DebtTokenBase.sol b/contracts/protocol/tokenization/base/DebtTokenBase.sol index 07bdef22..59b6dd8e 100644 --- a/contracts/protocol/tokenization/base/DebtTokenBase.sol +++ b/contracts/protocol/tokenization/base/DebtTokenBase.sol @@ -3,6 +3,7 @@ pragma solidity 0.6.12; import {ILendingPool} from '../../../interfaces/ILendingPool.sol'; import {ICreditDelegationToken} from '../../../interfaces/ICreditDelegationToken.sol'; +import {IDebtTokenBase} from '../../../interfaces/IDebtTokenBase.sol'; import { VersionedInitializable } from '../../libraries/aave-upgradeability/VersionedInitializable.sol'; @@ -18,7 +19,8 @@ import {Errors} from '../../libraries/helpers/Errors.sol'; abstract contract DebtTokenBase is IncentivizedERC20, VersionedInitializable, - ICreditDelegationToken + ICreditDelegationToken, + IDebtTokenBase { address public immutable UNDERLYING_ASSET_ADDRESS; ILendingPool public immutable POOL; @@ -62,6 +64,16 @@ abstract contract DebtTokenBase is _setName(name); _setSymbol(symbol); _setDecimals(decimals); + + emit Initialized( + UNDERLYING_ASSET_ADDRESS, + address(POOL), + address(_incentivesController), + decimals, + name, + symbol, + '' + ); } /**