Skip to content

Commit 0b08371

Browse files
committed
fix: MigratorZap: handle punk transfers to V3 vault
1 parent 8c80191 commit 0b08371

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

src/zaps/MigratorZap.sol

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -385,19 +385,37 @@ contract MigratorZap is Ownable {
385385
)
386386
{
387387
vTokenV3 = v3NFTXFactory.vault(vaultIdV3);
388+
address assetAddress = INFTXVaultV3(vTokenV3).assetAddress();
389+
bool isCryptoPunk = (assetAddress == TransferLib.CRYPTO_PUNKS);
388390

389391
// random redeem v2 vTokens. Directly transferring to the v3 vault
390-
uint256[] memory idsToRedeem;
392+
uint256[] memory emptyArray;
391393
uint256[] memory idsRedeemed = INFTXVaultV2(vTokenV2).redeemTo(
392394
vTokenV2Balance / 1 ether,
393-
idsToRedeem,
394-
is1155 ? address(this) : vTokenV3
395+
emptyArray,
396+
is1155 ? address(this) : (isCryptoPunk ? address(this) : vTokenV3)
395397
);
398+
if (isCryptoPunk) {
399+
for (uint256 i; i < idsRedeemed.length; ) {
400+
// from TransferLib._approveCryptoPunkERC721()
401+
bytes memory data = abi.encodeWithSignature(
402+
"offerPunkForSaleToAddress(uint256,uint256,address)",
403+
idsRedeemed[i],
404+
0,
405+
vTokenV3 // to = v3 vault address
406+
);
407+
(bool success, bytes memory resultData) = TransferLib
408+
.CRYPTO_PUNKS
409+
.call(data);
410+
require(success, string(resultData));
411+
412+
unchecked {
413+
++i;
414+
}
415+
}
416+
}
396417
if (is1155) {
397-
IERC1155(INFTXVaultV3(vTokenV3).assetAddress()).setApprovalForAll(
398-
vTokenV3,
399-
true
400-
);
418+
IERC1155(assetAddress).setApprovalForAll(vTokenV3, true);
401419
}
402420

403421
// fractional portion of vToken would be left

0 commit comments

Comments
 (0)