mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Updated test files
This commit is contained in:
parent
e729926543
commit
c0cb7d06a9
|
|
@ -33,7 +33,7 @@ makeSuite('AToken: underlying delegation', (testEnv: TestEnv) => {
|
||||||
delegationERC20 = await deployMintableDelegationERC20(['DEL', 'DEL', '18']);
|
delegationERC20 = await deployMintableDelegationERC20(['DEL', 'DEL', '18']);
|
||||||
|
|
||||||
delegationAToken = await deployDelegationAwareAToken(
|
delegationAToken = await deployDelegationAwareAToken(
|
||||||
[pool.address, delegationERC20.address, ZERO_ADDRESS, 'aDEL', 'aDEL', ZERO_ADDRESS],
|
[pool.address, delegationERC20.address, ZERO_ADDRESS, ZERO_ADDRESS, 'aDEL', 'aDEL'],
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import {
|
||||||
getAToken,
|
getAToken,
|
||||||
getMockStableDebtToken,
|
getMockStableDebtToken,
|
||||||
getMockVariableDebtToken,
|
getMockVariableDebtToken,
|
||||||
|
getStableDebtToken,
|
||||||
getVariableDebtToken,
|
getVariableDebtToken,
|
||||||
} from '../helpers/contracts-getters';
|
} from '../helpers/contracts-getters';
|
||||||
import {
|
import {
|
||||||
|
|
@ -30,25 +31,25 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => {
|
||||||
pool.address,
|
pool.address,
|
||||||
dai.address,
|
dai.address,
|
||||||
ZERO_ADDRESS,
|
ZERO_ADDRESS,
|
||||||
|
ZERO_ADDRESS,
|
||||||
'Aave Interest bearing DAI updated',
|
'Aave Interest bearing DAI updated',
|
||||||
'aDAI',
|
'aDAI',
|
||||||
ZERO_ADDRESS,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const stableDebtTokenInstance = await deployMockStableDebtToken([
|
const stableDebtTokenInstance = await deployMockStableDebtToken([
|
||||||
pool.address,
|
pool.address,
|
||||||
dai.address,
|
dai.address,
|
||||||
|
ZERO_ADDRESS,
|
||||||
'Aave stable debt bearing DAI updated',
|
'Aave stable debt bearing DAI updated',
|
||||||
'stableDebtDAI',
|
'stableDebtDAI',
|
||||||
ZERO_ADDRESS,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const variableDebtTokenInstance = await deployMockVariableDebtToken([
|
const variableDebtTokenInstance = await deployMockVariableDebtToken([
|
||||||
pool.address,
|
pool.address,
|
||||||
dai.address,
|
dai.address,
|
||||||
|
ZERO_ADDRESS,
|
||||||
'Aave variable debt bearing DAI updated',
|
'Aave variable debt bearing DAI updated',
|
||||||
'variableDebtDAI',
|
'variableDebtDAI',
|
||||||
ZERO_ADDRESS,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
newATokenAddress = aTokenInstance.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 () => {
|
it('Tries to update the DAI Atoken implementation with a different address than the lendingPoolManager', async () => {
|
||||||
const { dai, configurator, users } = testEnv;
|
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(
|
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);
|
).to.be.revertedWith(CALLER_NOT_POOL_ADMIN);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -68,8 +87,24 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => {
|
||||||
const { dai, configurator, aDai } = testEnv;
|
const { dai, configurator, aDai } = testEnv;
|
||||||
|
|
||||||
const name = await (await getAToken(newATokenAddress)).name();
|
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();
|
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 () => {
|
it('Tries to update the DAI Stable 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 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(
|
await expect(
|
||||||
configurator
|
configurator
|
||||||
.connect(users[1].signer)
|
.connect(users[1].signer)
|
||||||
.updateStableDebtToken(dai.address, newStableTokenAddress)
|
.updateStableDebtToken(updateDebtTokenInput)
|
||||||
).to.be.revertedWith(CALLER_NOT_POOL_ADMIN);
|
).to.be.revertedWith(CALLER_NOT_POOL_ADMIN);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Upgrades the DAI stable debt token implementation ', async () => {
|
it('Upgrades the DAI stable debt token implementation ', async () => {
|
||||||
const { dai, configurator, pool, helpersContract } = testEnv;
|
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);
|
const { stableDebtTokenAddress } = await helpersContract.getReserveTokensAddresses(dai.address);
|
||||||
|
|
||||||
|
|
@ -105,19 +174,52 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => {
|
||||||
it('Tries to update the DAI variable debt token implementation with a different address than the lendingPoolManager', async () => {
|
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(
|
await expect(
|
||||||
configurator
|
configurator
|
||||||
.connect(users[1].signer)
|
.connect(users[1].signer)
|
||||||
.updateVariableDebtToken(dai.address, newVariableTokenAddress)
|
.updateVariableDebtToken(updateDebtTokenInput)
|
||||||
).to.be.revertedWith(CALLER_NOT_POOL_ADMIN);
|
).to.be.revertedWith(CALLER_NOT_POOL_ADMIN);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Upgrades the DAI variable debt token implementation ', async () => {
|
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 getAToken(newATokenAddress)).name();
|
const name = await (await getVariableDebtToken(newVariableTokenAddress)).name();
|
||||||
|
const symbol = await (await getVariableDebtToken(newVariableTokenAddress)).symbol();
|
||||||
|
|
||||||
await configurator.updateVariableDebtToken(dai.address, newVariableTokenAddress);
|
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();
|
||||||
|
|
||||||
|
await configurator.updateVariableDebtToken(updateDebtTokenInput);
|
||||||
|
|
||||||
const { variableDebtTokenAddress } = await helpersContract.getReserveTokensAddresses(
|
const { variableDebtTokenAddress } = await helpersContract.getReserveTokensAddresses(
|
||||||
dai.address
|
dai.address
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user