Skip to content

Instantly share code, notes, and snippets.

@OkoliEvans
Last active February 4, 2023 17:48
Show Gist options
  • Save OkoliEvans/78ef4ef8b83083fd5e71f675e51277d9 to your computer and use it in GitHub Desktop.
Save OkoliEvans/78ef4ef8b83083fd5e71f675e51277d9 to your computer and use it in GitHub Desktop.
/**
Write a contract that deposit fund into a contract.
And also keep track of funds transferred into the contract.
Add a function to the balance of address that have deposited
into the contract.(Submit Github gist)
*/
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Ajoh {
mapping (address => uint256) private amountTracker;
function depositFund() external payable {
amountTracker[msg.sender] += msg.value;
}
function queryBalance() public view returns(uint256) {
return amountTracker[msg.sender];
}
receive() payable external{}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment