first commit

This commit is contained in:
arnaucode
2018-08-06 22:45:37 +02:00
parent ce4922e0f7
commit 794c1dd06c
19 changed files with 15477 additions and 0 deletions

32
contracts/account.sol Normal file
View File

@@ -0,0 +1,32 @@
pragma solidity ^0.4.23;
contract Accounts {
mapping(address => Account) accounts;
struct Account {
address ID;
int64 Balance;
bytes32[] History;
}
event BalanceUpdated(address sender, address receiver, int64 value);
function updateBalance(address _receiver, int64 _value) public {
// get Account of _sender
// check if balance of _sender is under the limit
// substract _value from _sender account
accounts[msg.sender].Balance = accounts[msg.sender].Balance - _value;
// add _value to _receiver account
accounts[_receiver].Balance = accounts[_receiver].Balance + _value;
// add transaction to history of sender and receiver accounts
// emit BalanceUpdated
emit BalanceUpdated(msg.sender, _receiver, _value);
}
function getBalance(address _address) public view returns (int64) {
return accounts[_address].Balance;
}
}