Last active
August 3, 2022 17:19
-
-
Save devlongs/b03abd11e599e59c14e1c6840c83e133 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity 0.8.0; | |
contract Bank { | |
address public owner; | |
mapping(address => uint256) depositor; | |
address[] public depositors; | |
constructor() { | |
owner = msg.sender; | |
} | |
receive() external payable { | |
deposit(); | |
} | |
function deposit() public payable { | |
depositor[msg.sender] = msg.value; | |
depositors.push(msg.sender); | |
} | |
function getContractBalance() public view returns(uint256){ | |
return address(this).balance; | |
} | |
function getAllDepositors() public view returns(address[] memory){ | |
return depositors; | |
} | |
function getWhoDeposited(address _addr) public view returns(uint256){ | |
return _addr.balance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment