2

If I want to create a smart contract with an action 'Create Game' and on calling that action a new contract be formed, how is it possible?

  • I don't think setcode is in the available contract API so I don't think it's possible directly – confused00 Sep 11 '18 at 14:00
1

You can't create a 'new' contract, but you can call another contract's function and create a new object in that contract to save the state.

You can refer to eosio.token inline functions get_balance/get_supply where both functions are accessible from any other contracts by just initializing eosio.token in your own contract.

edit: It is not possible to create an object in another contract as it will consume ram

| improve this answer | |
0

Think of your contract as a factory. You keep a collection of games. Each game is an instance of a struct called game - it has all the state fields of a game. When someone creates a new game you just add one to the collection.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.