Create Asset / Smart Contract using a Smart Contract

I am new to Algorand and was wondering if it is possible to write a smart contract that is able to create another smart contract (like a factory). Something like Expressions and Control Structures — Solidity 0.5.0 documentation in Solidity.

Similarly, can a smart contract also create a new asset?


No contracts cant create other contracts or assets, but a call to a smartcontract can be grouped to with an asset creation transaction or smart contract creation transaction to approve the creation.

To complement @JasonW’s answer, while you can make smart contracts create smart contracts and assets by using group transactions, for many use cases, you most likely do not want to do it this way on Algorand.

The exact pattern you want to use may depend on the actual application.
For example, to create a UniSwap-like smart contract on Algorand, you most likely want to use a single stateful smart contract application and one escrow stateless smart contract for each pair.
See GitHub - hyplabs/AlgoSwap: Decentralized Uniswap-like exchange for Algorand Standard Assets. Currently a work-in-progress.

1 Like