Add missing hook to ERC777, fix relevant documentation (#2191)
* Improve ERC20/721 Pausable docs * Add ERC20Pausable mint and burn tests * Add ERC721Pausable mint and burn tests * Add _beforeTransfer hook in ERC777 to mint and burn
This commit is contained in:
@ -78,5 +78,59 @@ describe('ERC20Pausable', function () {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('mint', function () {
|
||||
const amount = new BN('42');
|
||||
|
||||
it('allows to mint when unpaused', async function () {
|
||||
await this.token.mint(recipient, amount);
|
||||
|
||||
expect(await this.token.balanceOf(recipient)).to.be.bignumber.equal(amount);
|
||||
});
|
||||
|
||||
it('allows to mint when paused and then unpaused', async function () {
|
||||
await this.token.pause();
|
||||
await this.token.unpause();
|
||||
|
||||
await this.token.mint(recipient, amount);
|
||||
|
||||
expect(await this.token.balanceOf(recipient)).to.be.bignumber.equal(amount);
|
||||
});
|
||||
|
||||
it('reverts when trying to mint when paused', async function () {
|
||||
await this.token.pause();
|
||||
|
||||
await expectRevert(this.token.mint(recipient, amount),
|
||||
'ERC20Pausable: token transfer while paused'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('burn', function () {
|
||||
const amount = new BN('42');
|
||||
|
||||
it('allows to burn when unpaused', async function () {
|
||||
await this.token.burn(holder, amount);
|
||||
|
||||
expect(await this.token.balanceOf(holder)).to.be.bignumber.equal(initialSupply.sub(amount));
|
||||
});
|
||||
|
||||
it('allows to burn when paused and then unpaused', async function () {
|
||||
await this.token.pause();
|
||||
await this.token.unpause();
|
||||
|
||||
await this.token.burn(holder, amount);
|
||||
|
||||
expect(await this.token.balanceOf(holder)).to.be.bignumber.equal(initialSupply.sub(amount));
|
||||
});
|
||||
|
||||
it('reverts when trying to burn when paused', async function () {
|
||||
await this.token.pause();
|
||||
|
||||
await expectRevert(this.token.burn(holder, amount),
|
||||
'ERC20Pausable: token transfer while paused'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user