1

When I use the toAddress.call{value: amt}(""); code, it works fine to transfer ether to EOA account but comes back false if its sent to contract. Why is that?

Hoi Nam
  • 13
  • 2

1 Answers1

1

By default, a contract can't receive Ethers and will refuse the send.

For a contract to be able to receive Ethers, you should have a function with the payable keyword (and call that function), or use the generic fallback receive function. More info at https://ethereum.stackexchange.com/a/81995/31933

Lauri Peltonen
  • 29,391
  • 3
  • 20
  • 57