Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Rename current ERC721 implementation to BaseERC721
  • Loading branch information
facuspagnuolo committed Feb 26, 2018
commit f8fa7f63fbf91e7e324bcf0a6a7f7d7b6446891f
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pragma solidity ^0.4.18;

import "../token/ERC721/ERC721Token.sol";
import "../token/ERC721/BaseERC721Token.sol";

/**
* @title ERC721TokenMock
* @title BaseERC721TokenMock
* This mock just provides a public mint and burn functions for testing purposes.
*/
contract ERC721TokenMock is ERC721Token {
function ERC721TokenMock() ERC721Token() public { }
contract BaseERC721TokenMock is BaseERC721Token {
function BaseERC721TokenMock() BaseERC721Token() public { }

function mint(address _to, uint256 _tokenId) public {
super._mint(_to, _tokenId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pragma solidity ^0.4.18;

/**
* @title ERC721 interface
* @dev see https://github.com/ethereum/eips/issues/721
* @title Base ERC721 interface
* @dev see https://github.com/ethereum/eips/issues/721 and https://github.com/ethereum/EIPs/pull/841
*/
contract ERC721 {
contract BaseERC721 {
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pragma solidity ^0.4.18;

import "./ERC721.sol";
import "./BaseERC721.sol";
import "../../math/SafeMath.sol";

/**
* @title ERC721Token
* @title BaseERC721Token
* Generic implementation for the required functionality of the ERC721 standard
*/
contract ERC721Token is ERC721 {
contract BaseERC721Token is BaseERC721 {
using SafeMath for uint256;

// Total amount of tokens
Expand Down Expand Up @@ -136,14 +136,14 @@ contract ERC721Token is ERC721 {
}

/**
* @dev Tells whether the msg.sender is approved for the given token ID or not
* @dev Tells whether the given spender is approved for the given token ID or not
* This function is not private so it can be extended in further implementations like the operatable ERC721
* @param _owner address of the owner to query the approval of
* @param _spender address of the spender to query the approval of
* @param _tokenId uint256 ID of the token to query the approval of
* @return bool whether the msg.sender is approved for the given token ID or not
*/
function isApprovedFor(address _owner, uint256 _tokenId) internal view returns (bool) {
return approvedFor(_tokenId) == _owner;
function isApprovedFor(address _spender, uint256 _tokenId) internal view returns (bool) {
return approvedFor(_tokenId) == _spender;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import assertRevert from '../../helpers/assertRevert';
const BigNumber = web3.BigNumber;
const ERC721Token = artifacts.require('ERC721TokenMock.sol');
const BaseERC721Token = artifacts.require('BaseERC721TokenMock.sol');

require('chai')
.use(require('chai-as-promised'))
.use(require('chai-bignumber')(BigNumber))
.should();

contract('ERC721Token', accounts => {
contract('BaseERC721Token', accounts => {
let token = null;
const _firstTokenId = 1;
const _secondTokenId = 2;
Expand All @@ -16,7 +16,7 @@ contract('ERC721Token', accounts => {
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';

beforeEach(async function () {
token = await ERC721Token.new({ from: _creator });
token = await BaseERC721Token.new({ from: _creator });
await token.mint(_creator, _firstTokenId, { from: _creator });
await token.mint(_creator, _secondTokenId, { from: _creator });
});
Expand Down