Add a _spendAllowance function to ERC20 & ERC777 (#3170)

This commit is contained in:
Hadrien Croubois
2022-02-09 16:26:53 +01:00
committed by GitHub
parent 63b466901f
commit c5a6cae898
7 changed files with 53 additions and 26 deletions

View File

@ -108,7 +108,7 @@ function shouldBehaveLikeERC20 (errorPrefix, initialSupply, initialHolder, recip
it('reverts', async function () {
await expectRevert(
this.token.transferFrom(tokenOwner, to, amount, { from: spender }),
`${errorPrefix}: transfer amount exceeds allowance`,
`${errorPrefix}: insufficient allowance`,
);
});
});

View File

@ -98,7 +98,7 @@ 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',
'ERC20: insufficient allowance',
);
});
});

View File

@ -59,7 +59,7 @@ contract('ERC20', function (accounts) {
it('missing approval', async function () {
await expectRevert(
this.token.depositFor(initialHolder, initialSupply, { from: initialHolder }),
'ERC20: transfer amount exceeds allowance',
'ERC20: insufficient allowance',
);
});