-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: MigratorZap: handle punk transfers to V3 vault
- Loading branch information
1 parent
8c80191
commit 0b08371
Showing
1 changed file
with
25 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -385,19 +385,37 @@ contract MigratorZap is Ownable { | |
) | ||
{ | ||
vTokenV3 = v3NFTXFactory.vault(vaultIdV3); | ||
address assetAddress = INFTXVaultV3(vTokenV3).assetAddress(); | ||
bool isCryptoPunk = (assetAddress == TransferLib.CRYPTO_PUNKS); | ||
|
||
// random redeem v2 vTokens. Directly transferring to the v3 vault | ||
uint256[] memory idsToRedeem; | ||
uint256[] memory emptyArray; | ||
uint256[] memory idsRedeemed = INFTXVaultV2(vTokenV2).redeemTo( | ||
vTokenV2Balance / 1 ether, | ||
idsToRedeem, | ||
is1155 ? address(this) : vTokenV3 | ||
emptyArray, | ||
is1155 ? address(this) : (isCryptoPunk ? address(this) : vTokenV3) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
apoorvlathey
Author
Member
|
||
); | ||
if (isCryptoPunk) { | ||
for (uint256 i; i < idsRedeemed.length; ) { | ||
// from TransferLib._approveCryptoPunkERC721() | ||
bytes memory data = abi.encodeWithSignature( | ||
"offerPunkForSaleToAddress(uint256,uint256,address)", | ||
idsRedeemed[i], | ||
0, | ||
vTokenV3 // to = v3 vault address | ||
); | ||
(bool success, bytes memory resultData) = TransferLib | ||
.CRYPTO_PUNKS | ||
.call(data); | ||
require(success, string(resultData)); | ||
|
||
unchecked { | ||
++i; | ||
} | ||
} | ||
} | ||
if (is1155) { | ||
IERC1155(INFTXVaultV3(vTokenV3).assetAddress()).setApprovalForAll( | ||
vTokenV3, | ||
true | ||
); | ||
IERC1155(assetAddress).setApprovalForAll(vTokenV3, true); | ||
} | ||
|
||
// fractional portion of vToken would be left | ||
|
What about
CRYPTO_KITTIES
? As far as I see they also don't support direct pushing:NFTXVaultUpgradeableV3.sol#L971-L978
NFTXVaultUpgradeableV3.sol#L1003-L1015