diff --git a/contracts/mocks/upgradeability/MockStableDebtToken.sol b/contracts/mocks/upgradeability/MockStableDebtToken.sol new file mode 100644 index 00000000..f97cc1bc --- /dev/null +++ b/contracts/mocks/upgradeability/MockStableDebtToken.sol @@ -0,0 +1,19 @@ +pragma solidity ^0.6.8; + +import {StableDebtToken} from '../../tokenization/StableDebtToken.sol'; +import {LendingPool} from '../../lendingpool/LendingPool.sol'; +import '@nomiclabs/buidler/console.sol'; + +contract MockStableDebtToken is StableDebtToken { + constructor( + address _pool, + address _underlyingAssetAddress, + string memory _tokenName, + string memory _tokenSymbol + ) public StableDebtToken(_pool, _underlyingAssetAddress, _tokenName, _tokenSymbol) {} + + function getRevision() internal override pure returns (uint256) { + return 0x2; + } + +} diff --git a/contracts/mocks/upgradeability/MockVariableDebtToken.sol b/contracts/mocks/upgradeability/MockVariableDebtToken.sol new file mode 100644 index 00000000..53478761 --- /dev/null +++ b/contracts/mocks/upgradeability/MockVariableDebtToken.sol @@ -0,0 +1,19 @@ +pragma solidity ^0.6.8; + +import {VariableDebtToken} from '../../tokenization/VariableDebtToken.sol'; +import {LendingPool} from '../../lendingpool/LendingPool.sol'; +import '@nomiclabs/buidler/console.sol'; + +contract MockVariableDebtToken is VariableDebtToken { + constructor( + address _pool, + address _underlyingAssetAddress, + string memory _tokenName, + string memory _tokenSymbol + ) public VariableDebtToken(_pool, _underlyingAssetAddress, _tokenName, _tokenSymbol) {} + + function getRevision() internal override pure returns (uint256) { + return 0x2; + } + +} diff --git a/contracts/tokenization/StableDebtToken.sol b/contracts/tokenization/StableDebtToken.sol index 16b33b28..6fc51b6f 100644 --- a/contracts/tokenization/StableDebtToken.sol +++ b/contracts/tokenization/StableDebtToken.sol @@ -68,16 +68,18 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase { uint256 _balanceIncrease ); - constructor(address _pool, address _underlyingAsset) - public - DebtTokenBase(_pool, _underlyingAsset) - {} + constructor( + address _pool, + address _underlyingAsset, + string memory _name, + string memory _symbol + ) public DebtTokenBase(_pool, _underlyingAsset, _name, _symbol) {} /** * @dev gets the revision of the stable debt token implementation * @return the debt token implementation revision **/ - function getRevision() internal override pure returns(uint256) { + function getRevision() internal virtual override pure returns (uint256) { return DEBT_TOKEN_REVISION; } diff --git a/contracts/tokenization/VariableDebtToken.sol b/contracts/tokenization/VariableDebtToken.sol index 34364b06..1e25ebfe 100644 --- a/contracts/tokenization/VariableDebtToken.sol +++ b/contracts/tokenization/VariableDebtToken.sol @@ -60,20 +60,21 @@ contract VariableDebtToken is DebtTokenBase, IVariableDebtToken { uint256 _index ); - constructor(address _pool, address _underlyingAsset) - public - DebtTokenBase(_pool, _underlyingAsset) - {} + constructor( + address _pool, + address _underlyingAsset, + string memory _name, + string memory _symbol + ) public DebtTokenBase(_pool, _underlyingAsset, _name, _symbol) {} /** * @dev gets the revision of the stable debt token implementation * @return the debt token implementation revision **/ - function getRevision() internal virtual override pure returns(uint256) { + function getRevision() internal virtual override pure returns (uint256) { return DEBT_TOKEN_REVISION; } - /** * @dev calculates the accumulated debt balance of the user * @return the debt balance of the user diff --git a/contracts/tokenization/base/DebtTokenBase.sol b/contracts/tokenization/base/DebtTokenBase.sol index 10b7149b..d2f4b064 100644 --- a/contracts/tokenization/base/DebtTokenBase.sol +++ b/contracts/tokenization/base/DebtTokenBase.sol @@ -6,7 +6,9 @@ import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol'; import {Address} from '@openzeppelin/contracts/utils/Address.sol'; import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol'; import {LendingPool} from '../../lendingpool/LendingPool.sol'; -import {VersionedInitializable} from '../../libraries/openzeppelin-upgradeability/VersionedInitializable.sol'; +import { + VersionedInitializable +} from '../../libraries/openzeppelin-upgradeability/VersionedInitializable.sol'; /** * @title contract DebtTokenBase @@ -36,10 +38,18 @@ abstract contract DebtTokenBase is IERC20, VersionedInitializable { _; } - constructor(address _pool, address _underlyingAssetAddress) public { + constructor( + address _pool, + address _underlyingAssetAddress, + string memory _name, + string memory _symbol + ) public { pool = LendingPool(payable(_pool)); - underlyingAssetAddress = _underlyingAssetAddress; + underlyingAssetAddress = _underlyingAssetAddress; + name = _name; + symbol = _symbol; } + /** * @dev initializes the debt token. * @param _name the name of the token diff --git a/helpers/contracts-helpers.ts b/helpers/contracts-helpers.ts index 626a34bd..788450d8 100644 --- a/helpers/contracts-helpers.ts +++ b/helpers/contracts-helpers.ts @@ -256,13 +256,14 @@ export const deployDefaultReserveInterestRateStrategy = async ([ export const deployStableDebtToken = async ([ name, symbol, - decimals, underlyingAsset, poolAddress, ]: [string, string, string, tEthereumAddress, tEthereumAddress]) => { const token = await deployContract(eContractid.StableDebtToken, [ poolAddress, underlyingAsset, + name, + symbol ]); return token; @@ -271,13 +272,14 @@ export const deployStableDebtToken = async ([ export const deployVariableDebtToken = async ([ name, symbol, - decimals, underlyingAsset, poolAddress, ]: [string, string, string, tEthereumAddress, tEthereumAddress]) => { const token = await deployContract(eContractid.VariableDebtToken, [ poolAddress, underlyingAsset, + name, + symbol ]); return token; diff --git a/test/__setup.spec.ts b/test/__setup.spec.ts index e3d0b358..04d7992c 100644 --- a/test/__setup.spec.ts +++ b/test/__setup.spec.ts @@ -224,7 +224,6 @@ const initReserves = async ( const stableDebtToken = await deployStableDebtToken([ `Aave stable debt bearing ${assetSymbol === "WETH" ? "ETH" : assetSymbol}`, `stableDebt${assetSymbol === "WETH" ? "ETH" : assetSymbol}`, - reserveDecimals, tokenAddress, lendingPool.address, ]); @@ -232,7 +231,6 @@ const initReserves = async ( const variableDebtToken = await deployVariableDebtToken([ `Aave variable debt bearing ${assetSymbol === "WETH" ? "ETH" : assetSymbol}`, `variableDebt${assetSymbol === "WETH" ? "ETH" : assetSymbol}`, - reserveDecimals, tokenAddress, lendingPool.address, ]);