Last active
January 31, 2022 04:15
-
-
Save auryn-macmillan/841906d0bc6c2624e83598cdfac17de8 to your computer and use it in GitHub Desktop.
MyModule.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.6; | |
import "@gnosis.pm/zodiac/contracts/core/Module.sol"; | |
import "./Button.sol"; | |
contract MyModule is Module { | |
address public button; | |
function pushButton() external { | |
exec( | |
button, | |
0, | |
abi.encodePacked(bytes4(keccak256("pushButton()"))), | |
Enum.Operation.Call | |
); | |
} | |
constructor(address _owner, address _button) { | |
bytes memory initializeParams = abi.encode(_owner, _button); | |
setUp(initializeParams); | |
} | |
/// @dev Initialize function, will be triggered when a new proxy is deployed | |
/// @param initializeParams Parameters of initialization encoded | |
function setUp(bytes memory initializeParams) public override initializer { | |
__Ownable_init(); | |
(address _owner, address _button) = abi.decode(initializeParams, (address, address)); | |
setAvatar(_owner); | |
setTarget(_owner); | |
button = _button; | |
transferOwnership(_owner); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Deploying this contract fails with the error
reverted with reason string 'Initializable: contract is not initializing'
unless theinitializer
modifier is added to thesetUp
function on line 26.