aave-protocol-v2/test/variable-debt-token.spec.ts

44 lines
1.5 KiB
TypeScript
Raw Normal View History

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) => {
const {CALLER_MUST_BE_LENDING_POOL} = ProtocolErrors;
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-10-12 18:07:17 +00:00
const daiVariableDebtTokenAddress = (
await helpersContract.getReserveTokensAddresses(dai.address)
).variableDebtTokenAddress;
2020-07-13 08:54:08 +00:00
const variableDebtContract = await getContract<VariableDebtToken>(
eContractid.VariableDebtToken,
daiVariableDebtTokenAddress
);
2020-09-14 13:09:16 +00:00
await expect(variableDebtContract.mint(deployer.address, '1', '1')).to.be.revertedWith(
CALLER_MUST_BE_LENDING_POOL
);
});
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-10-12 18:07:17 +00:00
const daiVariableDebtTokenAddress = (
await helpersContract.getReserveTokensAddresses(dai.address)
).variableDebtTokenAddress;
2020-07-13 08:54:08 +00:00
const variableDebtContract = await getContract<VariableDebtToken>(
eContractid.VariableDebtToken,
daiVariableDebtTokenAddress
);
2020-09-14 13:09:16 +00:00
await expect(variableDebtContract.burn(deployer.address, '1', '1')).to.be.revertedWith(
CALLER_MUST_BE_LENDING_POOL
);
});
});