2020-03-09 21:14:07 +00:00
|
|
|
contract Helper {
|
|
|
|
bytes3 name;
|
|
|
|
bool flag;
|
|
|
|
|
2020-06-23 12:14:24 +00:00
|
|
|
constructor(bytes3 x, bool f) payable {
|
2020-03-09 21:14:07 +00:00
|
|
|
name = x;
|
|
|
|
flag = f;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getName() public returns (bytes3 ret) {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getFlag() public returns (bool ret) {
|
|
|
|
return flag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
contract Main {
|
|
|
|
Helper h;
|
|
|
|
|
2020-06-23 12:14:24 +00:00
|
|
|
constructor() payable {
|
2020-04-03 14:29:17 +00:00
|
|
|
h = (new Helper){value: 10}("abc", true);
|
2020-03-09 21:14:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function getFlag() public returns (bool ret) {
|
|
|
|
return h.getFlag();
|
|
|
|
}
|
|
|
|
|
|
|
|
function getName() public returns (bytes3 ret) {
|
|
|
|
return h.getName();
|
|
|
|
}
|
|
|
|
|
|
|
|
function getBalances() public returns (uint256 me, uint256 them) {
|
|
|
|
me = address(this).balance;
|
|
|
|
them = address(h).balance;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-19 13:12:56 +00:00
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
2020-03-09 21:14:07 +00:00
|
|
|
// ----
|
|
|
|
// constructor(), 22 wei ->
|
|
|
|
// getFlag() -> true
|
|
|
|
// getName() -> "abc"
|
|
|
|
// getBalances() -> 12, 10
|