@@ -824,127 +824,6 @@ contract PackTest is BaseTest {
824824 assertEq (packUri, pack.uri (packId));
825825 }
826826
827- function test_fuzz_state_openPack (
828- uint256 x ,
829- uint128 y ,
830- uint256 z
831- ) public {
832- // vm.assume(x == 1574 && y == 22 && z == 392);
833- (ITokenBundle.Token[] memory tokensToPack , uint256 [] memory rewardUnits ) = getTokensToPack (x);
834- if (tokensToPack.length == 0 ) {
835- return ;
836- }
837-
838- uint256 packId = pack.nextTokenIdToMint ();
839- address recipient = address (0x123 );
840- uint256 totalRewardUnits;
841- uint256 nativeTokenPacked;
842-
843- for (uint256 i = 0 ; i < tokensToPack.length ; i += 1 ) {
844- totalRewardUnits += rewardUnits[i];
845- if (tokensToPack[i].assetContract == address (0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE )) {
846- nativeTokenPacked += tokensToPack[i].totalAmount;
847- }
848- }
849- vm.assume (y > 0 && totalRewardUnits % y == 0 );
850- vm.deal (address (tokenOwner), nativeTokenPacked);
851-
852- vm.prank (address (tokenOwner));
853- (, uint256 totalSupply ) = pack.createPack { value: nativeTokenPacked }(
854- tokensToPack,
855- rewardUnits,
856- packUri,
857- 0 ,
858- y,
859- recipient
860- );
861- console2.log ("total supply: " , totalSupply);
862- console2.log ("total reward units: " , totalRewardUnits);
863-
864- vm.assume (z <= totalSupply);
865- vm.prank (recipient, recipient);
866- ITokenBundle.Token[] memory rewardsReceived = pack.openPack (packId, z);
867- console2.log ("received reward units: " , rewardsReceived.length );
868-
869- assertEq (packUri, pack.uri (packId));
870-
871- (
872- uint256 nativeTokenAmount ,
873- uint256 erc20Amount ,
874- uint256 [] memory erc1155Amounts ,
875- uint256 erc721Amount
876- ) = checkBalances (rewardsReceived, recipient);
877-
878- assertEq (address (recipient).balance, nativeTokenAmount);
879- assertEq (erc20.balanceOf (address (recipient)), erc20Amount);
880- assertEq (erc721.balanceOf (address (recipient)), erc721Amount);
881-
882- for (uint256 i = 0 ; i < erc1155Amounts.length ; i += 1 ) {
883- assertEq (erc1155.balanceOf (address (recipient), i), erc1155Amounts[i]);
884- }
885- }
886-
887- // function test_fuzz_failing_state_openPack() public {
888- // // vm.assume(x == 1574 && y == 22 && z == 392);
889-
890- // uint256 x = 1574;
891- // uint128 y = 22;
892- // uint256 z = 392;
893-
894- // (ITokenBundle.Token[] memory tokensToPack, uint256[] memory rewardUnits) = getTokensToPack(x);
895- // if (tokensToPack.length == 0) {
896- // return;
897- // }
898-
899- // uint256 packId = pack.nextTokenIdToMint();
900- // address recipient = address(0x123);
901- // uint256 totalRewardUnits;
902- // uint256 nativeTokenPacked;
903-
904- // for (uint256 i = 0; i < tokensToPack.length; i += 1) {
905- // totalRewardUnits += tokensToPack[i].totalAmount / amounts[i];
906- // if (tokensToPack[i].assetContract == address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)) {
907- // nativeTokenPacked += tokensToPack[i].totalAmount;
908- // }
909- // }
910- // vm.assume(y > 0 && totalRewardUnits % y == 0);
911- // vm.deal(address(tokenOwner), nativeTokenPacked);
912-
913- // vm.prank(address(tokenOwner));
914- // (, uint256 totalSupply) = pack.createPack{ value: nativeTokenPacked }(
915- // tokensToPack,
916- // amounts,
917- // packUri,
918- // 0,
919- // y,
920- // recipient
921- // );
922- // console2.log("total supply: ", totalSupply);
923- // console2.log("total reward units: ", totalRewardUnits);
924-
925- // vm.assume(z <= totalSupply);
926- // vm.prank(recipient, recipient);
927- // ITokenBundle.Token[] memory rewardUnits = pack.openPack(packId, z);
928- // console2.log("received reward units: ", rewardUnits.length);
929-
930- // assertEq(packUri, pack.uri(packId));
931-
932- // (
933- // uint256 nativeTokenAmount,
934- // uint256 erc20Amount,
935- // uint256[] memory erc1155Amounts,
936- // uint256 erc721Amount
937- // ) = checkBalances(rewardUnits, recipient);
938-
939- // assertEq(address(recipient).balance, nativeTokenAmount);
940- // assertEq(erc20.balanceOf(address(recipient)), erc20Amount);
941- // assertEq(erc721.balanceOf(address(recipient)), erc721Amount);
942-
943- // for (uint256 i = 0; i < erc1155Amounts.length; i += 1) {
944- // assertEq(erc1155.balanceOf(address(recipient), i), erc1155Amounts[i]);
945- // }
946- // }
947-
948827 /*///////////////////////////////////////////////////////////////
949828 Scenario/Exploit tests
950829 //////////////////////////////////////////////////////////////*/
0 commit comments