-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtemplate
40 lines (29 loc) · 1.71 KB
/
template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
////////////////////////////////////////////////////
// AUTOGENERATED - DO NOT EDIT THIS FILE DIRECTLY //
////////////////////////////////////////////////////
import "forge-std/Script.sol";
import "<src/Example.sol>";
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import {TransparentUpgradeableProxy, ITransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
abstract contract <Example>Deployer is Script {
<Example> internal <example>;
ProxyAdmin internal <example>ProxyAdmin;
address internal <example>Implementation;
function deploy<Example>Transparent(address proxyAdminOwner<, uint256 constructArg><, uint256 initArg>) internal returns (address implementation, address proxyAdmin, address proxy) {
bytes memory initData = <initData>;
vm.startBroadcast(vm.envUint("PRIVATE_KEY"));
<example>Implementation = address(new <Example>(<constructArg>));
<example> = <Example>(address(new TransparentUpgradeableProxy(<example>Implementation, proxyAdminOwner, initData)));
vm.stopBroadcast();
<example>ProxyAdmin =
ProxyAdmin(address(uint160(uint256(vm.load(address(<example>), hex"b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103")))));
return (<example>Implementation, address(<example>ProxyAdmin), address(<example>));
}
function deploy<Example>Implementation(<, uint256 constructArg>) internal returns (address implementation) {
vm.startBroadcast(vm.envUint("PRIVATE_KEY"));
implementation = address(new <Example>(<constructArg>));
vm.stopBroadcast();
}
}