Hi everyone, I need help to combine [1]. send exact amount to 3rd party smart contract address while sending [2]. depositing exact amount to my contract. any one have tried it before?
Below is the sample of my codes that I tried but not working.
constructor(address _thirdSC) payable {
owner = payable(msg.sender);
thirdSC = payable(_thirdSC);
thirdSCFee = 1 ether;
ticketPrice = 1 ether;
}
function deposit() public payable{
require(msg.value == ticketPrice,"");
payable(thirdSC).transfer(thirdSCFee); //I want this one to be auto deduct on top of the ticket price amount.
payable(address(this)).transfer(ticketPrice);// This is the base amount for ticketPrice.
}
receive() external payable{
require(msg.value == ticketPrice,"");
payable(thirdSC).transfer(thirdSCFee); //I want this one to be auto deduct on top of the ticket price amount.
payable(address(this)).transfer(ticketPrice);// This is the base amount for ticketPrice.
}