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-09-02 14:34:15 +00:00
|
|
|
const {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-07-13 08:54:08 +00:00
|
|
|
const variableDebtContract = await getContract<VariableDebtToken>(
|
|
|
|
eContractid.VariableDebtToken,
|
|
|
|
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-09-02 14:34:15 +00:00
|
|
|
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-07-13 08:54:08 +00:00
|
|
|
const variableDebtContract = await getContract<VariableDebtToken>(
|
|
|
|
eContractid.VariableDebtToken,
|
|
|
|
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-09-02 14:34:15 +00:00
|
|
|
CALLER_MUST_BE_LENDING_POOL
|
2020-07-09 14:46:49 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|