Verified contractExactUNLICENSED
ERC20TokenMultiSender
Address0xc0eaa4efe5be2b447605d0db1f62547c79cc4543
- Balance
0 ETH
- Transactions
265
- Compiler
solc 0.8.24
- Same code
Only this contract
Details
- Compiler
- solc 0.8.24+commit.e11b9ed9
- Language
- solidity
- Optimization
- Yes, 1,000 runs
- EVM version
- paris
- License
- UNLICENSED
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 20,387,432
- Creation transaction
- 0x5445832a42…121cd675c8
3 files
contracts/ERC20TokenMultiSender.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
/*
&&&&&& &&&&& &%
&&&&&&&&&&&&&&& && &&&&&&&&&&%
&&&&&&& &&&&& #&&&&&&&&&&&&&
&&&&& &&&&&&& && &&&& &% &&&&&&&
&&. &&&&&&&&&& & %&&&&&&& &&&&
&&&& *&&&&&&&&& &&&&&&&&& &&&&
.&&& &&&&&&&& &&&&&&&& &&&
.&&&&&&& &&&&&&& &&&%
&&&&&& &&&&&&
&&&&& /&&&&.
&&&& %&&& #&&&,
&&&&( &&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&
&&&% &&&&&&&&&&&&&&&&&&&&&&&&& &&&
&&& &&&* &&&&&&&&&&&&&&&&&&&&& &&*
&&& .&&&&&& &&&&&&&&&&&&&&&&&&&& &&&&& &&
&&& #&&&&&& &&&&&&&&&&&&&&&&&&&&& &&&&& &&
&&& &&&& &&&&&&&&&&&&&&&&&&&&&& #&& &&&
&&& &&&&&&&&&&&&&&&&&&&&&&&&, *&&&
(&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&%
&&&&&&&&&&&&&&&&& &&&&&
&&&&&&&&&&&&&&&&&& %&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#
&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&
*/
/**
* Token Multi Sender contract
* This contract is used to send multiple tokens ERC20 to multiple addresses
*
*/
/// @title TokenMultiSender
/// @author Smithii
/// @notice This contract is used to send multiple tokens ERC20 to multiple addresses
import {Payable} from "./utils/Payable.sol";
contract ERC20TokenMultiSender is Payable {
constructor(
address _payments,
string memory _serviceId
) Payable(_payments, _serviceId) {}
/// AirDrop tokens and pay the service fee
/// @param _projectId the project id
/// @param _token the token address
/// @param _addresses the addresses to send the tokens
/// @param _amounts the amounts to send to each address
/// @param _totalAmount the total amount to send
function airdropTokens(
bytes32 _projectId,
address _token,
address[] calldata _addresses,
uint256[] calldata _amounts,
uint256 _totalAmount
) external payable {
/// @notice pay the service fee
payService(_projectId, _token, _addresses.length);
/// @notice airdrop the tokens
_airdropTokens(_token, _addresses, _amounts, _totalAmount);
}
/// Ultra light weight gas airdrop function by GasliteDrop 0x09350F89e2D7B6e96bA730783c2d76137B045FEF
/**
/// @author Harrison (@PopPunkOnChain)
/// @author Gaslite (@GasliteGG)
/// @author Pop Punk LLC (@PopPunkLLC)
*/
/// @param _token the token address
/// @param _addresses the addresses to send the tokens
/// @param _amounts the amounts to send to each address
/// @param _totalAmount the total amount to send
function _airdropTokens(
address _token,
address[] calldata _addresses,
uint256[] calldata _amounts,
uint256 _totalAmount
) internal {
assembly {
// Check that the number of addresses matches the number of amounts
if iszero(eq(_amounts.length, _addresses.length)) {
revert(0, 0)
}
// transferFrom(address from, address to, uint256 amount)
mstore(0x00, hex"23b872dd")
// from address
mstore(0x04, caller())
// to address (this contract)
mstore(0x24, address())
// total amount
mstore(0x44, _totalAmount)
// transfer total amount to this contract
if iszero(call(gas(), _token, 0, 0x00, 0x64, 0, 0)) {
revert(0, 0)
}
// transfer(address to, uint256 value)
mstore(0x00, hex"a9059cbb")
// end of array
let end := add(_addresses.offset, shl(5, _addresses.length))
// diff = _addresses.offset - _amounts.offset
let diff := sub(_addresses.offset, _amounts.offset)
// Loop through the addresses
for {
let addressOffset := _addresses.offset
} 1 {
} {
// to address
mstore(0x04, calldataload(addressOffset))
// amount
mstore(0x24, calldataload(sub(addressOffset, diff)))
// transfer the tokens
if iszero(call(gas(), _token, 0, 0x00, 0x64, 0, 0)) {
revert(0, 0)
}
// increment the address offset
addressOffset := add(addressOffset, 0x20)
// if addressOffset >= end, break
if iszero(lt(addressOffset, end)) {
break
}
}
}
}
}
contracts/interfaces/marketplace/IPayments.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
/*
* IPayments interface
*/
/// @title Payments
/// @author Smithii
interface IPayments {
struct Service {
bytes32 serviceId;
uint256 pricePerItem;
bool active;
}
struct Invoice {
address user;
Service service;
uint256 qty;
uint256 total;
uint256 timestamp;
}
/// Events
event ServiceAdded(bytes32 serviceId, string name, uint256 price);
event ServiceSet(bytes32 serviceId, bool active);
event ServicePaid(
bytes32 projectId,
address contractAddress,
bytes32 serviceId,
address user,
uint256 amount,
uint256 timestamp
);
event ServiceWithdraw(
bytes32 projectId,
address contractAddress,
bytes32 serviceId,
uint256 amount
);
/// Errors
error ServiceNotActive(bytes32 serviceId);
error InvalidTotalAmount();
error ServiceAlreadyPaid(
bytes32 projectId,
address contractAddress,
bytes32 serviceId
);
/// Add a service to the payment program
/// @param _serviceId the service id
/// @param _pricePerItem the price per item
function addService(bytes32 _serviceId, uint256 _pricePerItem) external;
/// Set the service active status
/// @param _serviceId the service id
/// @param _active the active status
function setService(bytes32 _serviceId, bool _active) external;
/// function payService by projectId and contract address
/// @param _projectId bytes32 projectId
/// @param _contract the contract address
/// @param _serviceId the service id
/// @param _qty the qty of items to pay
function payService(
bytes32 _projectId,
address _contract,
bytes32 _serviceId,
uint256 _qty
) external payable;
/// Withdraw per invoice
/// @param _projectId the project id
/// @param _contract the contract address
/// @param _serviceId the service id
/// @param _to the address to withdraw the balance
function withdraw(
bytes32 _projectId,
address _contract,
bytes32 _serviceId,
address payable _to
) external;
/// Withdraw the contract balance
/// @param _to the address to withdraw the balance
function withdrawAll(address payable _to) external;
}
contracts/utils/Payable.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
/// @title Payable
/// @author Smithii
import {IPayments} from "../interfaces/marketplace/IPayments.sol";
abstract contract Payable {
address public payments = address(0);
bytes32 public serviceId;
constructor(address _payments, string memory _serviceId) {
payments = _payments;
serviceId = keccak256(abi.encodePacked(_serviceId));
}
///
/// @param _projectId the project id
/// @param _token the token address
/// @param qty the qty of items to pay
function payService(
bytes32 _projectId,
address _token,
uint256 qty
) public payable {
IPayments(payments).payService{value: msg.value}(
_projectId,
_token,
serviceId,
qty
);
}
receive() external payable {}
}
Compiler settingsShow
{
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 1000,
"enabled": true
},
"evmVersion": "paris",
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.