r/EthereumProgramming • u/chelo_c • Feb 21 '18
Question about iterate through mapping
Hello, I am looking for a way to iterate through a mapping. For example I have this mapping: mapping (address => uint) private shares;
And I want to iterate in a function through all addresses and send them ether according to their shares.
How can I achieve this?
Thanks
1
Upvotes
View all comments
Show parent comment
1
u/chelo_c Feb 21 '18
Oh you are right, nice. What about gas consumed? is it too much? I was thinking another way would be that each shareholder has to send a message to the smart contract to get his payout.. But I preffer if automatically every month it pays (like your function), you think this is viable?