aave-protocol-v2/test-suites/test-amm/variable-debt-token.spec.ts
2021-02-23 10:59:02 -05:00

37 lines
1.4 KiB
TypeScript

import { expect } from 'chai';
import { makeSuite, TestEnv } from './helpers/make-suite';
import { ProtocolErrors, TokenContractId, eContractid } from '../../helpers/types';
import { getVariableDebtToken } from '../../helpers/contracts-getters';
makeSuite('Variable debt token tests', (testEnv: TestEnv) => {
const { CT_CALLER_MUST_BE_LENDING_POOL } = ProtocolErrors;
it('Tries to invoke mint not being the LendingPool', async () => {
const { deployer, pool, dai, helpersContract } = testEnv;
const daiVariableDebtTokenAddress = (
await helpersContract.getReserveTokensAddresses(dai.address)
).variableDebtTokenAddress;
const variableDebtContract = await getVariableDebtToken(daiVariableDebtTokenAddress);
await expect(
variableDebtContract.mint(deployer.address, deployer.address, '1', '1')
).to.be.revertedWith(CT_CALLER_MUST_BE_LENDING_POOL);
});
it('Tries to invoke burn not being the LendingPool', async () => {
const { deployer, pool, dai, helpersContract } = testEnv;
const daiVariableDebtTokenAddress = (
await helpersContract.getReserveTokensAddresses(dai.address)
).variableDebtTokenAddress;
const variableDebtContract = await getVariableDebtToken(daiVariableDebtTokenAddress);
await expect(variableDebtContract.burn(deployer.address, '1', '1')).to.be.revertedWith(
CT_CALLER_MUST_BE_LENDING_POOL
);
});
});