* 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
43 lines
724 B
Solidity
43 lines
724 B
Solidity
pragma solidity ^0.4.24;
|
|
|
|
import "../token/ERC721/ERC721Receiver.sol";
|
|
|
|
|
|
contract ERC721ReceiverMock is ERC721Receiver {
|
|
bytes4 retval;
|
|
bool reverts;
|
|
|
|
event Received(
|
|
address _operator,
|
|
address _from,
|
|
uint256 _tokenId,
|
|
bytes _data,
|
|
uint256 _gas
|
|
);
|
|
|
|
constructor(bytes4 _retval, bool _reverts) public {
|
|
retval = _retval;
|
|
reverts = _reverts;
|
|
}
|
|
|
|
function onERC721Received(
|
|
address _operator,
|
|
address _from,
|
|
uint256 _tokenId,
|
|
bytes _data
|
|
)
|
|
public
|
|
returns(bytes4)
|
|
{
|
|
require(!reverts);
|
|
emit Received(
|
|
_operator,
|
|
_from,
|
|
_tokenId,
|
|
_data,
|
|
gasleft() // msg.gas was deprecated in solidityv0.4.21
|
|
);
|
|
return retval;
|
|
}
|
|
}
|