Last active
February 4, 2023 17:48
-
-
Save OkoliEvans/78ef4ef8b83083fd5e71f675e51277d9 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
/** | |
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