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';
|
|
|
|
import {getContract} from '../helpers/contracts-helpers';
|
|
|
|
import {VariableDebtToken} from '../types/VariableDebtToken';
|
|
|
|
|
|
|
|
makeSuite('Variable debt token tests', (testEnv: TestEnv) => {
|
2020-07-09 14:46:49 +00:00
|
|
|
const {INVALID_POOL_CALLER_MSG_1} = ProtocolErrors;
|
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
it('Tries to invoke mint not being the LendingPool', async () => {
|
2020-07-09 14:46:49 +00:00
|
|
|
const {deployer, pool, dai} = testEnv;
|
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
const daiVariableDebtTokenAddress = (await pool.getReserveTokensAddresses(dai.address))
|
|
|
|
.variableDebtTokenAddress;
|
2020-07-09 14:46:49 +00:00
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
const variableDebtContract = await getContract<VariableDebtToken>(
|
|
|
|
eContractid.VariableDebtToken,
|
|
|
|
daiVariableDebtTokenAddress
|
|
|
|
);
|
2020-07-09 14:46:49 +00:00
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
await expect(variableDebtContract.mint(deployer.address, '1')).to.be.revertedWith(
|
2020-07-09 14:46:49 +00:00
|
|
|
INVALID_POOL_CALLER_MSG_1
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
it('Tries to invoke burn not being the LendingPool', async () => {
|
2020-07-09 14:46:49 +00:00
|
|
|
const {deployer, pool, dai} = testEnv;
|
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
const daiVariableDebtTokenAddress = (await pool.getReserveTokensAddresses(dai.address))
|
|
|
|
.variableDebtTokenAddress;
|
2020-07-09 14:46:49 +00:00
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
const variableDebtContract = await getContract<VariableDebtToken>(
|
|
|
|
eContractid.VariableDebtToken,
|
|
|
|
daiVariableDebtTokenAddress
|
|
|
|
);
|
2020-07-09 14:46:49 +00:00
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
await expect(variableDebtContract.burn(deployer.address, '1')).to.be.revertedWith(
|
2020-07-09 14:46:49 +00:00
|
|
|
INVALID_POOL_CALLER_MSG_1
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|