Skip to content

Instantly share code, notes, and snippets.

@devlongs
Last active August 3, 2022 17:19
Show Gist options
  • Save devlongs/b03abd11e599e59c14e1c6840c83e133 to your computer and use it in GitHub Desktop.
Save devlongs/b03abd11e599e59c14e1c6840c83e133 to your computer and use it in GitHub Desktop.
// 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