Pretty straight forward: is there any way for a contract to send tokens only to addresses with non-zero (or with a minimum required amount) ETH addresses?
I have this function to send tokens to multiple addresses:
function distributeToken(address[] addresses, uint256 _value) onlyOwner {
for (uint i = 0; i < addresses.length; i++) {
balances[owner] -= _value;
balances[addresses[i]] += _value;
Transfer(owner, addresses[i], _value);
}
}
but I'm trying to add a require for non-zero balance. I changed it this way, so it should check if the receiver got at least 0.01 ETH:
function getEthBalance(address _addr, uint userBalance) constant returns(uint) {
return _addr.balance;
userBalance = _addr.balance;
}
function distributeToken(address[] addresses, uint256 _value, uint userBalance) onlyOwner {
require(userBalance >= 10000000000000000);
for (uint i = 0; i < addresses.length; i++) {
balances[owner] -= _value;
balances[addresses[i]] += _value;
Transfer(owner, addresses[i], _value);
}
}
but it doesn't work properly. Sorry but I'm new to solidity and I'm still learning it. Thank you for you helping and patience.