Platform: Code4rena
Start Date: 03/05/2022
Pot Size: $50,000 USDC
Total HM: 4
Participants: 46
Period: 5 days
Judge: gzeon
Total Solo HM: 2
Id: 117
League: ETH
Rank: 44/46
Findings: 1
Award: $52.48
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: BowTiedWardens
Also found by: 0v3rf10w, 0x1f8b, 0x4non, 0xDjango, 0xNazgul, 0xkatana, Cityscape, Fitraldys, Funen, GimelSec, IllIllI, MaratCerby, Picodes, TerrierLover, Tomio, delfin454000, ellahi, fatherOfBlocks, hansfriese, ilan, joestakey, oyc_109, rfa, robee, samruna, simon135, slywaters, throttle
52.4836 USDC - $52.48
vars.totalAmount = 0;
proposed change:
vars.totalAmount;
uint256 totalAmount = 0;
proposed change:
uint256 totalAmount;
uint256 totalAmount = 0
proposed change:
uint256 totalAmount;
address public cEtherAddress;
proposed change:
address public immutable cEtherAddress;
for (uint256 i; i < length; ++i) { IERC721(underlying).safeTransferFrom(address(this), msg.sender, tokenIds[i], ""); }
proposed change:
for (uint256 i; i < length;) { IERC721(underlying).safeTransferFrom(address(this), msg.sender, tokenIds[i], ""); unchecked{ ++i;} }
for (uint256 i; i < length; ++i) { bytes memory data = abi.encodeWithSignature("transferPunk(address,uint256)", msg.sender, tokenIds[i]); (bool transferPunkSuccess, ) = underlying.call(data); require(transferPunkSuccess, "CNFT: Calling transferPunk was unsuccessful"); }
proposed change:
for (uint256 i; i < length;) { bytes memory data = abi.encodeWithSignature("transferPunk(address,uint256)", msg.sender, tokenIds[i]); (bool transferPunkSuccess, ) = underlying.call(data); require(transferPunkSuccess, "CNFT: Calling transferPunk was unsuccessful"); unchecked{ ++i;} }
for (uint256 i; i < length; ++i) { if (!is1155) { require(seizeAmounts[i] == 1, "CNFT: Amounts must be all 1s for non-ERC1155s."); } totalAmount += seizeAmounts[i]; }
proposed change:
for (uint256 i; i < length) { if (!is1155) { require(seizeAmounts[i] == 1, "CNFT: Amounts must be all 1s for non-ERC1155s."); } totalAmount += seizeAmounts[i]; unchecked{ ++i; } }
for (uint256 i; i < length; ++i) { IERC721(underlying).safeTransferFrom(msg.sender, address(this), tokenIds[i], ""); }
proposed change:
for (uint256 i; i < length;) { IERC721(underlying).safeTransferFrom(msg.sender, address(this), tokenIds[i], ""); unchecked {++i;} }
for (uint256 i; i < length; ++i) { bytes memory punkIndexToAddress = abi.encodeWithSignature("punkIndexToAddress(uint256)", tokenIds[i]); (bool checkSuccess, bytes memory result) = underlying.staticcall(punkIndexToAddress); (address nftOwner) = abi.decode(result, (address)); require(checkSuccess && nftOwner == msg.sender, "Not the NFT owner"); bytes memory data = abi.encodeWithSignature("buyPunk(uint256)", tokenIds[i]); (bool buyPunkSuccess, ) = underlying.call(data); require(buyPunkSuccess, "CNFT: Calling buyPunk was unsuccessful"); }
proposed change:
for (uint256 i; i < length;) { bytes memory punkIndexToAddress = abi.encodeWithSignature("punkIndexToAddress(uint256)", tokenIds[i]); (bool checkSuccess, bytes memory result) = underlying.staticcall(punkIndexToAddress); (address nftOwner) = abi.decode(result, (address)); require(checkSuccess && nftOwner == msg.sender, "Not the NFT owner"); bytes memory data = abi.encodeWithSignature("buyPunk(uint256)", tokenIds[i]); (bool buyPunkSuccess, ) = underlying.call(data); require(buyPunkSuccess, "CNFT: Calling buyPunk was unsuccessful"); unchecked { ++i;} }
for (uint256 i; i < length; ++i) { if (!is1155) { require(amounts[i] == 1, "CNFT: Amounts must be all 1s for non-ERC1155s."); } totalAmount += amounts[i]; }
proposed change:
for (uint256 i; i < length;) { if (!is1155) { require(amounts[i] == 1, "CNFT: Amounts must be all 1s for non-ERC1155s."); } totalAmount += amounts[i]; unchecked {++i;} }