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 {getContractAddress} from 'ethers/utils';
|
|
|
|
import {getContract} from '../helpers/contracts-helpers';
|
|
|
|
import {StableDebtToken} from '../types/StableDebtToken';
|
|
|
|
|
|
|
|
makeSuite('Stable debt token tests', (testEnv: TestEnv) => {
|
2020-07-09 14:27:19 +00:00
|
|
|
const {INVALID_POOL_CALLER_MSG_1} = ProtocolErrors;
|
|
|
|
|
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-07-09 14:27:19 +00:00
|
|
|
INVALID_POOL_CALLER_MSG_1
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
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-07-09 14:46:49 +00:00
|
|
|
INVALID_POOL_CALLER_MSG_1
|
|
|
|
);
|
2020-07-09 14:27:19 +00:00
|
|
|
});
|
|
|
|
});
|