Don't emit Approval event when approval is cleared on transfer (#1039)
This commit is contained in:
committed by
Matt Condon
parent
f18c3bc438
commit
dc1e352cc4
@ -299,7 +299,6 @@ contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic {
|
||||
require(ownerOf(_tokenId) == _owner);
|
||||
if (tokenApprovals[_tokenId] != address(0)) {
|
||||
tokenApprovals[_tokenId] = address(0);
|
||||
emit Approval(_owner, address(0), _tokenId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -115,17 +115,12 @@ export default function shouldBehaveLikeERC721BasicToken (accounts) {
|
||||
});
|
||||
|
||||
if (approved) {
|
||||
it('emits an approval and transfer events', async function () {
|
||||
logs.length.should.be.equal(2);
|
||||
logs[0].event.should.be.eq('Approval');
|
||||
logs[0].args._owner.should.be.equal(owner);
|
||||
logs[0].args._approved.should.be.equal(ZERO_ADDRESS);
|
||||
it('emit only a transfer event', async function () {
|
||||
logs.length.should.be.equal(1);
|
||||
logs[0].event.should.be.eq('Transfer');
|
||||
logs[0].args._from.should.be.equal(owner);
|
||||
logs[0].args._to.should.be.equal(this.to);
|
||||
logs[0].args._tokenId.should.be.bignumber.equal(tokenId);
|
||||
|
||||
logs[1].event.should.be.eq('Transfer');
|
||||
logs[1].args._from.should.be.equal(owner);
|
||||
logs[1].args._to.should.be.equal(this.to);
|
||||
logs[1].args._tokenId.should.be.bignumber.equal(tokenId);
|
||||
});
|
||||
} else {
|
||||
it('emits only a transfer event', async function () {
|
||||
@ -201,17 +196,12 @@ export default function shouldBehaveLikeERC721BasicToken (accounts) {
|
||||
approvedAccount.should.be.equal(ZERO_ADDRESS);
|
||||
});
|
||||
|
||||
it('emits an approval and transfer events', async function () {
|
||||
logs.length.should.be.equal(2);
|
||||
logs[0].event.should.be.eq('Approval');
|
||||
logs[0].args._owner.should.be.equal(owner);
|
||||
logs[0].args._approved.should.be.equal(ZERO_ADDRESS);
|
||||
it('emits only a transfer event', async function () {
|
||||
logs.length.should.be.equal(1);
|
||||
logs[0].event.should.be.eq('Transfer');
|
||||
logs[0].args._from.should.be.equal(owner);
|
||||
logs[0].args._to.should.be.equal(owner);
|
||||
logs[0].args._tokenId.should.be.bignumber.equal(tokenId);
|
||||
|
||||
logs[1].event.should.be.eq('Transfer');
|
||||
logs[1].args._from.should.be.equal(owner);
|
||||
logs[1].args._to.should.be.equal(owner);
|
||||
logs[1].args._tokenId.should.be.bignumber.equal(tokenId);
|
||||
});
|
||||
|
||||
it('keeps the owner balance', async function () {
|
||||
@ -287,8 +277,8 @@ export default function shouldBehaveLikeERC721BasicToken (accounts) {
|
||||
|
||||
it('should call onERC721Received', async function () {
|
||||
const result = await transferFun.call(this, owner, this.to, tokenId, { from: owner });
|
||||
result.receipt.logs.length.should.be.equal(3);
|
||||
const [log] = decodeLogs([result.receipt.logs[2]], ERC721Receiver, this.receiver.address);
|
||||
result.receipt.logs.length.should.be.equal(2);
|
||||
const [log] = decodeLogs([result.receipt.logs[1]], ERC721Receiver, this.receiver.address);
|
||||
log.event.should.be.eq('Received');
|
||||
log.args._address.should.be.equal(owner);
|
||||
log.args._tokenId.toNumber().should.be.equal(tokenId);
|
||||
|
||||
@ -99,17 +99,6 @@ export default function shouldMintAndBurnERC721Token (accounts) {
|
||||
const approvedAccount = await this.token.getApproved(tokenId);
|
||||
approvedAccount.should.be.equal(ZERO_ADDRESS);
|
||||
});
|
||||
|
||||
it('emits an approval event', async function () {
|
||||
logs.length.should.be.equal(2);
|
||||
|
||||
logs[0].event.should.be.eq('Approval');
|
||||
logs[0].args._owner.should.be.equal(sender);
|
||||
logs[0].args._approved.should.be.equal(ZERO_ADDRESS);
|
||||
logs[0].args._tokenId.should.be.bignumber.equal(tokenId);
|
||||
|
||||
logs[1].event.should.be.eq('Transfer');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given token ID was not tracked by this contract', function () {
|
||||
|
||||
Reference in New Issue
Block a user