5

Is there a command for a smart contract to deploy another? As an example, is it possible to create a token factory, where users can select the name/total supply, and be given ownership of a new contract?

And if possible, what would the prerequisites be for this to be achievable? Eg. would a new account per contract be required?

1 Answer 1

1

I don't know if there is a way for a smart contract to create another smart contract itself.

However, I'd say the use case for this would have to be pretty damn extravagant.

Given your token factory example, it wouldn't make sense to approach it that way. In EOS, instead of generating a smart contract per token you would have multiple tokens based off the same contract where only the creator of a particular token can administer this.

The best example of this is the eosio.token contract where the idea is anyone can create their own token and all share the exact same smart contract. This is much more efficient as instead of 1,000 tokens taking the RAM utilisation of 1,000 smart contracts, it's just using 1 and people can depend further on it's code, it can be unhealthy for every single dev to create their interpretation of a token contract when it can be standardised.

Therefore, if you're looking for users to be able to administer X you should try see if you can structure one and only contract for everyone to use.

Given RAM prices, this can also amount to a huge difference in costs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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