2021-02-07 03:10:29 +00:00
|
|
|
import { expect } from 'chai';
|
|
|
|
import { makeSuite, TestEnv } from './helpers/make-suite';
|
|
|
|
import { ProtocolErrors } from '../../helpers/types';
|
|
|
|
import { getStableDebtToken } from '../../helpers/contracts-getters';
|
|
|
|
|
|
|
|
makeSuite('Stable 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 daiStableDebtTokenAddress = (await helpersContract.getReserveTokensAddresses(dai.address))
|
|
|
|
.stableDebtTokenAddress;
|
|
|
|
|
|
|
|
const stableDebtContract = await getStableDebtToken(daiStableDebtTokenAddress);
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
stableDebtContract.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, dai, helpersContract } = testEnv;
|
|
|
|
|
|
|
|
const daiStableDebtTokenAddress = (await helpersContract.getReserveTokensAddresses(dai.address))
|
|
|
|
.stableDebtTokenAddress;
|
|
|
|
|
|
|
|
const stableDebtContract = await getStableDebtToken(daiStableDebtTokenAddress);
|
|
|
|
|
|
|
|
const name = await stableDebtContract.name();
|
|
|
|
|
2021-02-08 16:24:01 +00:00
|
|
|
expect(name).to.be.equal('Aave stable debt bearing LpDAI');
|
2021-02-07 03:10:29 +00:00
|
|
|
await expect(stableDebtContract.burn(deployer.address, '1')).to.be.revertedWith(
|
|
|
|
CT_CALLER_MUST_BE_LENDING_POOL
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|