mirror of
https://github.com/luxdao/zodiac.git
synced 2026-10-30 20:34:38 +00:00
20 lines
1.8 KiB
JSON
20 lines
1.8 KiB
JSON
{
|
|
"contractName": "ModuleProxyFactory",
|
|
"sourceName": "ModuleProxyFactory.sol",
|
|
"compilerVersion": "v0.8.6+commit.11564f7e",
|
|
"constructorArguments": "",
|
|
"input": {
|
|
"language": "Solidity",
|
|
"sources": {
|
|
"ModuleProxyFactory.sol": {
|
|
"content": "// SPDX-License-Identifier: LGPL-3.0-only\r\npragma solidity >=0.8.0;\r\n\r\ncontract ModuleProxyFactory {\r\n event ModuleProxyCreation(\r\n address indexed proxy,\r\n address indexed masterCopy\r\n );\r\n\r\n function createProxy(address target, bytes32 salt)\r\n internal\r\n returns (address result)\r\n {\r\n require(\r\n address(target) != address(0),\r\n \"createProxy: address can not be zero\"\r\n );\r\n bytes memory deployment = abi.encodePacked(\r\n hex\"602d8060093d393df3363d3d373d3d3d363d73\",\r\n target,\r\n hex\"5af43d82803e903d91602b57fd5bf3\"\r\n );\r\n // solhint-disable-next-line no-inline-assembly\r\n assembly {\r\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\r\n }\r\n require(result != address(0), \"createProxy: address already taken\");\r\n }\r\n\r\n function deployModule(\r\n address masterCopy,\r\n bytes memory initializer,\r\n uint256 saltNonce\r\n ) public returns (address proxy) {\r\n proxy = createProxy(\r\n masterCopy,\r\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\r\n );\r\n (bool success, ) = proxy.call(initializer);\r\n require(success, \"deployModule: initialization failed\");\r\n\r\n emit ModuleProxyCreation(proxy, masterCopy);\r\n }\r\n}"
|
|
}
|
|
},
|
|
"settings": {
|
|
"optimizer": {
|
|
"enabled": false,
|
|
"runs": 200
|
|
}
|
|
}
|
|
}
|
|
} |