-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathDeployAddWasmCacheManagerAction.s.sol
42 lines (34 loc) · 1.69 KB
/
DeployAddWasmCacheManagerAction.s.sol
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
41
42
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.16;
import {DeploymentHelpersScript} from "../../helper/DeploymentHelpers.s.sol";
import {AddWasmCacheManagerAction} from "../../../../contracts/child-chain/stylus/AddWasmCacheManagerAction.sol";
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
interface ICacheManager {
function initialize(uint64 initCacheSize, uint64 initDecay) external;
}
/**
* @title DeployAddWasmCacheManagerActionScript
* @notice This script deploys CacheManager and then deploys action that's used to add cache manager on a child chain.
*/
contract DeployAddWasmCacheManagerActionScript is DeploymentHelpersScript {
// https://github.com/OffchainLabs/nitro/releases/tag/consensus-v32
uint256 public constant TARGET_ARBOS_VERSION = 32;
function run() public {
vm.startBroadcast();
// deploy CacheManger behind proxy
address cacheManagerLogic = deployBytecodeFromJSON(
"/node_modules/@arbitrum/nitro-contracts-2.1.0/build/contracts/src/chain/CacheManager.sol/CacheManager.json"
);
address cacheManagerProxy = address(
new TransparentUpgradeableProxy(cacheManagerLogic, vm.envAddress("CACHE_MANAGER_PROXY_ADMIN_ADDRESS"), "")
);
ICacheManager cacheManager = ICacheManager(cacheManagerProxy);
cacheManager.initialize(uint64(vm.envUint("INIT_CACHE_SIZE")), uint64(vm.envUint("INIT_DECAY")));
// deploy action
new AddWasmCacheManagerAction({
_wasmCachemanager: address(cacheManager),
_targetArbOSVersion: TARGET_ARBOS_VERSION
});
vm.stopBroadcast();
}
}