I am building two smart contracts, one is casino contract and the other one is lottery contract(planning to deploy it separately). I want to combine both the placebet(casino) function and buyticket(lottery) function in one call. Once user would call placebet on casino contract, he will automatically buys lotteryticket also. Any help will be appreciated. Thank you.
Note: (Pls. respect) I am just a newbie, no formal coding education, I am just studying how to make dapp.
If I understand correctly, you need to make the first method call another method from another contract.
Here is an example:
The basic idea in this example is that we call the
LotteryContract's
method inCasinoContract
. In this case, when the user makes a bid via theplaceBet
method, the contract will call anotherbuyTicket
methodIf you meant to make two calls to different contracts at once from the user, you can't do that. The user can only call one method from the contract, which will call other methods inside itself.