-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathERC223Receiver.sol
36 lines (28 loc) · 1.09 KB
/
ERC223Receiver.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
pragma solidity ^0.4.11;
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223Receiver {
struct TKN {
address sender;
uint value;
bytes data;
}
mapping (address => TKN[]) transactionReceived;
function tokenFallback(address _from, uint _value, bytes _data) public {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
transactionReceived[_from].push(tkn);
// uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
// tkn.sig = bytes4(u);
/* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function
* if data of token transaction is a function execution
*/
}
}