SOLIDITY β€” Contract that Creates other Contracts & Try/Catch β›“

Topics: Contract that Creates other Contracts & Try/Catch + example code

Β·

2 min read

Welcome to all future blockchain devs πŸ‘¨πŸ½β€πŸ’» to my channel! Solidity is the backbone of the Ethereum Ecosystem, thus, definitely worth learning. Blockchain is a technology that is here to stay. I am really curious which innovations will emerge in that context within the next 10 years. Today we are talking about how to create contracts with a contract as well as the try/catch functionality. All the information was derived from solidity-by-example β€” Big shout out to the team. Let’s straight jump into the world of Solidity ⬇️

Solidity Basics Intro.png

A Contract that Creates other Contracts ⚑️

By using the new keyword you can create contracts. Since Solidity version 0.8.0 the new keyword supports the create2 feature by specifying salt options.

In order to manifest all the functionalities of Solidity, you should try out the example codes in your favorite IDE. A good one to start is Ethereum Remix IDE 😊

adsdfhkjncqaewjs.jpg

Try & Catch ⚑️

Try/Catch can only catch the errors from external function calls as well as contract creation.

Here is an example code you should try out in the IDE ⬇️

wjaesnfxdcjkas.jpg

That’s it for today. Have fun trying out the example codes by solidity-by-example. Try to modify the code and think about in which real-life example you could use the functionality. Maybe you have a current project where implementation would make sense and improve your code! Have fun πŸš€

*Thanks for reading this article! If you want to support me you can do it as follows:

  1. Give me a follow here, on Medium, on Twitter, Instagram, TikTok or YouTube.
  2. Like the article.
  3. Leave a comment on the article.

I really appreciate every kind of support! Every interaction you are doing with the content will help me grow and deliver better content with time. πŸš€

Thank you, VEGXCODES*

Resources ⚑️

Link 1: https://solidity-by-example.org/new-contract

Link 2: https://solidity-by-example.org/try-catch

Note: This article also appears in a similar form on Medium and Twitter 😊

Β