Skip to content

Commit

Permalink
Bugfixes 8/16/2023 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
robdoesstuff committed Aug 16, 2023
1 parent fae3910 commit a1e14b2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/PatchworkNFTBase.sol
Expand Up @@ -139,7 +139,7 @@ abstract contract PatchworkNFT is ERC721, IPatchworkNFT {

function setFrozen(uint256 tokenId, bool frozen_) public virtual {
require(msg.sender == ownerOf(tokenId), "not authorized");
bool _frozen = _locks[tokenId];
bool _frozen = _freezes[tokenId];
if (!(_frozen && frozen_)) {
if (frozen_) {
_freezes[tokenId] = true;
Expand Down
24 changes: 24 additions & 0 deletions test/PatchworkNFTBase.t.sol
Expand Up @@ -91,6 +91,30 @@ contract PatchworkNFTBaseTest is Test {
assertEq(user2Address, testPatchworkNFT.ownerOf(1));
}

function testLockFreezeSeparation() public {
testPatchworkNFT.mint(userAddress, 1);
vm.startPrank(userAddress);
assertFalse(testPatchworkNFT.locked(1));
testPatchworkNFT.setLocked(1, true);
assertTrue(testPatchworkNFT.locked(1));
assertFalse(testPatchworkNFT.frozen(1));
testPatchworkNFT.setFrozen(1, true);
assertTrue(testPatchworkNFT.frozen(1));
assertTrue(testPatchworkNFT.locked(1));
testPatchworkNFT.setLocked(1, false);
assertTrue(testPatchworkNFT.frozen(1));
assertFalse(testPatchworkNFT.locked(1));
testPatchworkNFT.setFrozen(1, false);
assertFalse(testPatchworkNFT.frozen(1));
assertFalse(testPatchworkNFT.locked(1));
testPatchworkNFT.setFrozen(1, true);
assertTrue(testPatchworkNFT.frozen(1));
assertFalse(testPatchworkNFT.locked(1));
testPatchworkNFT.setLocked(1, true);
assertTrue(testPatchworkNFT.frozen(1));
assertTrue(testPatchworkNFT.locked(1));
}

function testTransferFromWithFreezeNonce() public {
// TODO make sure these are calling checkTransfer on proto
testPatchworkNFT.mint(userAddress, 1);
Expand Down
1 change: 0 additions & 1 deletion test/PatchworkProtocol.t.sol
Expand Up @@ -255,7 +255,6 @@ contract PatchworkProtocolTest is Test {
vm.expectRevert("not authorized");
prot.assignNFT(address(testFragmentLiteRefNFT), user2FragmentTokenId, address(testPatchLiteRefNFT), patchTokenId);

vm.startPrank(userAddress);
prot.assignNFT(address(testFragmentLiteRefNFT), fragmentTokenId, address(testPatchLiteRefNFT), patchTokenId);
(address addr, uint256 tokenId) = testFragmentLiteRefNFT.getAssignedTo(fragmentTokenId);
assertEq(addr, address(testPatchLiteRefNFT));
Expand Down

0 comments on commit a1e14b2

Please sign in to comment.