2019-09-09 18:09:15 +00:00
|
|
|
contract A {
|
|
|
|
uint public data;
|
|
|
|
uint public balance;
|
|
|
|
bytes public externalData;
|
2019-09-09 16:22:02 +00:00
|
|
|
fallback() external payable {
|
2019-09-09 18:09:15 +00:00
|
|
|
data += 1;
|
|
|
|
balance = msg.value;
|
|
|
|
externalData = msg.data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ----
|
|
|
|
// data() -> 0
|
|
|
|
// ()
|
|
|
|
// data() -> 1
|
|
|
|
// (): hex"42ef"
|
|
|
|
// data() -> 2
|
|
|
|
// externalData() -> 0x20, 2, left(0x42ef)
|
|
|
|
// balance() -> 0
|
2020-02-18 11:57:48 +00:00
|
|
|
// (), 1 wei
|
2019-09-09 18:09:15 +00:00
|
|
|
// balance() -> 1
|
2020-02-18 11:57:48 +00:00
|
|
|
// (), 2 wei: hex"fefe"
|
2019-09-09 18:09:15 +00:00
|
|
|
// balance() -> 2
|
2020-12-09 17:38:17 +00:00
|
|
|
// externalData() -> 0x20, 2, left(0xfefe)
|