Skip to content

Commit

Permalink
changed ownerOf to _tokenOwners in _burn (#78)
Browse files Browse the repository at this point in the history
* 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()
  • Loading branch information
VolodymyrZolotukhin authored Nov 7, 2023
1 parent fcc56fe commit c373d30
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solarity/solidity-lib",
"version": "2.6.7",
"version": "2.6.8",
"license": "MIT",
"author": "Distributed Lab",
"readme": "README.md",
Expand Down
15 changes: 12 additions & 3 deletions contracts/tokens/SBT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ abstract contract SBT is ISBT, ERC165Upgradeable {
* @return true if `tokenId_` exists, false otherwise
*/
function tokenExists(uint256 tokenId_) public view virtual override returns (bool) {
return ownerOf(tokenId_) != address(0);
return _ownerOf(tokenId_) != address(0);
}

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

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

_beforeTokenAction(address(0), tokenId_);
Expand Down Expand Up @@ -204,6 +204,15 @@ abstract contract SBT is ISBT, ERC165Upgradeable {
_baseURI = baseURI_;
}

/**
* @notice The function to get the owner of a token
* @param tokenId_ the token to get the owner of
* @return address of an owner or `address(0)` if token does not exist
*/
function _ownerOf(uint256 tokenId_) internal view virtual returns (address) {
return _tokenOwners[tokenId_];
}

/**
* @notice The hook that is called before the `mint` and `burn` actions occur
* @param to_ the receiver address if `mint` and `address(0)` if burn
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solarity/solidity-lib",
"version": "2.6.7",
"version": "2.6.8",
"license": "MIT",
"author": "Distributed Lab",
"description": "Solidity Library by Distributed Lab",
Expand Down

0 comments on commit c373d30

Please sign in to comment.