Piggy Bank Smart Contract

Description

The Piggy Bank Smart Contract is a simple Ethereum smart contract that allows users to deposit and withdraw Ether (ETH) in a savings-like manner. Users can deposit funds into the Piggy Bank and later withdraw them when needed. This contract is designed to serve as a basic example of a savings contract on the Ethereum blockchain.

Features

  • Deposit Functionality: Users can deposit Ether into the Piggy Bank by calling the deposit function.

  • Withdrawal Functionality: The contract owner can initiate a withdrawal of all funds from the Piggy Bank using the withdraw function.

  • Balance Checking: Users and the contract owner can check the current balance of the Piggy Bank using the getBalance function.

  • Depositor Count: The contract owner can check the number of depositors using the getDepositorCount function.

Getting Started

To interact with the Piggy Bank Smart Contract, follow these steps:

  1. Deploy the contract on the Ethereum blockchain.
  2. Use an Ethereum wallet (e.g., MetaMask) to deposit Ether into the Piggy Bank.
  3. Call the withdraw function to retrieve funds when needed (only the contract owner can do this).

Deployed Contract