diff --git a/SimpleBank/SimpleBank.so b/SimpleBank/SimpleBank.sol similarity index 97% rename from SimpleBank/SimpleBank.so rename to SimpleBank/SimpleBank.sol index 8ea497b..30006d9 100644 --- a/SimpleBank/SimpleBank.so +++ b/SimpleBank/SimpleBank.sol @@ -1,32 +1,32 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -// SimpleBank contract definition -contract SimpleBank { - // Mapping from addresses to balances - mapping(address => uint) private balances; - - // Event declarations - event DepositMade(address indexed accountAddress, uint amount); - event WithdrawalMade(address indexed accountAddress, uint withdrawAmount, uint newBalance); - - // Deposit function allows users to deposit Ether into the bank - function deposit() public payable { - require(msg.value > 0, "Deposit amount must be greater than zero."); - balances[msg.sender] += msg.value; - emit DepositMade(msg.sender, msg.value); - } - - // Withdraw function allows users to withdraw Ether from the bank - function withdraw(uint withdrawAmount) public { - require(withdrawAmount <= balances[msg.sender], "Insufficient balance."); - payable(msg.sender).transfer(withdrawAmount); - balances[msg.sender] -= withdrawAmount; - emit WithdrawalMade(msg.sender, withdrawAmount, balances[msg.sender]); - } - - // Get balance function returns the Ether balance of the user - function getBalance() public view returns (uint) { - return balances[msg.sender]; - } -} +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +// SimpleBank contract definition +contract SimpleBank { + // Mapping from addresses to balances + mapping(address => uint) private balances; + + // Event declarations + event DepositMade(address indexed accountAddress, uint amount); + event WithdrawalMade(address indexed accountAddress, uint withdrawAmount, uint newBalance); + + // Deposit function allows users to deposit Ether into the bank + function deposit() public payable { + require(msg.value > 0, "Deposit amount must be greater than zero."); + balances[msg.sender] += msg.value; + emit DepositMade(msg.sender, msg.value); + } + + // Withdraw function allows users to withdraw Ether from the bank + function withdraw(uint withdrawAmount) public { + require(withdrawAmount <= balances[msg.sender], "Insufficient balance."); + payable(msg.sender).transfer(withdrawAmount); + balances[msg.sender] -= withdrawAmount; + emit WithdrawalMade(msg.sender, withdrawAmount, balances[msg.sender]); + } + + // Get balance function returns the Ether balance of the user + function getBalance() public view returns (uint) { + return balances[msg.sender]; + } +}