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

Remove ERC721ASetOwnersExplicit extension #290

Merged
merged 2 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
66 changes: 0 additions & 66 deletions contracts/extensions/ERC721AOwnersExplicit.sol

This file was deleted.

24 changes: 0 additions & 24 deletions contracts/mocks/ERC721ABurnableOwnersExplicitMock.sol

This file was deleted.

6 changes: 5 additions & 1 deletion contracts/mocks/ERC721AMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ contract ERC721AMock is ERC721A {
return _ownershipAt(index);
}

function getOwnershipOf(uint index) public view returns (TokenOwnership memory) {
function getOwnershipOf(uint256 index) public view returns (TokenOwnership memory) {
return _ownershipOf(index);
}

function initializeOwnershipAt(uint256 tokenId) public {
_initializeOwnershipAt(tokenId);
}
}
27 changes: 0 additions & 27 deletions contracts/mocks/ERC721AOwnersExplicitMock.sol

This file was deleted.

20 changes: 0 additions & 20 deletions contracts/mocks/ERC721AOwnersExplicitStartTokenIdMock.sol

This file was deleted.

20 changes: 0 additions & 20 deletions contracts/mocks/ERC721AQueryableOwnersExplicitMock.sol

This file was deleted.

15 changes: 15 additions & 0 deletions test/ERC721A.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,21 @@ const createTestSuite = ({ contract, constructorArgs }) =>
expect(await this.erc721a.exists(this.tokenIdToBurn)).to.be.false;
});
});

describe('_initializeOwnershipAt', async function () {
it('successfuly sets ownership of empty slot', async function () {
const lastTokenId = this.addr3.expected.tokens[2];
expect(await this.erc721a.ownerOf(lastTokenId)).to.be.equal(this.addr3.address);
const tx1 = await this.erc721a.initializeOwnershipAt(lastTokenId);
expect(await this.erc721a.ownerOf(lastTokenId)).to.be.equal(this.addr3.address);
const tx2 = await this.erc721a.initializeOwnershipAt(lastTokenId);

// We assume the initialization worked due to less gas used by the 2nd txn
const receipt1 = await tx1.wait();
const receipt2 = await tx2.wait();
expect(receipt1.gasUsed.toNumber()).to.be.greaterThan(receipt2.gasUsed.toNumber());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a best-efforst heuristic to determine whether or not the initialization call worked because we can't directly access _packedOwnerships

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can access _ownershipAt, which is internal.

But big brain trick haha.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a best-efforst heuristic to determine whether or not the initialization call worked because we can't directly access _packedOwnerships

});
});
});

context('test mint functionality', function () {
Expand Down
44 changes: 0 additions & 44 deletions test/extensions/ERC721ABurnableOwnersExplicit.test.js

This file was deleted.

137 changes: 0 additions & 137 deletions test/extensions/ERC721AOwnersExplicit.test.js

This file was deleted.

9 changes: 0 additions & 9 deletions test/extensions/ERC721AQueryable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,3 @@ describe(
constructorArgs: ['Azuki', 'AZUKI', 1],
})
);

describe(
'ERC721AQueryableOwnersExplicit',
createTestSuite({
contract: 'ERC721AQueryableOwnersExplicitMock',
constructorArgs: ['Azuki', 'AZUKI'],
initializeOwnersExplicit: true,
})
);