Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: unify internal function style #161

Merged
merged 1 commit into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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