2020-07-13 08:54:08 +00:00
|
|
|
import {expect} from 'chai';
|
|
|
|
import {makeSuite, TestEnv} from './helpers/make-suite';
|
|
|
|
import {ProtocolErrors, TokenContractId, eContractid} from '../helpers/types';
|
2020-10-30 12:40:06 +00:00
|
|
|
import {getVariableDebtToken} from '../helpers/contracts-getters';
|
2020-07-13 08:54:08 +00:00
|
|
|
|
|
|
|
makeSuite('Variable debt token tests', (testEnv: TestEnv) => {
|
2020-10-14 09:03:32 +00:00
|
|
|
const {AT_CALLER_MUST_BE_LENDING_POOL} = ProtocolErrors;
|
2020-07-09 14:46:49 +00:00
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
it('Tries to invoke mint not being the LendingPool', async () => {
|
2020-10-12 18:07:17 +00:00
|
|
|
const {deployer, pool, dai, helpersContract} = testEnv;
|
2020-07-09 14:46:49 +00:00
|
|
|
|
2020-10-12 18:07:17 +00:00
|
|
|
const daiVariableDebtTokenAddress = (
|
|
|
|
await helpersContract.getReserveTokensAddresses(dai.address)
|
|
|
|
).variableDebtTokenAddress;
|
2020-07-09 14:46:49 +00:00
|
|
|
|
2020-10-30 12:40:06 +00:00
|
|
|
const variableDebtContract = await getVariableDebtToken(daiVariableDebtTokenAddress);
|
2020-07-09 14:46:49 +00:00
|
|
|
|
2020-09-14 13:09:16 +00:00
|
|
|
await expect(variableDebtContract.mint(deployer.address, '1', '1')).to.be.revertedWith(
|
2020-10-14 09:03:32 +00:00
|
|
|
AT_CALLER_MUST_BE_LENDING_POOL
|
2020-07-09 14:46:49 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
it('Tries to invoke burn not being the LendingPool', async () => {
|
2020-10-12 18:07:17 +00:00
|
|
|
const {deployer, pool, dai, helpersContract} = testEnv;
|
2020-07-09 14:46:49 +00:00
|
|
|
|
2020-10-12 18:07:17 +00:00
|
|
|
const daiVariableDebtTokenAddress = (
|
|
|
|
await helpersContract.getReserveTokensAddresses(dai.address)
|
|
|
|
).variableDebtTokenAddress;
|
2020-07-09 14:46:49 +00:00
|
|
|
|
2020-10-30 12:40:06 +00:00
|
|
|
const variableDebtContract = await getVariableDebtToken(daiVariableDebtTokenAddress);
|
2020-07-09 14:46:49 +00:00
|
|
|
|
2020-09-14 13:09:16 +00:00
|
|
|
await expect(variableDebtContract.burn(deployer.address, '1', '1')).to.be.revertedWith(
|
2020-10-14 09:03:32 +00:00
|
|
|
AT_CALLER_MUST_BE_LENDING_POOL
|
2020-07-09 14:46:49 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|