Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #60 from RedDuck-Software/fix/ac-upgrade
Browse files Browse the repository at this point in the history
Fix/ac upgrade
  • Loading branch information
kostyamospan authored Sep 30, 2024
2 parents e0da56e + 571075e commit 2c675ac
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 0 deletions.
114 changes: 114 additions & 0 deletions .openzeppelin/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -5194,6 +5194,120 @@
}
}
},
"f4a74446da843aba02565b839edd198c2d660ac4ff2dc8f2a6846dae4083294d": {
"address": "0xDd5a54bA2aB379A5e642c58F98aD793A183960E2",
"txHash": "0x8fa31715b82b910dcb7af846ef5ad51c06f25ab720c92de81d4665db563c0324",
"layout": {
"solcVersion": "0.8.9",
"storage": [
{
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "t_uint8",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63",
"retypedFrom": "bool"
},
{
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "t_bool",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68"
},
{
"label": "__gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage",
"contract": "ContextUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36"
},
{
"label": "__gap",
"offset": 0,
"slot": "51",
"type": "t_array(t_uint256)50_storage",
"contract": "ERC165Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol:41"
},
{
"label": "_roles",
"offset": 0,
"slot": "101",
"type": "t_mapping(t_bytes32,t_struct(RoleData)80_storage)",
"contract": "AccessControlUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:62"
},
{
"label": "__gap",
"offset": 0,
"slot": "102",
"type": "t_array(t_uint256)49_storage",
"contract": "AccessControlUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:260"
}
],
"types": {
"t_address": {
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]",
"numberOfBytes": "1568"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]",
"numberOfBytes": "1600"
},
"t_bool": {
"label": "bool",
"numberOfBytes": "1"
},
"t_bytes32": {
"label": "bytes32",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_bool)": {
"label": "mapping(address => bool)",
"numberOfBytes": "32"
},
"t_mapping(t_bytes32,t_struct(RoleData)80_storage)": {
"label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)",
"numberOfBytes": "32"
},
"t_struct(RoleData)80_storage": {
"label": "struct AccessControlUpgradeable.RoleData",
"members": [
{
"label": "members",
"type": "t_mapping(t_address,t_bool)",
"offset": 0,
"slot": "0"
},
{
"label": "adminRole",
"type": "t_bytes32",
"offset": 0,
"slot": "1"
}
],
"numberOfBytes": "64"
},
"t_uint256": {
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint8": {
"label": "uint8",
"numberOfBytes": "1"
}
}
}
},
"ba8a2b913f6d2b1bf824aa737f20779b41d9c9a1cb3cfcec6675150ae0667b64": {
"address": "0xb89ea423cF203C057765db751C59777E09Bbd877",
"txHash": "0xdd619c400dac6fcf745ad90041efbf4bcde78ca0bbd5f80ce994ca9ec3cd198f",
Expand Down
25 changes: 25 additions & 0 deletions scripts/upgrades/upgrade_AC.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import * as hre from 'hardhat';
import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';

import { MIDAS_AC_CONTRACT_NAME } from '../../config';
import { getCurrentAddresses } from '../../config/constants/addresses';

const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const addresses = getCurrentAddresses(hre);

const { deployer } = await hre.getNamedAccounts();
const owner = await hre.ethers.getSigner(deployer);

console.log('Upgrading AC at address:', addresses?.accessControl);
const deployment = await hre.upgrades.upgradeProxy(
addresses?.accessControl ?? '',
await hre.ethers.getContractFactory(MIDAS_AC_CONTRACT_NAME, owner),
{
unsafeAllow: ['constructor'],
},
);
console.log('Upgraded AC:', deployment.address);
};

func(hre).then(console.log).catch(console.error);

0 comments on commit 2c675ac

Please sign in to comment.