Skip to content

Commit

Permalink
Update wallet.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
0xScratch authored Oct 27, 2023
1 parent 33ed6b2 commit dfef984
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Level1/Wallet/wallet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit dfef984

Please sign in to comment.