Update contracts to support Solidity 0.8.x (#2442)
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
@ -87,8 +87,8 @@ function shouldBehaveLikeERC20 (errorPrefix, initialSupply, initialHolder, recip
|
||||
const amount = initialSupply.addn(1);
|
||||
|
||||
it('reverts', async function () {
|
||||
await expectRevert(this.token.transferFrom(
|
||||
tokenOwner, to, amount, { from: spender }), `${errorPrefix}: transfer amount exceeds balance`,
|
||||
await expectRevert.unspecified(this.token.transferFrom(
|
||||
tokenOwner, to, amount, { from: spender }),
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -103,8 +103,8 @@ function shouldBehaveLikeERC20 (errorPrefix, initialSupply, initialHolder, recip
|
||||
const amount = initialSupply;
|
||||
|
||||
it('reverts', async function () {
|
||||
await expectRevert(this.token.transferFrom(
|
||||
tokenOwner, to, amount, { from: spender }), `${errorPrefix}: transfer amount exceeds allowance`,
|
||||
await expectRevert.unspecified(this.token.transferFrom(
|
||||
tokenOwner, to, amount, { from: spender }),
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -113,8 +113,8 @@ function shouldBehaveLikeERC20 (errorPrefix, initialSupply, initialHolder, recip
|
||||
const amount = initialSupply.addn(1);
|
||||
|
||||
it('reverts', async function () {
|
||||
await expectRevert(this.token.transferFrom(
|
||||
tokenOwner, to, amount, { from: spender }), `${errorPrefix}: transfer amount exceeds balance`,
|
||||
await expectRevert.unspecified(this.token.transferFrom(
|
||||
tokenOwner, to, amount, { from: spender }),
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -165,8 +165,8 @@ function shouldBehaveLikeERC20Transfer (errorPrefix, from, to, balance, transfer
|
||||
const amount = balance.addn(1);
|
||||
|
||||
it('reverts', async function () {
|
||||
await expectRevert(transfer.call(this, from, to, amount),
|
||||
`${errorPrefix}: transfer amount exceeds balance`,
|
||||
await expectRevert.unspecified(transfer.call(this, from, to, amount),
|
||||
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@ -53,8 +53,8 @@ contract('ERC20', function (accounts) {
|
||||
function shouldDecreaseApproval (amount) {
|
||||
describe('when there was no approved amount before', function () {
|
||||
it('reverts', async function () {
|
||||
await expectRevert(this.token.decreaseAllowance(
|
||||
spender, amount, { from: initialHolder }), 'ERC20: decreased allowance below zero',
|
||||
await expectRevert.unspecified(this.token.decreaseAllowance(
|
||||
spender, amount, { from: initialHolder }),
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -88,9 +88,9 @@ contract('ERC20', function (accounts) {
|
||||
});
|
||||
|
||||
it('reverts when more than the full allowance is removed', async function () {
|
||||
await expectRevert(
|
||||
await expectRevert.unspecified(
|
||||
this.token.decreaseAllowance(spender, approvedAmount.addn(1), { from: initialHolder }),
|
||||
'ERC20: decreased allowance below zero',
|
||||
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -114,8 +114,8 @@ contract('ERC20', function (accounts) {
|
||||
const spender = ZERO_ADDRESS;
|
||||
|
||||
it('reverts', async function () {
|
||||
await expectRevert(this.token.decreaseAllowance(
|
||||
spender, amount, { from: initialHolder }), 'ERC20: decreased allowance below zero',
|
||||
await expectRevert.unspecified(this.token.decreaseAllowance(
|
||||
spender, amount, { from: initialHolder }),
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -247,8 +247,8 @@ contract('ERC20', function (accounts) {
|
||||
|
||||
describe('for a non zero account', function () {
|
||||
it('rejects burning more than balance', async function () {
|
||||
await expectRevert(this.token.burn(
|
||||
initialHolder, initialSupply.addn(1)), 'ERC20: burn amount exceeds balance',
|
||||
await expectRevert.unspecified(this.token.burn(
|
||||
initialHolder, initialSupply.addn(1)),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@ -93,9 +93,9 @@ function shouldOnlyRevertOnErrors () {
|
||||
});
|
||||
|
||||
it('reverts when decreasing the allowance', async function () {
|
||||
await expectRevert(
|
||||
await expectRevert.unspecified(
|
||||
this.wrapper.decreaseAllowance(10),
|
||||
'SafeERC20: decreased allowance below zero',
|
||||
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -125,9 +125,8 @@ function shouldOnlyRevertOnErrors () {
|
||||
});
|
||||
|
||||
it('reverts when decreasing the allowance to a negative value', async function () {
|
||||
await expectRevert(
|
||||
await expectRevert.unspecified(
|
||||
this.wrapper.decreaseAllowance(200),
|
||||
'SafeERC20: decreased allowance below zero',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@ -37,8 +37,8 @@ function shouldBehaveLikeERC20Burnable (owner, initialBalance, [burner]) {
|
||||
const amount = initialBalance.addn(1);
|
||||
|
||||
it('reverts', async function () {
|
||||
await expectRevert(this.token.burn(amount, { from: owner }),
|
||||
'ERC20: burn amount exceeds balance',
|
||||
await expectRevert.unspecified(this.token.burn(amount, { from: owner }),
|
||||
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -86,8 +86,8 @@ function shouldBehaveLikeERC20Burnable (owner, initialBalance, [burner]) {
|
||||
|
||||
it('reverts', async function () {
|
||||
await this.token.approve(burner, amount, { from: owner });
|
||||
await expectRevert(this.token.burnFrom(owner, amount, { from: burner }),
|
||||
'ERC20: burn amount exceeds balance',
|
||||
await expectRevert.unspecified(this.token.burnFrom(owner, amount, { from: burner }),
|
||||
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -97,8 +97,8 @@ function shouldBehaveLikeERC20Burnable (owner, initialBalance, [burner]) {
|
||||
|
||||
it('reverts', async function () {
|
||||
await this.token.approve(burner, allowance, { from: owner });
|
||||
await expectRevert(this.token.burnFrom(owner, allowance.addn(1), { from: burner }),
|
||||
'ERC20: burn amount exceeds allowance',
|
||||
await expectRevert.unspecified(this.token.burnFrom(owner, allowance.addn(1), { from: burner }),
|
||||
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user