From c6846f5fa3f20199ff9133fa3147f7ca3f3cd69d Mon Sep 17 00:00:00 2001 From: Emmanuel Pcharles Date: Mon, 12 Aug 2024 14:47:02 +0100 Subject: [PATCH 1/3] Update README.md test --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3ec576d..8edde66 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -Smartcontracts for Etheremon +Smartcontracts for Etherem network -[Reference](https://medium.com/@myetheremon/smartcontract-updates-upcoming-feature-7a83b1b8b1a0) \ No newline at end of file +[Reference](https://medium.com/@myetheremon/smartcontract-updates-upcoming-feature-7a83b1b8b1a0) From 21455e3c3e95045bd69ba76db8d4453ea5d9cbdc Mon Sep 17 00:00:00 2001 From: Emmanuel Pcharles Date: Mon, 12 Aug 2024 14:55:57 +0100 Subject: [PATCH 2/3] Create Ether --- Ether | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Ether diff --git a/Ether b/Ether new file mode 100644 index 0000000..680d684 --- /dev/null +++ b/Ether @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +contract SimpleEtherWallet { + address payable public owner; + + // Event that logs deposits + event Deposit(address indexed sender, uint amount); + + // Event that logs withdrawals + event Withdrawal(address indexed receiver, uint amount); + + // Constructor sets the owner of the contract + constructor() { + owner = payable(msg.sender); + } + + // Function to deposit Ether into the contract + function deposit() public payable { + require(msg.value > 0, "Deposit must be greater than 0"); + emit Deposit(msg.sender, msg.value); + } + + // Function to withdraw all Ether in the contract, only by the owner + function withdraw() public { + require(msg.sender == owner, "Only the owner can withdraw"); + uint balance = address(this).balance; + require(balance > 0, "Insufficient balance"); + owner.transfer(balance); + emit Withdrawal(owner, balance); + } + + // Function to check the balance of the contract + function getBalance() public view returns (uint) { + return address(this).balance; + } +} From e8fd64ff47c07e4ad5dc0955b15baa3b87189f59 Mon Sep 17 00:00:00 2001 From: Emmanuel Pcharles Date: Mon, 12 Aug 2024 14:56:33 +0100 Subject: [PATCH 3/3] Rename Ether to Ether.sol --- Ether => Ether.sol | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Ether => Ether.sol (100%) diff --git a/Ether b/Ether.sol similarity index 100% rename from Ether rename to Ether.sol