|
1 | 1 | // SPDX-License-Identifier: MIT
|
2 | 2 | pragma solidity ^0.8.18;
|
3 | 3 |
|
4 |
| -import {Faucet} from "../../src/Faucet.sol"; |
5 | 4 | import {KintoID} from "../../src/KintoID.sol";
|
6 | 5 | import {MigrationHelper} from "@kinto-core-script/utils/MigrationHelper.sol";
|
| 6 | +import "@openzeppelin/contracts/access/IAccessControl.sol"; |
7 | 7 |
|
8 |
| -contract UpgradeKintoIDFaucetDeployScript is MigrationHelper { |
| 8 | +contract UpgradeKintoIDScript is MigrationHelper { |
9 | 9 | function run() public override {
|
10 | 10 | super.run();
|
11 | 11 |
|
12 |
| - // bytes memory bytecode = abi.encodePacked( |
13 |
| - // type(KintoID).creationCode, |
14 |
| - // abi.encode( |
15 |
| - // _getChainDeployment("KintoWalletFactory"), |
16 |
| - // _getChainDeployment("Faucet") |
17 |
| - // ) |
18 |
| - // ); |
| 12 | + bytes memory bytecode = abi.encodePacked( |
| 13 | + type(KintoID).creationCode, |
| 14 | + abi.encode( |
| 15 | + _getChainDeployment("KintoWalletFactory"), |
| 16 | + _getChainDeployment("Faucet") |
| 17 | + ) |
| 18 | + ); |
19 | 19 |
|
20 |
| - // address impl = _deployImplementationAndUpgrade("KintoID", "V8", bytecode); |
21 |
| - // saveContractAddress("KintoIDV8-impl", impl); |
| 20 | + address impl = _deployImplementationAndUpgrade("KintoID", "V9", bytecode); |
| 21 | + saveContractAddress("KintoIDV9-impl", impl); |
22 | 22 |
|
23 |
| - // bytecode = abi.encodePacked( |
24 |
| - // type(Faucet).creationCode, |
25 |
| - // abi.encode(_getChainDeployment("KintoWalletFactory")) |
26 |
| - // ); |
| 23 | + KintoID kintoID = KintoID(_getChainDeployment("KintoID")); |
| 24 | + address nioGovernor = _getChainDeployment("NioGovernor"); |
| 25 | + bytes32 governanceRole = kintoID.GOVERNANCE_ROLE(); |
27 | 26 |
|
28 |
| - // impl = _deployImplementationAndUpgrade("Faucet", "V9", bytecode); |
29 |
| - // saveContractAddress("FaucetV9-impl", impl); |
| 27 | + assertFalse(kintoID.hasRole(governanceRole, kintoAdminWallet)); |
| 28 | + assertFalse(kintoID.hasRole(governanceRole, nioGovernor)); |
30 | 29 |
|
31 |
| - // vm.broadcast(deployerPrivateKey); |
32 |
| - KintoID kintoID = KintoID(_getChainDeployment("KintoID")); |
33 |
| - _whitelistApp(address(kintoID)); |
34 |
| - _upgradeTo(address(kintoID), _getChainDeployment("KintoIDV8-impl"), deployerPrivateKey); |
| 30 | + _handleOps( |
| 31 | + abi.encodeWithSelector(IAccessControl.grantRole.selector, governanceRole, kintoAdminWallet), address(kintoID) |
| 32 | + ); |
| 33 | + |
| 34 | + _handleOps( |
| 35 | + abi.encodeWithSelector(IAccessControl.grantRole.selector, governanceRole, nioGovernor), address(kintoID) |
| 36 | + ); |
| 37 | + |
| 38 | + assertTrue(kintoID.hasRole(kintoID.GOVERNANCE_ROLE(), kintoAdminWallet)); |
| 39 | + assertTrue(kintoID.hasRole(kintoID.GOVERNANCE_ROLE(), nioGovernor)); |
| 40 | + |
| 41 | + assertTrue(kintoID.isKYC(deployer)); |
35 | 42 | }
|
36 | 43 | }
|
0 commit comments