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.
-
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.
To interact with the Piggy Bank Smart Contract, follow these steps:
- Deploy the contract on the Ethereum blockchain.
- Use an Ethereum wallet (e.g., MetaMask) to deposit Ether into the Piggy Bank.
- Call the
withdraw
function to retrieve funds when needed (only the contract owner can do this).
- PiggyBank smartcontract: Sepolia