Skip to content

Instantly share code, notes, and snippets.

@believeohiozua
Last active August 3, 2022 17:07
Show Gist options
  • Save believeohiozua/b30c2bf6e88e923e42487b04fe299cbd to your computer and use it in GitHub Desktop.
Save believeohiozua/b30c2bf6e88e923e42487b04fe299cbd to your computer and use it in GitHub Desktop.
contract of transaction
contract StoreTransaction{
address wallet;
uint256 amount;
uint256 balance;
uint256 total;
function totalDeposit() public view returns (uint256) {
return amount;
}
//mapping address to balance
mapping (address => uint256) balances;
//mapping address to total
mapping (address => uint256) totals;
//make payment
function makePayment(address _wallet, uint256 _amount) public {
wallet = _wallet;
amount = _amount;
balances[wallet] += amount;
totals[wallet] += amount;
}
//get balance of address
function getBalance(address _wallet) public view returns (uint256) {
return balances[_wallet];
}
//get total of address
function getTotal(address _wallet) public view returns (uint256) {
return totals[_wallet];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment