Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERC721 (wip) #98

Closed
wants to merge 13 commits into from
Closed

ERC721 (wip) #98

wants to merge 13 commits into from

Conversation

simondlr
Copy link
Contributor

@simondlr simondlr commented Dec 11, 2017

This PR contains an implementation of ERC721 as well a test contract that extends it. It contains various tests.

I want some eyes & ACKs on this before we rebase & merge.

@GNSPS GNSPS self-requested a review December 12, 2017 15:11
}

//how many badges of a specific release someone owns
function balanceOf(address _owner) public view returns (uint256 balance) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose taking the named var return out.

Changing this: returns (uint256 balance)
To this: returns (uint256)

Since the balance var is not even used

function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256 tokenId);

//links to more metadata
function tokenMetadata(uint256 _tokenId) public view returns (string infoUrl);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also if we're inheriting the interface to make sure all the functions are specified in the contract then this one is not.

contract ERC721Interface {

//TODO: should this be done vs https://github.com/ethereum/EIPs/issues/165?
function implementsERC721() public pure returns (bool);
Copy link
Collaborator

@GNSPS GNSPS Dec 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also another interface definition not implemented in the actual token contract.


contract('TestERC721Implementation', function (accounts) {
beforeEach(async () => {
// todo: deployment is OOG-ing.
Copy link
Collaborator

@GNSPS GNSPS Dec 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not OOGing. It is actually failing at compile time for not implementing all the function definitions on the interface.

@simondlr
Copy link
Contributor Author

simondlr commented Dec 12, 2017

Thanks @GNSPS for inspecting. Tests work. Getting to writing more tests. Like ERC20 interface, I removed the functions that are implemented as public vars in the implementation.

@skmgoldin
Copy link
Contributor

Any reason you don't inherit and extend StandardToken.sol in ERC721Interface.sol?

@skmgoldin
Copy link
Contributor

Also, could you make this PR to staging? 😇

@simondlr simondlr changed the base branch from master to staging December 14, 2017 09:14
@simondlr
Copy link
Contributor Author

Any reason you don't inherit and extend StandardToken.sol in ERC721Interface.sol?

Not sure what you mean here? ERC721 is substantially functionally different...

Also, could you make this PR to staging?

Yip! Changed. :)

@simondlr
Copy link
Contributor Author

Will rebase to clean commits when the tests are done.

@maurelian
Copy link
Contributor

maurelian commented Dec 20, 2017

This is looking great @simondlr. There are a few changes (mostly structural) that would help this to conform with the direction we're hoping to take this repo. Apologies for not communicating it more clearly yet before now.

  1. Move the solidity folder into /contracts/erc721 (as has been done in this branch: https://github.com/ConsenSys/Tokens/tree/staging)
  2. Split up the tests similarly into /tests/erc721
  3. Even better, break tests out into per-function files to conform with Break tests up into per-function files #102
  4. Lint the solidity files with solhint (https://protofire.github.io/solhint/)

The easiest thing for you might be to build on top of this branch: https://github.com/ConsenSys/Tokens/tree/Elaniobro-Gitcoin-linter

@GNSPS
Copy link
Collaborator

GNSPS commented Dec 20, 2017

We can implement solhint at CI level just like Mike did for eslint

@simondlr
Copy link
Contributor Author

simondlr commented Jan 5, 2018

Some more tests. Found a bug that took a while to dissect. Yay for tests! Last bunch is the approves. Will continue tomorrow on that.

@simondlr
Copy link
Contributor Author

simondlr commented Jan 9, 2018

Okay. There might be some extra tests I want to write wrt juggling tokens in various stages of approval & transferred & multiples of them, but it seems good enough for now so that it can get more eyes on them.

Once there's ACKs, I'll rebase and clean up merge conflicts.

@simondlr
Copy link
Contributor Author

simondlr commented Jan 9, 2018

This change requires babel btw since I pulled in updated test helpers from OpenZeppelin.

@simondlr
Copy link
Contributor Author

Anyone still keen to take a look?

@simondlr
Copy link
Contributor Author

Just to add to above.

Reviewing this is not urgent for us at Ujo. We are still in testnet for the foreseeable future. Will be undergoing a proper audit in due time, which would include an audit of this contract code.

With the current conversations around ERC 777 (new ERC20) & ERC821 (similar style to ERC777 for ERC721), it might be better to just update to these standards instead. So don't have to do double work, if we just anyway implement ERC777 & ERC821 instead into the future. :)

@simondlr
Copy link
Contributor Author

simondlr commented Mar 7, 2018

I'm going to close this for now. ERC721 after 3 months of back & forth finished discussions and implements a new standard (adding in changes from ERC821).

Seen here: ethereum/EIPs#841.

I'm going to create a new PR rather and start from scratch since this one will just muddy the conversation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants