// SPDX-License-Identifier: MIT pragma solidity 0.8.24; /** * GMTronMultisender (TronMinter, 26 Nov 2026) * * Sends one TRC-20 token from the caller to many wallets in one transaction. * TRON port of ethtokenlaunch.com/contracts/GMMultisender.sol. * * - Tokens move straight from msg.sender to each recipient with transferFrom. * The contract never holds tokens or TRX, so there is nothing in it to take. * - It always spends from msg.sender. An approval given to this contract can * only ever be used by the wallet that gave it. * - No owner, no admin, no fee logic, no upgrade path. The TronMinter service * fee is a separate TRX payment checked by the website. * * TRON differences handled here: * - TRC-20 USDT on TRON declares `returns (bool)` but its transfer() comes * back false even when it worked (SunSwap's TransferHelper special-cases it * for the same reason). So a false return is not trusted either way: when * any call returns false, the sender's balance must have dropped by at * least the batch total, or the whole batch reverts. Tokens that return * nothing, or true, are taken at their word as on the EVM version. * - A call to an address with no code "succeeds" and moves nothing, so the * token must have code. * - MAX_RECIPIENTS is 300. The website sends smaller batches (see the * multisend_batch_tron setting) because of TRON's per-transaction CPU time * limit and the energy each batch burns. */ interface ITRC20Balance { function balanceOf(address) external view returns (uint256); } contract GMTronMultisender { uint256 public constant MAX_RECIPIENTS = 300; event Multisent(address indexed sender, address indexed token, uint256 recipients, uint256 total); error LengthMismatch(); error BadRecipientCount(); error NotAContract(); error ZeroRecipient(uint256 index); error TransferFailed(uint256 index); error BalanceNotMoved(); function multisendToken(address token, address[] calldata recipients, uint256[] calldata amounts) external { uint256 n = recipients.length; if (n != amounts.length) revert LengthMismatch(); if (n == 0 || n > MAX_RECIPIENTS) revert BadRecipientCount(); if (token.code.length == 0) revert NotAContract(); uint256 before = ITRC20Balance(token).balanceOf(msg.sender); uint256 total; bool sawFalse; for (uint256 i; i < n; ) { address to = recipients[i]; if (to == address(0)) revert ZeroRecipient(i); uint256 amount = amounts[i]; (bool ok, bytes memory data) = token.call( abi.encodeWithSelector(0x23b872dd, msg.sender, to, amount) ); if (!ok) revert TransferFailed(i); if (data.length != 0) { if (data.length < 32) revert TransferFailed(i); if (abi.decode(data, (uint256)) == 0) sawFalse = true; } total += amount; unchecked { ++i; } } if (sawFalse) { uint256 afterBal = ITRC20Balance(token).balanceOf(msg.sender); if (afterBal > before || before - afterBal < total) revert BalanceNotMoved(); } emit Multisent(msg.sender, token, n, total); } }