I want to pay two transactions within one function. The msg.sender should pay a fee to the contract first. The rest which is still in msg.value should be transferred to the seller. I always get an error. To clarify i tested both transactions by their own and it worked and i have implemented a receive() function that the contract can receive the funds. Here is the code:
function sendMoney() public payable {
address payable seller = payable(address(this));
address payable sellerino = payable(0x910DCE3971F71Ee82785FF86B47CaB938eBB9E68);
sellerino.transfer(10);
seller.transfer(msg.value);
}
Here the error: https://blockscout.mantis.hexapod.network/tx/0x343817da970dce47c74094f4766f9c7f21ee258ea848e117893afa53c4768dac/internal-transactions
Additional Code:
function buyTicketFromAttendee(uint256 _ticketId)
external
payable
{
require(eventticket[_ticketId - 1].availableForResell = true,"ticket not for sale");
uint256 _priceToPay = eventticket[_ticketId - 1].ticketPrice;
//address owner = ownerOf(_ticketId);
require((msg.value >= _priceToPay + transferFee),"not enough money");
address seller = eventticket[_ticketId - 1].seller;
address owner = eventticket[_ticketId - 1].owner;
payable(owner).transfer(transferFee);
payable(seller).transfer(msg.value - transferFee);
_transfer(address(this), msg.sender, _ticketId);
//payable(seller).transfer(_priceToPay);
eventticket[_ticketId - 1].availableForResell = false;
}