I am making an app where you can make battles with other people. I have created a Battle
contract that is created for each new battle and I have created a Battles
contract to keep track of all battle contract addresses and all player addresses.
Now what is the best way to create a new battle contract and then store that battle contract address and player address in the Battles
contract?
I need to make sure that Battles
contract which keeps track of all battles and players cannot be altered publicly.
What is the best way to do this?
Should the user create a Battle
contract representing a new battle and from within the constructor function
of that new contract, send a transaction
to Battle
contract to store the new battle contract address?
Or should the user make a transaction the the parent Battles
contract and the parent Battles
contract then makes a transaction to create a new battle? Could the parent Battles
contract then receive the newly created contract address immediately for it to store?
Also does this make sense for a contract design
to create a new contract for each individual battle and then have one parent contract store addresses for all the individual battle contracts?