Skip to content

Commit

Permalink
T
Browse files Browse the repository at this point in the history
  • Loading branch information
Vectorized committed Mar 14, 2024
1 parent 0877959 commit 91b3e5a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
22 changes: 11 additions & 11 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -196,18 +196,18 @@ DN69OnlyERC20Test:testTransferFromInsufficientBalanceReverts(address,uint256,uin
DN69OnlyERC20Test:testTransferInsufficientBalanceReverts() (gas: 67028)
DN69OnlyERC20Test:testTransferInsufficientBalanceReverts(address,uint256,uint256) (runs: 256, μ: 68059, ~: 68115)
DN69OnlyERC20Test:test__codesize() (gas: 27994)
DN69Test:testERC1155Methods(uint256) (runs: 256, μ: 4369904, ~: 4620647)
DN69Test:testERC1155MethodsSelfTransfers(uint256) (runs: 256, μ: 2401641, ~: 2084157)
DN69Test:testERC1155Methods(uint256) (runs: 256, μ: 4388365, ~: 4634593)
DN69Test:testERC1155MethodsSelfTransfers(uint256) (runs: 256, μ: 2422105, ~: 2084157)
DN69Test:testFindOwnedIds() (gas: 2670950)
DN69Test:testMintToNonERC155RecipientReverts(uint256) (runs: 256, μ: 948179, ~: 805063)
DN69Test:testMintToRevertingERC155RecipientReverts(uint256) (runs: 256, μ: 1370530, ~: 985963)
DN69Test:testMintToZeroReverts(uint256) (runs: 256, μ: 737151, ~: 669983)
DN69Test:testMixed(uint256) (runs: 256, μ: 9908575, ~: 7659486)
DN69Test:testSafeBatchTransferFromToERC1155Recipient(uint256) (runs: 256, μ: 2240433, ~: 2193940)
DN69Test:testSafeTransferFromToERC1155Recipient(uint256) (runs: 256, μ: 1770043, ~: 1482110)
DN69Test:testTransferFromToERC1155Recipient(uint256) (runs: 256, μ: 2891702, ~: 2878588)
DN69Test:testTransferMixedReverts(uint256) (runs: 256, μ: 4626213, ~: 3388445)
DN69Test:test__codesize() (gas: 66063)
DN69Test:testMintToNonERC155RecipientReverts(uint256) (runs: 256, μ: 850934, ~: 803572)
DN69Test:testMintToRevertingERC155RecipientReverts(uint256) (runs: 256, μ: 1378783, ~: 985963)
DN69Test:testMintToZeroReverts(uint256) (runs: 256, μ: 729341, ~: 670037)
DN69Test:testMixed(uint256) (runs: 256, μ: 10296828, ~: 6470473)
DN69Test:testSafeBatchTransferFromToERC1155Recipient(uint256) (runs: 256, μ: 2258849, ~: 2193940)
DN69Test:testSafeTransferFromToERC1155Recipient(uint256) (runs: 256, μ: 1748629, ~: 1482110)
DN69Test:testTransferFromToERC1155Recipient(uint256) (runs: 256, μ: 2892990, ~: 2878593)
DN69Test:testTransferMixedReverts(uint256) (runs: 256, μ: 4732973, ~: 3894173)
DN69Test:test__codesize() (gas: 66685)
MappingsTest:testAddressPairMapSetAndGet(address[2],address[2],uint256,uint256) (runs: 256, μ: 45753, ~: 47075)
MappingsTest:testBitmapSetAndGet(uint256) (runs: 256, μ: 445667, ~: 397521)
MappingsTest:testBitmapSetAndGet(uint256,uint256,bool,bool) (runs: 256, μ: 25662, ~: 26319)
Expand Down
20 changes: 17 additions & 3 deletions test/DN69.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ contract DN69Test is SoladyTest {
uint256[] fromIds;
uint256[] allIds;
uint256[] ids;
uint256[] idsCopy;
uint256 numExists;
}

Expand Down Expand Up @@ -607,10 +608,23 @@ contract DN69Test is SoladyTest {
dn.safeBatchTransferFromNFTs(t.from, t.to, t.ids);
assertEq(dn.ownedCount(t.from), t.nftBalance);
assertEq(dn.balanceOf(t.from), t.balance);
uint256[] memory idsAfter = dn.findOwnedIds(t.from);
LibSort.sort(idsAfter);
t.idsCopy = dn.findOwnedIds(t.from);
LibSort.sort(t.idsCopy);
LibSort.sort(t.fromIds);
assertEq(idsAfter, t.fromIds);
assertEq(t.idsCopy, t.fromIds);
} else if (_random() % 2 == 0) {
t.ids = _randomSampleWithReplacements(t.fromIds);
t.idsCopy = LibSort.copy(t.ids);
LibSort.sort(t.idsCopy);
LibSort.uniquifySorted(t.idsCopy);
if (t.idsCopy.length < t.ids.length) {
vm.prank(t.from);
vm.expectRevert(DN69.TransferFromIncorrectOwner.selector);
dn.safeBatchTransferFromNFTs(t.from, t.to, t.ids);
} else {
vm.prank(t.from);
dn.safeBatchTransferFromNFTs(t.from, t.to, t.ids);
}
} else {
t.ids = _randomSampleWithoutReplacements(t.fromIds);
vm.prank(t.from);
Expand Down

0 comments on commit 91b3e5a

Please sign in to comment.