Skip to content

Commit

Permalink
chore: unify internal function style
Browse files Browse the repository at this point in the history
  • Loading branch information
antoncoding committed Mar 10, 2022
1 parent 317eaf5 commit 272bc3e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions contracts/ERC721A.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
string private _symbol;

// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details.
// An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details.
mapping(uint256 => TokenOwnership) internal _ownerships;

// Mapping owner address to address data
Expand Down Expand Up @@ -185,7 +185,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
* Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around in the collection over time.
*/
function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
uint256 curr = tokenId;

unchecked {
Expand Down Expand Up @@ -216,7 +216,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return ownershipOf(tokenId).addr;
return _ownershipOf(tokenId).addr;
}

/**
Expand Down Expand Up @@ -432,7 +432,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
address to,
uint256 tokenId
) private {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
TokenOwnership memory prevOwnership = _ownershipOf(tokenId);

bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
isApprovedForAll(prevOwnership.addr, _msgSender()) ||
Expand Down Expand Up @@ -485,7 +485,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
TokenOwnership memory prevOwnership = _ownershipOf(tokenId);

_beforeTokenTransfers(prevOwnership.addr, address(0), tokenId, 1);

Expand Down
2 changes: 1 addition & 1 deletion contracts/extensions/ERC721ABurnable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ abstract contract ERC721ABurnable is Context, ERC721A {
* - The caller must own `tokenId` or be an approved operator.
*/
function burn(uint256 tokenId) public virtual {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
TokenOwnership memory prevOwnership = _ownershipOf(tokenId);

bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
isApprovedForAll(prevOwnership.addr, _msgSender()) ||
Expand Down
2 changes: 1 addition & 1 deletion contracts/extensions/ERC721AOwnersExplicit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ abstract contract ERC721AOwnersExplicit is ERC721A {

for (uint256 i = _nextOwnerToExplicitlySet; i <= endIndex; i++) {
if (_ownerships[i].addr == address(0) && !_ownerships[i].burned) {
TokenOwnership memory ownership = ownershipOf(i);
TokenOwnership memory ownership = _ownershipOf(i);
_ownerships[i].addr = ownership.addr;
_ownerships[i].startTimestamp = ownership.startTimestamp;
}
Expand Down

0 comments on commit 272bc3e

Please sign in to comment.