Skip to content

Instantly share code, notes, and snippets.

@dicethedev
Last active August 3, 2022 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dicethedev/105a5f95b08bc557735192f63553c182 to your computer and use it in GitHub Desktop.
Save dicethedev/105a5f95b08bc557735192f63553c182 to your computer and use it in GitHub Desktop.
a simple contract that deposit fund into a contract and also keep track of funds transferred into the contract.
//SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
contract Deposit {
mapping(address => uint256) balances;
function depositFund(address _address) public payable {
balances[_address] += msg.value;
}
function returnDepositFund(address _account) public view returns(uint256) {
return balances[_account];
}
//function to return the balance of ether
function getDeposit() public view returns(uint256) {
return address(this).balance;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment