CalculatorWeb3

View on GitHub


CalculatorVW3 is a smart contract written in Solidity that performs main arithmetic operations while showcasing fundamental smart contract development concepts.

The contract keeps track of the most recent calculation result and emits an event for every operation executed. This enables off-chain applications and users to easily monitor contract activity.

This project was built using the Foundry smart contract development framework using core Solidity concepts and best practices including: Smart contract structure, Events, Enums, Modifiers, State variables, NatSpec documentation, Foundry project organization, and Unit testing.

Created using Solidity version 0.8.33

CalculatorWeb3

Operations

OperationFunction Name
Additionaddition()
Subtractionsubtraction()
Multiplicationmultiplication()
Divisiondivision()
Powerpower()

Contract Structure

/// @notice Stores operation types
enum Operation {
    ADDITION,
    SUBTRACTION,
    MULTIPLICATION,
    DIVISION,
    POWER
}