Verified Contract
0x240Ca447aD90b4AA861DF0DC3FCf4C03BbdFe6F7
Pin to watchlist
scan to copy
zkLTC Balance
0.114
hard money native
Transactions
3
Token transfers
0
Validations
0
blocks produced
Hard Money Score
100
/100
PURE HARD MONEY
share of activity in native zkLTC vs. tokens
native
3
tokens
0
Contract name
HeyueDistributor
Compiler
v0.8.19+commit.7dd6d404
Optimization
disabled
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
contract HeyueDistributor {
address public owner;
address[] public recipients;
mapping(address => bool) public isRecipient;
uint256 public constant MIN_KEEP_AMOUNT = 0.0001 ether;
uint256 public constant DISTRIBUTE_AMOUNT = 0.00001 ether;
event FundsDeposited(address indexed depositor, uint256 amount);
event FundsDistributed(address indexed recipient, uint256 amount);
event RecipientsAdded(uint256 count);
modifier onlyOwner() {
require(msg.sender == owner, "Only owner can call this function");
_;
}
constructor() {
owner = msg.sender;
}
receive() external payable {
emit FundsDeposited(msg.sender, msg.value);
}
fallback() external payable {
emit FundsDeposited(msg.sender, msg.value);
}
function deposit() external payable {
emit FundsDeposited(msg.sender, msg.value);
}
function addRecipientsBatch(address[] memory _recipients) external onlyOwner {
uint256 added = 0;
for (uint256 i = 0; i < _recipients.length; i++) {
address recipient = _recipients[i];
if (recipient != address(0) && !isRecipient[recipient]) {
recipients.push(recipient);
isRecipient[recipient] = true;
added++;
}
}
emit RecipientsAdded(added);
}
function distributeOnce() external {
require(recipients.length > 0, "No recipients");
require(address(this).balance >= DISTRIBUTE_AMOUNT, "Insufficient balance");
uint256 randomIndex = uint256(keccak256(
abi.encodePacked(block.timestamp, block.prevrandao, msg.sender)
)) % recipients.length;
address recipient = recipients[randomIndex];
(bool sent, ) = recipient.call{value: DISTRIBUTE_AMOUNT}("");
require(sent, "Transfer failed");
emit FundsDistributed(recipient, DISTRIBUTE_AMOUNT);
}
function distributeMultiple(uint256 times) external {
require(times > 0 && times <= 100, "Invalid times");
require(recipients.length > 0, "No recipients");
require(address(this).balance >= DISTRIBUTE_AMOUNT * times, "Insufficient balance");
for (uint256 i = 0; i < times; i++) {
uint256 randomIndex = uint256(keccak256(
abi.encodePacked(block.timestamp, block.prevrandao, msg.sender, i)
)) % recipients.length;
address recipient = recipients[randomIndex];
(bool sent, ) = recipient.call{value: DISTRIBUTE_AMOUNT}("");
require(sent, "Transfer failed");
emit FundsDistributed(recipient, DISTRIBUTE_AMOUNT);
}
}
function getContractBalance() external view returns (uint256) {
return address(this).balance;
}
function getRecipientCount() external view returns (uint256) {
return recipients.length;
}
function getAllRecipients() external view returns (address[] memory) {
return recipients;
}
function addRecipient(address _recipient) external onlyOwner {
require(_recipient != address(0), "Invalid address");
require(!isRecipient[_recipient], "Already a recipient");
recipients.push(_recipient);
isRecipient[_recipient] = true;
}
function removeRecipient(address _recipient) external onlyOwner {
require(isRecipient[_recipient], "Not a recipient");
for (uint256 i = 0; i < recipients.length; i++) {
if (recipients[i] == _recipient) {
recipients[i] = recipients[recipients.length - 1];
recipients.pop();
isRecipient[_recipient] = false;
break;
}
}
}
function withdraw(uint256 amount) external onlyOwner {
require(amount <= address(this).balance, "Insufficient balance");
(bool sent, ) = owner.call{value: amount}("");
require(sent, "Withdrawal failed");
}
}