Replace revert strings with custom errors (#4261)

Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Francisco <fg@frang.io>
This commit is contained in:
Ernesto García
2023-06-12 17:41:52 -06:00
committed by GitHub
parent 08fd777f6d
commit b425a72240
138 changed files with 3220 additions and 1287 deletions

View File

@ -1,6 +1,5 @@
const { expectRevert } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const { expectRevertCustomError } = require('../../../helpers/customError');
function shouldBehaveLikeERC20Capped(accounts, cap) {
describe('capped token', function () {
@ -17,12 +16,12 @@ function shouldBehaveLikeERC20Capped(accounts, cap) {
it('fails to mint if the amount exceeds the cap', async function () {
await this.token.$_mint(user, cap.subn(1));
await expectRevert(this.token.$_mint(user, 2), 'ERC20Capped: cap exceeded');
await expectRevertCustomError(this.token.$_mint(user, 2), 'ERC20ExceededCap', [cap.addn(1), cap]);
});
it('fails to mint after cap is reached', async function () {
await this.token.$_mint(user, cap);
await expectRevert(this.token.$_mint(user, 1), 'ERC20Capped: cap exceeded');
await expectRevertCustomError(this.token.$_mint(user, 1), 'ERC20ExceededCap', [cap.addn(1), cap]);
});
});
}