maybe also how to develop a small application with the wanted functionality.....
I hope someone give me useful answer. Thanks
Something like this:
// resend all sent ether. Or maybe some part of it?
function sendEther(address _to) public payable {
_to.transfer(msg.value);
}
mapping (address => uint256) public balances;
// Send tokens in exchange of Ether
function sendTokens(address _to) public payable {
uint divider = 10;
uint _value = msg.value / divider;
balances[msg.sender] -= _value;
balances[_to] += _value;
}
}
The actual logic of how much Ether to send and how many tokens to send is up to you. And the code is missing a lot of security checks, but you get the idea.
Also, as already pointed out in another answer, you should consider using the fallback function if you want to make sure incoming Ether gets processed.