Align ERC721 Receiver with current ERC721 standard. (#1047)

* Align ERC721 Receiver with current ERC721 standard.
Adds a second address field to onERC721Received
onERC721Received(address,address,uint256,bytes)
Updates the function signature to 0x150b7a02 from 0xf0b9e5ba

* Add _operator to onERC721Received

* Fix error caused by formatOnSave

* Fixed comments on ERC721Receiver
Removed "Must use 50,000 gas or less"
Corrected the function signature
This commit is contained in:
Paul Barclay
2018-06-28 20:11:18 -07:00
committed by Matt Condon
parent 6b37ba36a1
commit 7d8e3ca8b2
5 changed files with 34 additions and 17 deletions

View File

@ -18,7 +18,7 @@ export default function shouldBehaveLikeERC721BasicToken (accounts) {
const unknownTokenId = 3;
const creator = accounts[0];
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
const RECEIVER_MAGIC_VALUE = '0xf0b9e5ba';
const RECEIVER_MAGIC_VALUE = '0x150b7a02';
describe('like an ERC721BasicToken', function () {
beforeEach(async function () {
@ -280,7 +280,19 @@ export default function shouldBehaveLikeERC721BasicToken (accounts) {
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._operator.should.be.equal(owner);
log.args._from.should.be.equal(owner);
log.args._tokenId.toNumber().should.be.equal(tokenId);
log.args._data.should.be.equal(data);
});
it('should call onERC721Received from approved', async function () {
const result = await transferFun.call(this, owner, this.to, tokenId, { from: approved });
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._operator.should.be.equal(approved);
log.args._from.should.be.equal(owner);
log.args._tokenId.toNumber().should.be.equal(tokenId);
log.args._data.should.be.equal(data);
});