Skip to content

This repository contains the project FUNCTION AND ERROR, which I developed as part of my coursework at Metacrafters

Notifications You must be signed in to change notification settings

Paraass/FunctionAndError

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Function And Error

This Error smart contract is designed to demonstrate various error handling mechanisms in Solidity, including require, assert, and revert. This contract also includes basic functionality such as setting a maximum value, incrementing a counter, and dividing two numbers. I have also included ownership checks to ensure that only the contract owner can perform certain actions and it will be safe from unauthorized Access.

Features

  • Public Variables:
    • maxValue: Stores a maximum value that can be set by the contract owner.
    • counter: A simple counter that can be incremented.
    • owner: The address of the contract owner, set during contract deployment.
  • Functions:
    • FormaxValue: Sets a new maximum value, only executable by the owner.
    • incrementCounter: Increments the counter with an assertion check.
    • forRevert: Checks if an address is the owner's address, using revert.
    • Divide: Divides two numbers with a require check to prevent division by zero.

Usage

Deploying the Contract

  1. Open the Remix IDE or any other Solidity-compatible IDE.
  2. Copy and paste the contract code into a new Solidity file.
  3. Compile the contract using the Solidity compiler version 0.8.18.
  4. Deploy the contract to an Ethereum network.

Authors

Paras Aggarwal
Email: parasaggarwal7172@gmail.com

About

This repository contains the project FUNCTION AND ERROR, which I developed as part of my coursework at Metacrafters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published