2020-07-13 08:54:08 +00:00
|
|
|
import {expect} from 'chai';
|
|
|
|
import {makeSuite, TestEnv} from './helpers/make-suite';
|
2020-08-19 12:23:41 +00:00
|
|
|
import {ProtocolErrors, eContractid} from '../helpers/types';
|
2020-07-13 08:54:08 +00:00
|
|
|
import {getContract} from '../helpers/contracts-helpers';
|
|
|
|
import {StableDebtToken} from '../types/StableDebtToken';
|
|
|
|
|
|
|
|
makeSuite('Stable debt token tests', (testEnv: TestEnv) => {
|
2020-09-04 08:27:32 +00:00
|
|
|
const {CALLER_MUST_BE_LENDING_POOL} = ProtocolErrors;
|
2020-07-09 14:27:19 +00:00
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
it('Tries to invoke mint not being the LendingPool', async () => {
|
2020-07-09 14:46:49 +00:00
|
|
|
const {deployer, pool, dai} = testEnv;
|
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
const daiStableDebtTokenAddress = (await pool.getReserveTokensAddresses(dai.address))
|
|
|
|
.stableDebtTokenAddress;
|
2020-07-09 14:46:49 +00:00
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
const stableDebtContract = await getContract<StableDebtToken>(
|
|
|
|
eContractid.StableDebtToken,
|
|
|
|
daiStableDebtTokenAddress
|
|
|
|
);
|
2020-07-09 14:46:49 +00:00
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
await expect(stableDebtContract.mint(deployer.address, '1', '1')).to.be.revertedWith(
|
2020-09-04 08:27:32 +00:00
|
|
|
CALLER_MUST_BE_LENDING_POOL
|
2020-07-09 14:27:19 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
it('Tries to invoke burn not being the LendingPool', async () => {
|
2020-07-09 14:46:49 +00:00
|
|
|
const {deployer, pool, dai} = testEnv;
|
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
const daiStableDebtTokenAddress = (await pool.getReserveTokensAddresses(dai.address))
|
|
|
|
.stableDebtTokenAddress;
|
2020-07-09 14:46:49 +00:00
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
const stableDebtContract = await getContract<StableDebtToken>(
|
|
|
|
eContractid.StableDebtToken,
|
|
|
|
daiStableDebtTokenAddress
|
|
|
|
);
|
2020-07-09 14:46:49 +00:00
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
await expect(stableDebtContract.burn(deployer.address, '1')).to.be.revertedWith(
|
2020-09-04 08:27:32 +00:00
|
|
|
CALLER_MUST_BE_LENDING_POOL
|
2020-07-09 14:46:49 +00:00
|
|
|
);
|
2020-07-09 14:27:19 +00:00
|
|
|
});
|
|
|
|
});
|