diff --git a/test/delegation-aware-atoken.spec.ts b/test/delegation-aware-atoken.spec.ts index 0e782495..4d252dc7 100644 --- a/test/delegation-aware-atoken.spec.ts +++ b/test/delegation-aware-atoken.spec.ts @@ -33,7 +33,7 @@ makeSuite('AToken: underlying delegation', (testEnv: TestEnv) => { delegationERC20 = await deployMintableDelegationERC20(['DEL', 'DEL', '18']); delegationAToken = await deployDelegationAwareAToken( - [pool.address, delegationERC20.address, ZERO_ADDRESS, 'aDEL', 'aDEL', ZERO_ADDRESS], + [pool.address, delegationERC20.address, ZERO_ADDRESS, ZERO_ADDRESS, 'aDEL', 'aDEL'], false ); }); diff --git a/test/upgradeability.spec.ts b/test/upgradeability.spec.ts index 28e1c335..95e3a8fe 100644 --- a/test/upgradeability.spec.ts +++ b/test/upgradeability.spec.ts @@ -10,6 +10,7 @@ import { getAToken, getMockStableDebtToken, getMockVariableDebtToken, + getStableDebtToken, getVariableDebtToken, } from '../helpers/contracts-getters'; import { @@ -30,25 +31,25 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => { pool.address, dai.address, ZERO_ADDRESS, + ZERO_ADDRESS, 'Aave Interest bearing DAI updated', 'aDAI', - ZERO_ADDRESS, ]); const stableDebtTokenInstance = await deployMockStableDebtToken([ pool.address, dai.address, + ZERO_ADDRESS, 'Aave stable debt bearing DAI updated', 'stableDebtDAI', - ZERO_ADDRESS, ]); const variableDebtTokenInstance = await deployMockVariableDebtToken([ pool.address, dai.address, + ZERO_ADDRESS, 'Aave variable debt bearing DAI updated', 'variableDebtDAI', - ZERO_ADDRESS, ]); newATokenAddress = aTokenInstance.address; @@ -59,8 +60,26 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => { it('Tries to update the DAI Atoken implementation with a different address than the lendingPoolManager', async () => { const { dai, configurator, users } = testEnv; + const name = await (await getAToken(newATokenAddress)).name(); + const symbol = await (await getAToken(newATokenAddress)).symbol(); + + const updateATokenInputParams: { + asset: string; + treasury: string; + incentivesController: string; + name: string; + symbol: string; + implementation: string; + } = { + asset: dai.address, + treasury: ZERO_ADDRESS, + incentivesController: ZERO_ADDRESS, + name: name, + symbol: symbol, + implementation: newATokenAddress, + }; await expect( - configurator.connect(users[1].signer).updateAToken(dai.address, newATokenAddress) + configurator.connect(users[1].signer).updateAToken(updateATokenInputParams) ).to.be.revertedWith(CALLER_NOT_POOL_ADMIN); }); @@ -68,8 +87,24 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => { const { dai, configurator, aDai } = testEnv; const name = await (await getAToken(newATokenAddress)).name(); + const symbol = await (await getAToken(newATokenAddress)).symbol(); - await configurator.updateAToken(dai.address, newATokenAddress); + const updateATokenInputParams: { + asset: string; + treasury: string; + incentivesController: string; + name: string; + symbol: string; + implementation: string; + } = { + asset: dai.address, + treasury: ZERO_ADDRESS, + incentivesController: ZERO_ADDRESS, + name: name, + symbol: symbol, + implementation: newATokenAddress, + }; + await configurator.updateAToken(updateATokenInputParams); const tokenName = await aDai.name(); @@ -79,19 +114,53 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => { it('Tries to update the DAI Stable debt token implementation with a different address than the lendingPoolManager', async () => { const { dai, configurator, users } = testEnv; + const name = await (await getStableDebtToken(newStableTokenAddress)).name(); + const symbol = await (await getStableDebtToken(newStableTokenAddress)).symbol(); + + + const updateDebtTokenInput: { + asset: string; + incentivesController: string; + name: string; + symbol: string; + implementation: string; + } = { + asset: dai.address, + incentivesController: ZERO_ADDRESS, + name: name, + symbol: symbol, + implementation: newStableTokenAddress, + } + await expect( configurator .connect(users[1].signer) - .updateStableDebtToken(dai.address, newStableTokenAddress) + .updateStableDebtToken(updateDebtTokenInput) ).to.be.revertedWith(CALLER_NOT_POOL_ADMIN); }); it('Upgrades the DAI stable debt token implementation ', async () => { const { dai, configurator, pool, helpersContract } = testEnv; - const name = await (await getAToken(newATokenAddress)).name(); + const name = await (await getStableDebtToken(newStableTokenAddress)).name(); + const symbol = await (await getStableDebtToken(newStableTokenAddress)).symbol(); - await configurator.updateStableDebtToken(dai.address, newStableTokenAddress); + + const updateDebtTokenInput: { + asset: string; + incentivesController: string; + name: string; + symbol: string; + implementation: string; + } = { + asset: dai.address, + incentivesController: ZERO_ADDRESS, + name: name, + symbol: symbol, + implementation: newStableTokenAddress, + } + + await configurator.updateStableDebtToken(updateDebtTokenInput); const { stableDebtTokenAddress } = await helpersContract.getReserveTokensAddresses(dai.address); @@ -103,21 +172,54 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => { }); it('Tries to update the DAI variable debt token implementation with a different address than the lendingPoolManager', async () => { - const { dai, configurator, users } = testEnv; + const {dai, configurator, users} = testEnv; + + const name = await (await getVariableDebtToken(newVariableTokenAddress)).name(); + const symbol = await (await getVariableDebtToken(newVariableTokenAddress)).symbol(); + + const updateDebtTokenInput: { + asset: string; + incentivesController: string; + name: string; + symbol: string; + implementation: string; + } = { + asset: dai.address, + incentivesController: ZERO_ADDRESS, + name: name, + symbol: symbol, + implementation: newVariableTokenAddress, + } await expect( configurator .connect(users[1].signer) - .updateVariableDebtToken(dai.address, newVariableTokenAddress) + .updateVariableDebtToken(updateDebtTokenInput) ).to.be.revertedWith(CALLER_NOT_POOL_ADMIN); }); it('Upgrades the DAI variable debt token implementation ', async () => { - const { dai, configurator, pool, helpersContract } = testEnv; + const {dai, configurator, pool, helpersContract} = testEnv; + + const name = await (await getVariableDebtToken(newVariableTokenAddress)).name(); + const symbol = await (await getVariableDebtToken(newVariableTokenAddress)).symbol(); + + const updateDebtTokenInput: { + asset: string; + incentivesController: string; + name: string; + symbol: string; + implementation: string; + } = { + asset: dai.address, + incentivesController: ZERO_ADDRESS, + name: name, + symbol: symbol, + implementation: newVariableTokenAddress, + } + //const name = await (await getAToken(newATokenAddress)).name(); - const name = await (await getAToken(newATokenAddress)).name(); - - await configurator.updateVariableDebtToken(dai.address, newVariableTokenAddress); + await configurator.updateVariableDebtToken(updateDebtTokenInput); const { variableDebtTokenAddress } = await helpersContract.getReserveTokensAddresses( dai.address