diff --git a/Level1/Wallet/wallet.sol b/Level1/Wallet/wallet.sol index 58b7e08..a1f6c82 100644 --- a/Level1/Wallet/wallet.sol +++ b/Level1/Wallet/wallet.sol @@ -2,29 +2,34 @@ pragma solidity >=0.5.0 <0.9.0; contract Wallet { - address payable[] public accounts; //creating an array of accounts - address payable public owner; + address payable[] public accounts; + //owner's address + address payable public owner; constructor(address _owner){ - owner = payable(_owner); //making owners address as payable - accounts.push(payable(owner)); + owner = payable(_owner); + //pushing owner address in accounts array + accounts.push(payable(owner)); } + // To deposit balance to the smart contract function deposit() public payable { + require(msg.value > 0, "Cannot deposit zero value"); + accounts.push(payable(msg.sender)); } - //to deposit balance to the smart contract - + + // Sending a specific 'amount' to the 'receiver' function sendEther(address reciever, uint amount) public payable{ require(msg.sender== owner,"sender is not allowed"); payable(reciever).transfer(amount); } + // checking balance function balanceOf() public view returns(uint){ return address(this).balance; - } - //checking balance + } }