Skip to content

Commit c373d30

Browse files
changed ownerOf to _tokenOwners in _burn (#78)
* changed ownerOf to _tokenOwners in _burn * changed ownerOf to _tokenOwners in _mint * added internal ownerOf * added doc, fixed require statements * bumped version, returned _ownerOf() into _burn()
1 parent fcc56fe commit c373d30

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

contracts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@solarity/solidity-lib",
3-
"version": "2.6.7",
3+
"version": "2.6.8",
44
"license": "MIT",
55
"author": "Distributed Lab",
66
"readme": "README.md",

contracts/tokens/SBT.sol

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ abstract contract SBT is ISBT, ERC165Upgradeable {
6161
* @return true if `tokenId_` exists, false otherwise
6262
*/
6363
function tokenExists(uint256 tokenId_) public view virtual override returns (bool) {
64-
return ownerOf(tokenId_) != address(0);
64+
return _ownerOf(tokenId_) != address(0);
6565
}
6666

6767
/**
@@ -101,7 +101,7 @@ abstract contract SBT is ISBT, ERC165Upgradeable {
101101
* @return address of an owner or `address(0)` if token does not exist
102102
*/
103103
function ownerOf(uint256 tokenId_) public view virtual override returns (address) {
104-
return _tokenOwners[tokenId_];
104+
return _ownerOf(tokenId_);
105105
}
106106

107107
/**
@@ -172,7 +172,7 @@ abstract contract SBT is ISBT, ERC165Upgradeable {
172172
* @param tokenId_ the token to burn
173173
*/
174174
function _burn(uint256 tokenId_) internal virtual {
175-
address owner_ = ownerOf(tokenId_);
175+
address owner_ = _ownerOf(tokenId_);
176176
require(owner_ != address(0), "SBT: token doesn't exist");
177177

178178
_beforeTokenAction(address(0), tokenId_);
@@ -204,6 +204,15 @@ abstract contract SBT is ISBT, ERC165Upgradeable {
204204
_baseURI = baseURI_;
205205
}
206206

207+
/**
208+
* @notice The function to get the owner of a token
209+
* @param tokenId_ the token to get the owner of
210+
* @return address of an owner or `address(0)` if token does not exist
211+
*/
212+
function _ownerOf(uint256 tokenId_) internal view virtual returns (address) {
213+
return _tokenOwners[tokenId_];
214+
}
215+
207216
/**
208217
* @notice The hook that is called before the `mint` and `burn` actions occur
209218
* @param to_ the receiver address if `mint` and `address(0)` if burn

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@solarity/solidity-lib",
3-
"version": "2.6.7",
3+
"version": "2.6.8",
44
"license": "MIT",
55
"author": "Distributed Lab",
66
"description": "Solidity Library by Distributed Lab",

0 commit comments

Comments
 (0)