-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start Sequentially Minting at
_startTokenId()
instead of hardcoded 0 (
#66) * replaces currentIndex with _nextTokenId which starts at 1 instead of 0 * adapts test to new starting index of 1 * makes `ERC721AOwnersExplicit` test work with new starting index * explicitly sets `nextOwnerToExplicitlySet` to 1 because it's initialised with zero * remove vscode files * implements @jpegditials suggestions * adds tests for `tokenByIndex` and `tokenOfOwnerByIndex` * prevents tokenId 0 to be an existing token * adapts `tokenOfOwnerByIndex` for starting token index 1 and making tests for it more elaborate. * renames variable to make it more clear, it's index by the tokenId * adds unchecked scopes to save on gas as suggested by @Vectorized * more gas optimizations by @Vectorized * implements suggested `_startTokenId` function to override to set starting index * minor adaptions to work with _startTokenId() properly * brings back original tests * creates copy of original test with startTokenId set to 1 * adapts comment to reflect flexibility of the starting tokenId * adapts solidity version of tests * Replaces revert messages with new contract errors * fix merge hiccup * optimisations to save on gas used during deployment * Added #61 * Edited comments * Edited README roadmap * Removed burn test with one-index mock * Changed _startTokenId to _currentIndex * adapting test and mock related to index starting at 1 to make them work with recent changes on `main` * add _totalMinted function * add tests for _totalMinted * removes uint128 cast, simplifies comment and lints file * rename `ERC721AExplicitOwnershipMock` to `ERC721AOwnersExplicitMock` to be aligned with the naming of the contract * extend from already mocked ERC721A versions to dry code. * aligns file naming and contract naming * creates new ERC721A mock which enables the user to specify the startTokenId dynamically * converts ERC721A test to a parameterized test to work with other mocks as well. * extracts Helper contract to it's own file * parameterises ERC721A Explicit Owner Tests to also test a Version of the Contract with a different start token id. * makes it more transparent where the startTokenId value is coming from * creates a ERC721ABurnable Mock with custom startTokenId and uses it in a parameterised test suite testing the burnable extension. * removes code used during development * unifies code style across all tests Co-authored-by: webby1111 <webby1111@hotmail.com> Co-authored-by: Amirhossein Banavi <ahbanavi@gmail.com>
- Loading branch information
1 parent
810629d
commit 6064c6a
Showing
13 changed files
with
655 additions
and
455 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Creators: Chiru Labs | ||
|
||
pragma solidity ^0.8.4; | ||
|
||
import './ERC721ABurnableMock.sol'; | ||
import './StartTokenIdHelper.sol'; | ||
|
||
contract ERC721ABurnableStartTokenIdMock is StartTokenIdHelper, ERC721ABurnableMock { | ||
constructor( | ||
string memory name_, | ||
string memory symbol_, | ||
uint256 startTokenId_ | ||
) StartTokenIdHelper(startTokenId_) ERC721ABurnableMock(name_, symbol_) {} | ||
|
||
function _startTokenId() internal view override returns (uint256) { | ||
return startTokenId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Creators: Chiru Labs | ||
|
||
pragma solidity ^0.8.4; | ||
|
||
import './ERC721AOwnersExplicitMock.sol'; | ||
import './StartTokenIdHelper.sol'; | ||
|
||
contract ERC721AOwnersExplicitStartTokenIdMock is StartTokenIdHelper, ERC721AOwnersExplicitMock { | ||
constructor( | ||
string memory name_, | ||
string memory symbol_, | ||
uint256 startTokenId_ | ||
) StartTokenIdHelper(startTokenId_) ERC721AOwnersExplicitMock(name_, symbol_) {} | ||
|
||
function _startTokenId() internal view override returns (uint256) { | ||
return startTokenId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Creators: Chiru Labs | ||
|
||
pragma solidity ^0.8.4; | ||
|
||
import './ERC721AMock.sol'; | ||
import './StartTokenIdHelper.sol'; | ||
|
||
contract ERC721AStartTokenIdMock is StartTokenIdHelper, ERC721AMock { | ||
constructor( | ||
string memory name_, | ||
string memory symbol_, | ||
uint256 startTokenId_ | ||
) StartTokenIdHelper(startTokenId_) ERC721AMock(name_, symbol_) {} | ||
|
||
function _startTokenId() internal view override returns (uint256) { | ||
return startTokenId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Creators: Chiru Labs | ||
|
||
pragma solidity ^0.8.4; | ||
|
||
/** | ||
* This Helper is used to return a dynmamic value in the overriden _startTokenId() function. | ||
* Extending this Helper before the ERC721A contract give us access to the herein set `startTokenId` | ||
* to be returned by the overriden `_startTokenId()` function of ERC721A in the ERC721AStartTokenId mocks. | ||
*/ | ||
contract StartTokenIdHelper { | ||
uint256 public immutable startTokenId; | ||
|
||
constructor(uint256 startTokenId_) { | ||
startTokenId = startTokenId_; | ||
} | ||
} |
Oops, something went wrong.