Skip to content

monipigr/basic-solidity-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿงฎ Calculadora Smart Contract

๐Ÿ“ Overview

The Calculadora smart contract provides basic arithmetic operations directly on the Ethereum blockchain. This contract allows users to add, subtract, multiply, divide, and calculate percentages securely and transparently.

Designed in Solidity 0.8.24, it includes built-in checks to prevent invalid operations and ensures smooth execution.


โœจ Features

โœ”๏ธ Supports basic mathematical operations:

  • โž• Addition
  • โž– Subtraction
  • โœ–๏ธ Multiplication
  • โž— Division
  • ๐Ÿ“Š Percentage Calculation

โœ”๏ธ Implements modifiers to ensure:

  • Only positive numbers are used in operations
  • The first number is greater than or equal to the second in subtraction and division

โœ”๏ธ Emits events for key operations (Addition, Subtraction, Multiplication)

โœ”๏ธ Uses internal and private functions for optimized logic execution


โš™๏ธ How to Use

๐Ÿ›  Tools and Environment

โœ… Remix IDE (Remix Ethereum)
โœ… Solidity 0.8.24 compiler

๐Ÿš€ Deploying the Smart Contract

  1. Open Remix IDE (Remix Ethereum)
  2. Create a new Solidity file
    • Click on File Explorers > "Create New File"
    • Name it Calculadora.sol
  3. Copy & Paste the contract code into the file
  4. Select Solidity Compiler
    • Navigate to the "Solidity Compiler" tab
    • Choose 0.8.24 as the compiler version
    • Click Compile Calculadora.sol
  5. Deploy the Contract
    • Go to the "Deploy & Run Transactions" tab
    • Select a test network (e.g., Remix VM (Cancun))
    • Click ๐Ÿš€ Deploy

โœ… Interacting & Testing

Once deployed, test the functions. Here you have some examples:

โž• Addition

  • Call addition(num1, num2)
  • Check the emitted event Addition(result)
  • Confirm that the result variable updates correctly

โœ–๏ธ Multiplication

  • Call multiplier(num1, num2)
  • Check the emitted event Multiplier(result)
  • Ensure the result updates correctly

โž— Division

  • Call division(num1, num2) (num1 must be โ‰ฅ num2)
  • Ensure the result updates correctly

๐Ÿ“œ License

This project is licensed under LGPL-3.0-only

About

A Solidity smart contract that enables basic arithmetic operations such as addition, subtraction, multiplication, division, and percentages on-chain, with built-in validation and event-based transparency.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors