aave-protocol-v2/test/stable-token.spec.ts

38 lines
1.4 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';
2020-11-12 12:54:23 +00:00
import {ProtocolErrors} from '../helpers/types';
2020-10-30 12:40:06 +00:00
import {getStableDebtToken} from '../helpers/contracts-getters';
2020-07-13 08:54:08 +00:00
makeSuite('Stable debt token tests', (testEnv: TestEnv) => {
2020-11-12 12:54:23 +00:00
const {CT_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 daiStableDebtTokenAddress = (await helpersContract.getReserveTokensAddresses(dai.address))
2020-07-13 08:54:08 +00:00
.stableDebtTokenAddress;
2020-10-30 12:40:06 +00:00
const stableDebtContract = await getStableDebtToken(daiStableDebtTokenAddress);
2020-11-03 18:47:57 +00:00
await expect(
stableDebtContract.mint(deployer.address, deployer.address, '1', '1')
2020-11-12 12:54:23 +00:00
).to.be.revertedWith(CT_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, dai, helpersContract} = testEnv;
2020-10-12 18:07:17 +00:00
const daiStableDebtTokenAddress = (await helpersContract.getReserveTokensAddresses(dai.address))
2020-07-13 08:54:08 +00:00
.stableDebtTokenAddress;
2020-10-30 12:40:06 +00:00
const stableDebtContract = await getStableDebtToken(daiStableDebtTokenAddress);
const name = await stableDebtContract.name();
expect(name).to.be.equal('Aave stable debt bearing DAI');
2020-07-13 08:54:08 +00:00
await expect(stableDebtContract.burn(deployer.address, '1')).to.be.revertedWith(
2020-11-12 12:54:23 +00:00
CT_CALLER_MUST_BE_LENDING_POOL
);
});
});