-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afc55f3
commit 7a08069
Showing
8 changed files
with
181 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* eslint-disable no-console, no-unused-vars */ | ||
const hre = require('hardhat'); | ||
const { ethers, upgrades } = require('hardhat'); | ||
const path = require('path'); | ||
require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); | ||
const upgradeParameters = require('./upgrade_parameters.json'); | ||
|
||
async function main() { | ||
// Set multiplier Gas | ||
let currentProvider = ethers.provider; | ||
if (upgradeParameters.multiplierGas) { | ||
if (process.env.HARDHAT_NETWORK !== 'hardhat') { | ||
const multiplierGas = upgradeParameters.multiplierGas; | ||
currentProvider = new ethers.providers.JsonRpcProvider(`https://${process.env.HARDHAT_NETWORK}.infura.io/v3/${process.env.INFURA_PROJECT_ID}`); | ||
async function overrideFeeData() { | ||
const feedata = await ethers.provider.getFeeData(); | ||
return { | ||
maxFeePerGas: feedata.maxFeePerGas.mul(multiplierGas), | ||
maxPriorityFeePerGas: feedata.maxPriorityFeePerGas.mul(multiplierGas), | ||
}; | ||
} | ||
currentProvider.getFeeData = overrideFeeData; | ||
} | ||
} | ||
let deployer; | ||
if (upgradeParameters.deployerPvtKey) { | ||
deployer = new ethers.Wallet(upgradeParameters.deployerPvtKey, currentProvider); | ||
} else if (process.env.MNEMONIC) { | ||
deployer = ethers.Wallet.fromMnemonic(process.env.MNEMONIC, 'm/44\'/60\'/0\'/0/0').connect(currentProvider); | ||
} else { | ||
[deployer] = (await ethers.getSigners()); | ||
} | ||
|
||
// compìle contracts | ||
await hre.run('compile'); | ||
|
||
for (const upgrade of upgradeParameters.upgrades) { | ||
const proxyPolygonAddress = upgrade.address; | ||
const polygonZkEVMFactory = await ethers.getContractFactory(upgrade.contractName, deployer); | ||
|
||
const txZKEVM = await upgrades.upgradeProxy(proxyPolygonAddress, polygonZkEVMFactory); | ||
|
||
console.log(txZKEVM.deployTransaction); | ||
console.log(await txZKEVM.deployTransaction.wait()); | ||
console.log('upgrade succesfull', upgrade.contractName); | ||
} | ||
} | ||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"timelockMinDelay":10, | ||
"upgrades": [ | ||
{ | ||
"address": "0x6958d5f1AFa6f668c7D7F37a444d09E2330eB104", | ||
"contractName": "PolygonZkEVM" | ||
}, | ||
{ | ||
"address": "0x5cA95a1629e7dDD51b66Bf1505560cd7edA91d83", | ||
"contractName": "PolygonZkEVMBridgeMock" | ||
} | ||
], | ||
"multiplierGas": 0, | ||
"deployerPvtKey": "", | ||
"timelockSalt": "" | ||
} |