2020-07-13 08:54:08 +00:00
|
|
|
import {expect} from 'chai';
|
|
|
|
import {makeSuite, TestEnv} from './helpers/make-suite';
|
|
|
|
import {ProtocolErrors} from '../helpers/types';
|
2020-06-08 12:03:40 +00:00
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
makeSuite('AToken: Modifiers', (testEnv: TestEnv) => {
|
2020-09-02 13:48:38 +00:00
|
|
|
const {CALLER_MUST_BE_LENDING_POOL} = ProtocolErrors;
|
2020-06-08 12:03:40 +00:00
|
|
|
|
2020-08-19 10:56:39 +00:00
|
|
|
it('Tries to invoke mint not being the LendingPool', async () => {
|
2020-06-12 07:41:30 +00:00
|
|
|
const {deployer, aDai} = testEnv;
|
2020-09-14 13:53:34 +00:00
|
|
|
await expect(aDai.mint(deployer.address, '1', '1')).to.be.revertedWith(
|
|
|
|
CALLER_MUST_BE_LENDING_POOL
|
|
|
|
);
|
2020-06-08 15:36:40 +00:00
|
|
|
});
|
2020-06-08 12:03:40 +00:00
|
|
|
|
2020-08-19 10:56:39 +00:00
|
|
|
it('Tries to invoke burn not being the LendingPool', async () => {
|
2020-06-12 07:41:30 +00:00
|
|
|
const {deployer, aDai} = testEnv;
|
2020-09-12 11:18:17 +00:00
|
|
|
await expect(aDai.burn(deployer.address, deployer.address, '1', '1')).to.be.revertedWith(
|
2020-09-02 13:48:38 +00:00
|
|
|
CALLER_MUST_BE_LENDING_POOL
|
2020-07-13 08:54:08 +00:00
|
|
|
);
|
2020-06-08 19:06:26 +00:00
|
|
|
});
|
2020-06-08 15:36:40 +00:00
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
it('Tries to invoke transferOnLiquidation not being the LendingPool', async () => {
|
2020-06-12 07:41:30 +00:00
|
|
|
const {deployer, users, aDai} = testEnv;
|
2020-06-08 19:06:26 +00:00
|
|
|
await expect(
|
2020-07-13 08:54:08 +00:00
|
|
|
aDai.transferOnLiquidation(deployer.address, users[0].address, '1')
|
2020-09-02 13:48:38 +00:00
|
|
|
).to.be.revertedWith(CALLER_MUST_BE_LENDING_POOL);
|
2020-06-08 19:06:26 +00:00
|
|
|
});
|
2020-07-13 14:43:26 +00:00
|
|
|
|
|
|
|
it('Tries to invoke transferUnderlyingTo not being the LendingPool', async () => {
|
|
|
|
const {deployer, users, aDai} = testEnv;
|
|
|
|
await expect(aDai.transferUnderlyingTo(deployer.address, '1')).to.be.revertedWith(
|
2020-09-02 13:48:38 +00:00
|
|
|
CALLER_MUST_BE_LENDING_POOL
|
2020-07-13 14:43:26 +00:00
|
|
|
);
|
|
|
|
});
|
2020-06-08 15:36:40 +00:00
|
|
|
});
|