Let's say we have Ethereum smart contract with fallback function:
event onDeposit(int128 indexed key, address from, uint amount);
...
function () payable public {
require(msg.value > 0);
int128 key = ... // how to extract it from msg.data? (0x123)
address from = msg.sender;
uint amount = msg.value;
// fire event
emit onDeposit(key, from, amount);
}
and taking into account key
is entered in myetherwallet.com like that:
Is it correct that i should skip 4 first bytes in msg.data
(function address) and get the next 4 bytes (int128 size)? How can i do it (slice bytes and cast them as int128)?