When sending ether to another contract it sends it to the contract?

964 views Asked by At

I try to send ether from one address to another. But in the transaction the receiver seems to be the contract address. My goal is to send from address 1 to address 2:

address1:0xDb7c83d499787E6b7660C961F8a9999E3C395AdE address2:0x9199D9323b25BA171De6b9189201Bb322Ba12274

contract-address:0xa82bcf321f584fe81e2e3cfb04eae97b422a4c4f

But the receiver in the transaction appears to be the contract: https://blockscout.mantis.hexapod.network/tx/0x9bc22ad45dbf60881151c3b94b3d3daa98bc84b1906f1ed131ee2ca9a89484eb/internal-transactions

Function:

function sendMoney() public payable {

address payable seller = payable(0x9199D9323b25BA171De6b9189201Bb322Ba12274);

seller.transfer(msg.value); }

2

There are 2 answers

8
Petr Hejda On BEST ANSWER

When you're invoking the sendMoney() function, you're sending a transaction to the contract that implements this function.

The seller.transfer(msg.value); is an internal transaction - a part of the main transaction.

0
Dinno Koluh On

I had the same problem. But it is actually working fine, the ether is sent. My mistake was that I didn't change the denomination of ether, it was set to wei. So, I was trying to send 1 wei instead of 1 ether. The transaction goes through but I couldn't see the change as the quantity was so small.