Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- EmitBot
- Optimization enabled
- true
- Compiler version
- v0.8.20+commit.a1b79de6
- Optimization runs
- 200
- EVM Version
- paris
- Verified at
- 2025-03-19T10:19:24.505889Z
contracts/EmitBot.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract EmitBot is Ownable {
// Event emitted when an airdrop is executed
event AirdropExecuted(
address tokenAddress,
uint256 totalAmount,
address[] recipients,
uint256[] amounts
);
/**
* @dev Execute an airdrop of ERC20 tokens
* @param tokenAddress The address of the ERC20 token to airdrop
* @param recipients Array of recipient addresses
* @param multipliers Array of point multipliers for each recipient
* @param totalAmount Total amount of tokens to distribute
*/
function executeAirdrop(
address tokenAddress,
address[] calldata recipients,
uint256[] calldata multipliers,
uint256 totalAmount
) external onlyOwner {
require(recipients.length > 0, "No recipients provided");
require(recipients.length == multipliers.length, "Arrays length mismatch");
IERC20 token = IERC20(tokenAddress);
// Calculate total points
uint256 totalPoints = 0;
for (uint256 i = 0; i < multipliers.length; i++) {
totalPoints += multipliers[i];
}
require(totalPoints > 0, "Total points must be greater than zero");
// Calculate and transfer tokens to each recipient
uint256[] memory amounts = new uint256[](recipients.length);
for (uint256 i = 0; i < recipients.length; i++) {
// Calculate amount based on points
amounts[i] = (totalAmount * multipliers[i]) / totalPoints;
// Transfer tokens to recipient
require(token.transfer(recipients[i], amounts[i]), "Token transfer failed");
}
// Emit event
emit AirdropExecuted(tokenAddress, totalAmount, recipients, amounts);
}
/**
* @dev Recover any ERC20 tokens sent to the contract
* @param tokenAddress The address of the ERC20 token to recover
* @param amount The amount of tokens to recover
*/
function recoverERC20(address tokenAddress, uint256 amount) external onlyOwner {
IERC20 token = IERC20(tokenAddress);
require(token.transfer(owner(), amount), "Token recovery failed");
}
}
@openzeppelin/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
@openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
Compiler Settings
{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"":["ast"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{},"evmVersion":"paris"}
Contract ABI
[{"type":"event","name":"AirdropExecuted","inputs":[{"type":"address","name":"tokenAddress","internalType":"address","indexed":false},{"type":"uint256","name":"totalAmount","internalType":"uint256","indexed":false},{"type":"address[]","name":"recipients","internalType":"address[]","indexed":false},{"type":"uint256[]","name":"amounts","internalType":"uint256[]","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"executeAirdrop","inputs":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"address[]","name":"recipients","internalType":"address[]"},{"type":"uint256[]","name":"multipliers","internalType":"uint256[]"},{"type":"uint256","name":"totalAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"recoverERC20","inputs":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6108f98061007e6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c57806380ec5c3e146100665780638980f11f146100795780638da5cb5b1461008c578063f2fde38b146100ab575b600080fd5b6100646100be565b005b610064610074366004610685565b6100d2565b61006461008736600461070e565b610416565b600054604080516001600160a01b039092168252519081900360200190f35b6100646100b9366004610738565b6104fa565b6100c6610573565b6100d060006105cd565b565b6100da610573565b836101255760405162461bcd60e51b8152602060048201526016602482015275139bc81c9958da5c1a595b9d1cc81c1c9bdd9a59195960521b60448201526064015b60405180910390fd5b83821461016d5760405162461bcd60e51b8152602060048201526016602482015275082e4e4c2f2e640d8cadccee8d040dad2e6dac2e8c6d60531b604482015260640161011c565b856000805b848110156101b25785858281811061018c5761018c61075a565b905060200201358261019e9190610786565b9150806101aa8161079f565b915050610172565b50600081116102125760405162461bcd60e51b815260206004820152602660248201527f546f74616c20706f696e7473206d7573742062652067726561746572207468616044820152656e207a65726f60d01b606482015260840161011c565b60008667ffffffffffffffff81111561022d5761022d6107b8565b604051908082528060200260200182016040528015610256578160200160208202803683370190505b50905060005b878110156103cb57828787838181106102775761027761075a565b905060200201358661028991906107ce565b61029391906107e5565b8282815181106102a5576102a561075a565b602002602001018181525050836001600160a01b031663a9059cbb8a8a848181106102d2576102d261075a565b90506020020160208101906102e79190610738565b8484815181106102f9576102f961075a565b60200260200101516040518363ffffffff1660e01b81526004016103329291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af1158015610351573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103759190610807565b6103b95760405162461bcd60e51b8152602060048201526015602482015274151bdad95b881d1c985b9cd9995c8819985a5b1959605a1b604482015260640161011c565b806103c38161079f565b91505061025c565b507f6226183b94db08d869663a268f4b9a311a0a5d0778f3a2a5b374eddea5f2ca6e89858a8a85604051610403959493929190610829565b60405180910390a1505050505050505050565b61041e610573565b816001600160a01b03811663a9059cbb6104406000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af115801561048d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b19190610807565b6104f55760405162461bcd60e51b8152602060048201526015602482015274151bdad95b881c9958dbdd995c9e4819985a5b1959605a1b604482015260640161011c565b505050565b610502610573565b6001600160a01b0381166105675760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161011c565b610570816105cd565b50565b6000546001600160a01b031633146100d05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161011c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461063457600080fd5b919050565b60008083601f84011261064b57600080fd5b50813567ffffffffffffffff81111561066357600080fd5b6020830191508360208260051b850101111561067e57600080fd5b9250929050565b6000806000806000806080878903121561069e57600080fd5b6106a78761061d565b9550602087013567ffffffffffffffff808211156106c457600080fd5b6106d08a838b01610639565b909750955060408901359150808211156106e957600080fd5b506106f689828a01610639565b979a9699509497949695606090950135949350505050565b6000806040838503121561072157600080fd5b61072a8361061d565b946020939093013593505050565b60006020828403121561074a57600080fd5b6107538261061d565b9392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561079957610799610770565b92915050565b6000600182016107b1576107b1610770565b5060010190565b634e487b7160e01b600052604160045260246000fd5b808202811582820484141761079957610799610770565b60008261080257634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561081957600080fd5b8151801515811461075357600080fd5b6001600160a01b03868116825260208083018790526080604084018190528301859052600091869160a08501845b8881101561087c57836108698661061d565b1682529382019390820190600101610857565b50858103606087015286518082529082019350915080860160005b838110156108b357815185529382019390820190600101610897565b50929a995050505050505050505056fea2646970667358221220da2034c9411563e19460a39bb2bbe2d40b28bb9eddee649726b32bccb5fc646c64736f6c63430008140033
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c57806380ec5c3e146100665780638980f11f146100795780638da5cb5b1461008c578063f2fde38b146100ab575b600080fd5b6100646100be565b005b610064610074366004610685565b6100d2565b61006461008736600461070e565b610416565b600054604080516001600160a01b039092168252519081900360200190f35b6100646100b9366004610738565b6104fa565b6100c6610573565b6100d060006105cd565b565b6100da610573565b836101255760405162461bcd60e51b8152602060048201526016602482015275139bc81c9958da5c1a595b9d1cc81c1c9bdd9a59195960521b60448201526064015b60405180910390fd5b83821461016d5760405162461bcd60e51b8152602060048201526016602482015275082e4e4c2f2e640d8cadccee8d040dad2e6dac2e8c6d60531b604482015260640161011c565b856000805b848110156101b25785858281811061018c5761018c61075a565b905060200201358261019e9190610786565b9150806101aa8161079f565b915050610172565b50600081116102125760405162461bcd60e51b815260206004820152602660248201527f546f74616c20706f696e7473206d7573742062652067726561746572207468616044820152656e207a65726f60d01b606482015260840161011c565b60008667ffffffffffffffff81111561022d5761022d6107b8565b604051908082528060200260200182016040528015610256578160200160208202803683370190505b50905060005b878110156103cb57828787838181106102775761027761075a565b905060200201358661028991906107ce565b61029391906107e5565b8282815181106102a5576102a561075a565b602002602001018181525050836001600160a01b031663a9059cbb8a8a848181106102d2576102d261075a565b90506020020160208101906102e79190610738565b8484815181106102f9576102f961075a565b60200260200101516040518363ffffffff1660e01b81526004016103329291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af1158015610351573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103759190610807565b6103b95760405162461bcd60e51b8152602060048201526015602482015274151bdad95b881d1c985b9cd9995c8819985a5b1959605a1b604482015260640161011c565b806103c38161079f565b91505061025c565b507f6226183b94db08d869663a268f4b9a311a0a5d0778f3a2a5b374eddea5f2ca6e89858a8a85604051610403959493929190610829565b60405180910390a1505050505050505050565b61041e610573565b816001600160a01b03811663a9059cbb6104406000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af115801561048d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b19190610807565b6104f55760405162461bcd60e51b8152602060048201526015602482015274151bdad95b881c9958dbdd995c9e4819985a5b1959605a1b604482015260640161011c565b505050565b610502610573565b6001600160a01b0381166105675760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161011c565b610570816105cd565b50565b6000546001600160a01b031633146100d05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161011c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461063457600080fd5b919050565b60008083601f84011261064b57600080fd5b50813567ffffffffffffffff81111561066357600080fd5b6020830191508360208260051b850101111561067e57600080fd5b9250929050565b6000806000806000806080878903121561069e57600080fd5b6106a78761061d565b9550602087013567ffffffffffffffff808211156106c457600080fd5b6106d08a838b01610639565b909750955060408901359150808211156106e957600080fd5b506106f689828a01610639565b979a9699509497949695606090950135949350505050565b6000806040838503121561072157600080fd5b61072a8361061d565b946020939093013593505050565b60006020828403121561074a57600080fd5b6107538261061d565b9392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561079957610799610770565b92915050565b6000600182016107b1576107b1610770565b5060010190565b634e487b7160e01b600052604160045260246000fd5b808202811582820484141761079957610799610770565b60008261080257634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561081957600080fd5b8151801515811461075357600080fd5b6001600160a01b03868116825260208083018790526080604084018190528301859052600091869160a08501845b8881101561087c57836108698661061d565b1682529382019390820190600101610857565b50858103606087015286518082529082019350915080860160005b838110156108b357815185529382019390820190600101610897565b50929a995050505050505050505056fea2646970667358221220da2034c9411563e19460a39bb2bbe2d40b28bb9eddee649726b32bccb5fc646c64736f6c63430008140033