Created
October 6, 2019 22:58
-
-
Save ChamsBouzaiene/d6abe9a41c1d8089f899609823867d14 to your computer and use it in GitHub Desktop.
Public Blockchain Smart Contract
This file contains 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
pragma solidity ^0.5.0; | |
contract PublicQueue { | |
struct Transaction { | |
address tFrom; | |
address tTo; | |
uint256 tValue; | |
} | |
struct Users { | |
address publicA; | |
address privateA; | |
} | |
mapping (uint256 => Transaction) transactions; | |
mapping (uint256 => mapping (uint256 => Transaction)) internal listOfTransactions; | |
uint256 tranLength; | |
Transaction[] public transAcc; | |
// --- Events --- | |
event Transfer(address indexed _from ,address indexed _to, uint256 _value); | |
function transferFrom(address _from, address _to, uint256 _value) public { | |
emit Transfer(_from, _to, _value); | |
} | |
function setTransaction( address _from, address _to, uint256 _value) public { | |
Transaction memory myTransaction = Transaction(_from,_to,_value); | |
transAcc.push(myTransaction); | |
emit Transfer(_from, _to, _value); | |
transactions[tranLength] = myTransaction; | |
tranLength++; | |
} | |
function getLength() public view returns (uint256) { | |
return tranLength; | |
} | |
function getTransactions(uint256 _id) public view returns (uint256, address, address) { | |
return (transactions[_id].tValue, transactions[_id].tFrom, transactions[_id].tTo); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment