I'm trying to write a contract that uses an address[]
array which should contain payable addresses. But apparently creating a payable address array doesn't work in solidity 0.5.x.
All I'm trying to do is to run a loop that transfers funds to each address in the array like this:
address[] users;
// set users
...
for (uint i = 0; i < users.length; i++){
users[i].transfer(<some_value>);
}
My super dumb solution would be to use a proxy mapping to get a payable address. It would look like this and does actually compile.
address[] users;
mapping(address => address payable) proxy;
// set users and proxy
...
for (uint i = 0; i < users.length; i++) {
address payable u = proxy[users[i]];
u.transfer(<some_value>);
}
Obviously this is pretty dumb. Is there a way to make an address array payable?