Skip to content
Verified contractExactMIT

BatchTransfer

Address0xee6be0e5b0d2ae826b6df56463115a4a471caf36
Balance

0 ETH

 

Transactions

101

 

Compiler

solc 0.8.15

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.15+commit.e14f2714
Language
solidity
Optimization
Yes, 5,000 runs
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
15,417,623
Creation transaction
0x45845c5a77…5548efd4e4

contracts/Airdrop.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

/// @title Minimal contract able to airdrop tokens once approval is given
///        heavily inspiried by: https://nft.life/batch-transfer 
/// @author 🍖
contract BatchTransfer {
  /// @notice                 transfers each token in '_tokens' to each address in '_to' from the msg.sender 
  /// @dev                    the order of '_to' and '_tokens' is very specific because it dictates which token goes to who 
  ///                         the tokens also drop in a reverse linear pattern from last on the list to the first
  /// @param  _tokenContract  which token contract you would like to use
  /// @param  _to             list of addresses to which you'd like to drop tokens token
  /// @param  _tokens          list of token ids you'd like to drop to each respective address in _to
  function batchTransfer(IERC721Partial _tokenContract, address[] calldata _to, uint256[] calldata _tokens) external {
    uint256 length = _to.length;
    while (length > 0) {
      unchecked { --length; }
      _tokenContract.transferFrom(msg.sender, _to[length], _tokens[length]);
    }
  }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 5000,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.