mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-10-21 11:16:17 +00:00
Constructors and contract creation (#11)
Implement constructor logic and support create/create2 in the mock runtime Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
1 parent
42697edc67
commit
06aa289d9b
26 files changed
+692
-720
No files matched your search
@@ -0,0 +1,21 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.24;
|
||||
|
||||
contract CreateA {
|
||||
address creator;
|
||||
|
||||
constructor() payable {
|
||||
creator = msg.sender;
|
||||
}
|
||||
}
|
||||
|
||||
contract CreateB {
|
||||
receive() external payable {
|
||||
new CreateA{value: msg.value}();
|
||||
}
|
||||
|
||||
fallback() external {
|
||||
new CreateA{salt: hex"01"}();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,10 @@ pragma solidity ^0.8;
|
||||
contract Flipper {
|
||||
bool coin;
|
||||
|
||||
constructor(bool _coin) {
|
||||
coin = _coin;
|
||||
}
|
||||
|
||||
function flip() public {
|
||||
coin = !coin;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user