Rename current ERC721 implementation to BaseERC721
This commit is contained in:
committed by
Santiago Palladino
parent
d1146e8c8b
commit
1192e684c2
@ -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);
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -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;
|
||||
@ -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 });
|
||||
});
|
||||
Reference in New Issue
Block a user