Search⌘ K
AI Features

Solution: Create a Contract with Attributes and Functions

Explore how to create a Solidity smart contract named Challenge, define private attributes, implement a constructor for input validation, and deploy the contract with a run script. This lesson helps you understand contract structure, parameter handling, and error management in Solidity.

Flowchart of a possible solution

In this challenge, you needed to create a contract named Challenge. This contract has a private variable called targetAmount. It also has a constructor, which has a parameter named amount and checks if the targetAmount is equal to the amount. If true, the program ...