Skip to content

Commit

Permalink
Merge pull request #1347 from skalenetwork/update-upgrade-check
Browse files Browse the repository at this point in the history
Update deployed version
  • Loading branch information
DimaStebaev authored Dec 5, 2022
2 parents a00e083 + 35a6e40 commit 386d6d2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 69 deletions.
2 changes: 1 addition & 1 deletion proxy/DEPLOYED
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.2-stable.1
1.3.4-stable.0
69 changes: 2 additions & 67 deletions proxy/migrations/upgradeMainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,75 +9,10 @@ import hre from "hardhat";

async function main() {
await upgrade(
"1.3.2",
"1.3.4",
contracts,
async (safeTransactions, abi) => undefined,
async (safeTransactions, abi) => {
const proxyAdmin = await getManifestAdmin(hre);
const owner = await proxyAdmin.owner();
const communityPoolName = "CommunityPool";
const communityPoolFactory = await ethers.getContractFactory(communityPoolName);
const communityPoolAddress = abi[getContractKeyInAbiFile(communityPoolName) + "_address"];
let communityPool;
if (communityPoolAddress) {
communityPool = communityPoolFactory.attach(communityPoolAddress) as CommunityPool;
const constantSetterRole = await communityPool.CONSTANT_SETTER_ROLE();
const isHasRole = await communityPool.hasRole(constantSetterRole, owner);
if (!isHasRole) {
console.log(chalk.yellow("Prepare transaction to grantRole CONSTANT_SETTER_ROLE to " + owner));
safeTransactions.push(encodeTransaction(
0,
communityPoolAddress,
0,
communityPool.interface.encodeFunctionData("grantRole", [constantSetterRole, owner])
));
}
console.log(chalk.yellow("Prepare transaction to set multiplier to 3/2"));
safeTransactions.push(encodeTransaction(
0,
communityPoolAddress,
0,
communityPool.interface.encodeFunctionData("setMultiplier", [3, 2])
));
console.log(chalk.yellow("Prepare transaction to set header message gas cost to 73800"));
} else {
console.log(chalk.red("CommunityPool was not found!"));
console.log(chalk.red("Check your abi!!!"));
process.exit(1);
}

const messageProxyForMainnet = (await ethers.getContractFactory("MessageProxyForMainnet"))
.attach(abi[getContractKeyInAbiFile("MessageProxyForMainnet") + "_address"]) as MessageProxyForMainnet;

if (! await messageProxyForMainnet.hasRole(await messageProxyForMainnet.CONSTANT_SETTER_ROLE(), owner)) {
console.log(chalk.yellow("Prepare transaction to grantRole CONSTANT_SETTER_ROLE to " + owner));
safeTransactions.push(encodeTransaction(
0,
messageProxyForMainnet.address,
0,
messageProxyForMainnet.interface.encodeFunctionData(
"grantRole",
[ await messageProxyForMainnet.CONSTANT_SETTER_ROLE(), owner ]
)
));
}

const newHeaderMessageGasCost = 92251;

console.log(chalk.yellow(
"Prepare transaction to set header message gas cost to",
newHeaderMessageGasCost.toString()
));
safeTransactions.push(encodeTransaction(
0,
messageProxyForMainnet.address,
0,
messageProxyForMainnet.interface.encodeFunctionData(
"setNewHeaderMessageGasCost",
[ newHeaderMessageGasCost ]
)
));
},
async (safeTransactions, abi) => undefined,
"proxyMainnet"
);
}
Expand Down
2 changes: 1 addition & 1 deletion proxy/migrations/upgradeSchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function main() {
const pathToManifest: string = stringValue(process.env.MANIFEST);
await manifestSetup( pathToManifest );
await upgrade(
"1.3.2",
"1.3.4",
contracts,
async (safeTransactions, abi) => {
// deploying of new contracts
Expand Down

0 comments on commit 386d6d2

Please sign in to comment.