0
address[] emp = [address1,address2];
amount = total/emp.length;
for(uint256 i=0;i<employees.length;i++)
{
    wallet = emp[i];
    wallet.transfer(amount);
}

So This is the error I get.

TypeError: Type address is not implicitly convertible to expected address type payable

wallet = emp[i]; ^-----^

Help would be appreciated!

vteja711
  • 402
  • 5
  • 17

1 Answers1

0

An address needs to be of type payable if you want to send Ethers into it.

Looking at the answer here (and its comments): Member function "transfer" not found or not visible after argument-dependent lookup in contract? you can convert a regular address into address payable through uint160:

Converting address to address payable is possible via conversion through uint160

So something like this seems to be at least compile:

address a = 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c;
uint160 b = uint160(a);
address payable c = address(b);
Lauri Peltonen
  • 29,391
  • 3
  • 20
  • 57