Skip to content

Commit ba441f1

Browse files
authored
OpenEditionERC721: expose startTokenId (#410)
* Expose fn startTokenId() * docs update * pkg update * Fix test
1 parent 425618c commit ba441f1

File tree

4 files changed

+29
-8
lines changed

4 files changed

+29
-8
lines changed

contracts/OpenEditionERC721.sol

+10-6
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ contract OpenEditionERC721 is
119119
/// @dev Returns the URI for a given tokenId.
120120
function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
121121
if (!_exists(_tokenId)) {
122-
revert("OpenCollectionERC721: URI query for nonexistent token.");
122+
revert("!ID");
123123
}
124124

125125
return _getURIFromSharedMetadata(_tokenId);
@@ -141,6 +141,10 @@ contract OpenEditionERC721 is
141141
return 1;
142142
}
143143

144+
function startTokenId() public pure returns (uint256) {
145+
return _startTokenId();
146+
}
147+
144148
/*///////////////////////////////////////////////////////////////
145149
Internal functions
146150
//////////////////////////////////////////////////////////////*/
@@ -190,9 +194,9 @@ contract OpenEditionERC721 is
190194
function _transferTokensOnClaim(address _to, uint256 _quantityBeingClaimed)
191195
internal
192196
override
193-
returns (uint256 startTokenId)
197+
returns (uint256 startTokenId_)
194198
{
195-
startTokenId = _currentIndex;
199+
startTokenId_ = _currentIndex;
196200
_safeMint(_to, _quantityBeingClaimed);
197201
}
198202

@@ -269,15 +273,15 @@ contract OpenEditionERC721 is
269273
function _beforeTokenTransfers(
270274
address from,
271275
address to,
272-
uint256 startTokenId,
276+
uint256 startTokenId_,
273277
uint256 quantity
274278
) internal virtual override {
275-
super._beforeTokenTransfers(from, to, startTokenId, quantity);
279+
super._beforeTokenTransfers(from, to, startTokenId_, quantity);
276280

277281
// if transfer is restricted on the contract, we still want to allow burning and minting
278282
if (!hasRole(transferRole, address(0)) && from != address(0) && to != address(0)) {
279283
if (!hasRole(transferRole, from) && !hasRole(transferRole, to)) {
280-
revert("!Transfer-Role");
284+
revert("!T");
281285
}
282286
}
283287
}

contracts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@thirdweb-dev/contracts",
33
"description": "Collection of smart contracts deployable via the thirdweb SDK, dashboard and CLI",
4-
"version": "3.5.7",
4+
"version": "3.5.8",
55
"license": "Apache-2.0",
66
"repository": {
77
"type": "git",

docs/OpenEditionERC721.md

+17
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,23 @@ Token metadata information
976976
| imageURI | string | undefined |
977977
| animationURI | string | undefined |
978978

979+
### startTokenId
980+
981+
```solidity
982+
function startTokenId() external pure returns (uint256)
983+
```
984+
985+
986+
987+
988+
989+
990+
#### Returns
991+
992+
| Name | Type | Description |
993+
|---|---|---|
994+
| _0 | uint256 | undefined |
995+
979996
### subscribeToRegistry
980997

981998
```solidity

src/test/OpenEditionERC721.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ contract OpenEditionERC721Test is BaseTest {
254254
vm.prank(deployer);
255255
openEdition.revokeRole(keccak256("TRANSFER_ROLE"), address(0));
256256
vm.startPrank(receiver);
257-
vm.expectRevert(("!Transfer-Role"));
257+
vm.expectRevert(bytes("!T"));
258258
openEdition.transferFrom(receiver, address(123), 1);
259259
}
260260

0 commit comments

Comments
 (0)