Skip to content

Instantly share code, notes, and snippets.

@ilamanov
Last active April 10, 2022 20:28
Show Gist options
  • Select an option

  • Save ilamanov/9ff74f97f646f342d2c2af86c45e1a93 to your computer and use it in GitHub Desktop.

Select an option

Save ilamanov/9ff74f97f646f342d2c2af86c45e1a93 to your computer and use it in GitHub Desktop.
pragma solidity ^0.5.0;
function totalSupply() public view returns (uint256) {
return _allTokens.length;
}
function tokenByIndex(uint256 index) public view returns (uint256) {
require(index < totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment