Approval events on transferFrom and burnFrom (#1524)

* transferFrom now emits an Approval event, indicating the updated allowance.

* Updated burnFrom to also emit Approval.

* Added notices about the extra Approval events.
This commit is contained in:
Nicolás Venturo
2018-11-29 12:06:47 -03:00
committed by GitHub
parent 6407d7818d
commit 7ef2730506
2 changed files with 31 additions and 4 deletions

View File

@ -199,6 +199,16 @@ contract('ERC20', function ([_, owner, recipient, anotherAccount]) {
value: amount,
});
});
it('emits an approval event', async function () {
const { logs } = await this.token.transferFrom(owner, to, amount, { from: spender });
expectEvent.inLogs(logs, 'Approval', {
owner: owner,
spender: spender,
value: await this.token.allowance(owner, spender),
});
});
});
describe('when the owner does not have enough balance', function () {
@ -521,7 +531,7 @@ contract('ERC20', function ([_, owner, recipient, anotherAccount]) {
(await this.token.allowance(owner, spender)).should.be.bignumber.equal(expectedAllowance);
});
it('emits Transfer event', async function () {
it('emits a Transfer event', async function () {
const event = expectEvent.inLogs(this.logs, 'Transfer', {
from: owner,
to: ZERO_ADDRESS,
@ -529,6 +539,14 @@ contract('ERC20', function ([_, owner, recipient, anotherAccount]) {
event.args.value.should.be.bignumber.equal(amount);
});
it('emits an Approval event', async function () {
expectEvent.inLogs(this.logs, 'Approval', {
owner: owner,
spender: spender,
value: await this.token.allowance(owner, spender),
});
});
});
};