I am trying to transfer all NFTS from one address to another using solidity and i wana bundle all in just one transaction. The issue is that when i do that, it is says the caller is not the owner of the nft or the nft is not approved. The problem here is that the msg.sender is not the user on my website. Its the contract calling a function from my solidty IERC721 interface.

Thats my contract code.

    // SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.7.0 <0.9.0;

interface IERC721 {
    function transferFrom(address from, address to, uint256 tokenId)external;

contract BulkTransferer {
    IERC721 collection;
    address owner;

    constructor() {
        owner = msg.sender;

modifier isOwner {
    require(msg.sender == owner);

function bulkTransfer(address _from, address _to, uint256[] memory _tokenIds, address[] memory contracts) external {
    for (uint256 i = 0; i < _tokenIds.length; i++) {
        collection = IERC721(contracts[i]);
        collection.transferFrom(_from, _to, _tokenIds[i]);

function destroySmartContract(address payable _to) public isOwner {


How can I bypass that ? I just wanna send multiple nfts from one address to another. Is there a way to set the msg.sender as the one calling the contract function ?


1 Answer 1


First you need to call approveForAll passing contract address as parameter from NFT Owner, then you would be able to complete this transaction.

  • But I have 6 different nfts from difference contract
    – BigBoy
    Jul 3, 2022 at 12:57
  • Then first you need to call approve for each of them passing this contract address, and then call this method
    – Ahsan Shah
    Jul 3, 2022 at 13:00
  • cant i approve all my one click ?
    – BigBoy
    Jul 3, 2022 at 14:50
  • No sir, You need to approve them one by one if all of those NFTs are of different contract
    – Ahsan Shah
    Jul 4, 2022 at 4:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.