Skip to content

Commit

Permalink
chore: more tests
Browse files Browse the repository at this point in the history
Signed-off-by: Campion Fellin <[email protected]>
  • Loading branch information
campionfellin committed Oct 10, 2023
1 parent 5bc9717 commit adde50b
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions packages/manifold/test/physicalclaim/PhysicalClaim.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,40 @@ contract PhysicalClaimTest is Test {
vm.expectRevert();
example.initializePhysicalClaim(2**56, claimPs);

// Cannot do a burn redeem with non-matching lengths of inputs

example.initializePhysicalClaim(instanceId, claimPs);

uint[] memory instanceIds = new uint[](2);
instanceIds[0] = instanceId;
instanceIds[1] = instanceId;

uint32[] memory physicalClaimCounts = new uint32[](1);
physicalClaimCounts[0] = 1;

IPhysicalClaimCore.BurnToken[][] memory burnTokens = new IPhysicalClaimCore.BurnToken[][](1);
burnTokens[0] = new IPhysicalClaimCore.BurnToken[](1);
burnTokens[0][0] = IPhysicalClaimCore.BurnToken({
groupIndex: 0,
itemIndex: 0,
contractAddress: address(creatorCore721),
id: 1,
merkleProof: new bytes32[](0)
});

bytes[] memory data = new bytes[](1);
data[0] = "";

vm.expectRevert();
example.burnRedeem(instanceIds, physicalClaimCounts, burnTokens, data);

physicalClaimCounts = new uint32[](2);
physicalClaimCounts[0] = 1;
physicalClaimCounts[1] = 1;

vm.expectRevert();
example.burnRedeem(instanceIds, physicalClaimCounts, burnTokens, data);


vm.stopPrank();
}
Expand Down Expand Up @@ -171,6 +205,29 @@ contract PhysicalClaimTest is Test {
example.burnRedeem(instanceIds, physicalClaimCounts, burnTokens, data);

vm.stopPrank();

vm.startPrank(owner);
// Mint new token to "other"
creatorCore721.mintBase(other, "");

vm.stopPrank();
vm.startPrank(other);

// Approve token for burning
creatorCore721.approve(address(example), 2);

burnTokens[0][0] = IPhysicalClaimCore.BurnToken({
groupIndex: 0,
itemIndex: 0,
contractAddress: address(creatorCore721),
id: 2,
merkleProof: new bytes32[](0)
});

// Send a non-zero value burn
example.burnRedeem{value: 1 ether}(instanceIds, physicalClaimCounts, burnTokens, data);

vm.stopPrank();
}

}

0 comments on commit adde50b

Please sign in to comment.