Managing contracts from other contracts
Solidity allows communication between smart contracts deployed in the network. It allows both creation of new contracts and interaction with existing contracts. This opens the door for a lot of features as well as security vulnerabilities.
In this recipe, you will learn to manage contracts from other contracts.
Getting ready
You need to have a working Ethereum installation for deploying and testing the smart contract. You can also use the Remix IDE to write and test the solidity code.
It is required to have a basic knowledge of solidity to understand this recipe. Go through Chapter 2, Smart Contract Development, for more information.
How to do it...
- Solidity allows creating contractsfromother contracts. This can be done during function execution or while deploying the parent contract.
- The source code of the newly deploying contract has to be known in advance. This helps in avoiding recursive creation dependencies.
- Use the new keyword for creating contracts...