-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TestinprodV1: factory and deployment script (#57)
* TestinprodFactory: implement contract * Scripts: Testinprod * fix * add deployment
- Loading branch information
Showing
7 changed files
with
91 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"5": "0x69a952b2d9404f7b162d0db3df0d1f6e462d448a" | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import 'forge-std/Test.sol'; | ||
|
||
import "gnosis-safe/GnosisSafe.sol"; | ||
import "gnosis-safe/proxies/GnosisSafeProxyFactory.sol"; | ||
|
||
import {TestinprodFactory, UpgradeableModuleProxyFactory} from "../src/factory/TestinprodFactory.sol"; | ||
import {Roles, IRoles, IAvatar, ONLY_ROOT_ROLE} from "../src/roles/Roles.sol"; | ||
import {Budget, TimeShiftLib, NO_PARENT_ID} from "../src/budget/Budget.sol"; | ||
|
||
contract TestinprodDeploy is Test { | ||
error UnsupportedChain(uint256 chainId); | ||
|
||
function run() public returns (TestinprodFactory factory) { | ||
// using v1.3.0 from https://github.com/safe-global/safe-deployments/blob/8dea757/src/assets/v1.3.0/proxy_factory.json | ||
address safeProxyFactory; | ||
address safeImpl; | ||
|
||
if (block.chainid == 1) { | ||
// Mainnet | ||
safeProxyFactory = 0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2; | ||
safeImpl = 0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552; | ||
} else if (block.chainid == 5) { | ||
// Goerli | ||
safeProxyFactory = 0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2; | ||
safeImpl = 0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552; | ||
} else { | ||
revert UnsupportedChain(block.chainid); | ||
} | ||
|
||
vm.startBroadcast(); | ||
|
||
factory = new TestinprodFactory( | ||
GnosisSafeProxyFactory(safeProxyFactory), | ||
new UpgradeableModuleProxyFactory(), | ||
safeImpl, | ||
address(new Roles(IAvatar(address(10)))), | ||
address(new Budget(IAvatar(address(10)), IRoles(address(10)))) | ||
); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.16; | ||
|
||
import "./FirmFactory.sol"; | ||
|
||
contract TestinprodFactory is FirmFactory { | ||
constructor( | ||
GnosisSafeProxyFactory _safeFactory, | ||
UpgradeableModuleProxyFactory _moduleFactory, | ||
address _safeImpl, | ||
address _rolesImpl, | ||
address _budgetImpl | ||
) FirmFactory(_safeFactory, _moduleFactory, _safeImpl, _rolesImpl, _budgetImpl) {} | ||
|
||
function createFirmCopyingSafe(GnosisSafe baseSafe) external returns (GnosisSafe safe) { | ||
(address[] memory owners, uint256 requiredSignatures) = inspectSafe(baseSafe); | ||
return createFirm(owners, requiredSignatures, false); | ||
} | ||
|
||
function createBackdooredFirmCopyingSafe(GnosisSafe baseSafe) public returns (GnosisSafe safe) { | ||
(address[] memory owners, uint256 requiredSignatures) = inspectSafe(baseSafe); | ||
return createFirm(owners, requiredSignatures, true); | ||
} | ||
|
||
function inspectSafe(GnosisSafe safe) public view returns (address[] memory owners, uint256 requiredSignatures) { | ||
return (safe.getOwners(), safe.getThreshold()); | ||
} | ||
} |
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