-
Notifications
You must be signed in to change notification settings - Fork 842
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
Add ERC721ALowCap + tests #114
Conversation
See #115 on |
I suggest putting the projects.md update into another PR, so that the maintainers can merge that first. |
@Vectorized in #115 you compressed the function by a bit
Specifically you removed this:
Am I wrong in assuming this loop is going to continue? Or is it because this is a view it does not matter and its better to save the space in the contract to lower deploy cost. (I think things like comments, spacing etc will get removed with the optimizer but I could be wrong) |
@Austinhs You can add the break if you want. I simply copied and pasted from my own code. Didn't code the break part it as its just a view function I am waiting for the maintainers and others to drop their opinions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some style notes.
Also, add some tests for burned tokens too, just like transfer.
And it would be better if you add tests with ERC721AOwnersExplicit
too.
*/ | ||
function tokensOfOwner(address owner) public view returns (uint256[] memory) { | ||
uint256 holdingAmount = balanceOf(owner); | ||
uint256 currSupply = _currentIndex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra white spaces before the assignment =
. docs
contracts/mocks/ERC721ALowCap.sol
Outdated
|
||
import '../extensions/ERC721ALowCap.sol'; | ||
|
||
contract ERC721ALowCapMock is ERC721ALowCap { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filename should be the same as contract name, try changing the filename to ERC721ALowCapMock.sol
. docs
await this.token.deployed(); | ||
}); | ||
|
||
context('with minted tokens', async function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 spaces for indentation in this context instead of 4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be able to run npm run lint
to autofix all formatting issues!
Fixed the linting errors. Thanks for the @ahbanavi , you mentioned adding tests with Sorry for the holdup on this branch, its been hectic month or so and just recently getting back to work on contract stuff again so I figured I'd finish this up as well as I knew it was still open. |
I'll need to check with the team if they are ok with this extension. We may consider a different name if we decide to go ahead with it. |
@Austinhs glad to have you back |
Add _startTokenId in erc721aLowCap
Tokens of owner tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it's good to go
@Vectorized
Lemme sit on it for a while, probably will merge this weekend if team agrees. |
Ended up creating a function "tokensOfOwner" as its something Divine Anarchy uses a lot within its dApp experience. Figured I would create a pull request incase it was something you guys wanted to add to the main repo :)