-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #180 from 0xPolygonHermez/feature/updateScripts
Feature/update scripts
- Loading branch information
Showing
39 changed files
with
1,211 additions
and
142 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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
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
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,13 @@ | ||
{ | ||
"proxyAddress": "0xaddress", | ||
"implementationName": "PolygonZkEVMUpgraded", | ||
"constructorArgs": [ | ||
"0xaddress", | ||
"0xaddress", | ||
"0xaddress", | ||
"0xaddress", | ||
0, | ||
0, | ||
0 | ||
] | ||
} |
15 changes: 8 additions & 7 deletions
15
...-regen-upgrade-info/regen-upgrade-info.js → ...de/tool-regen-upgrade-info/regen_input.ts
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,115 @@ | ||
/* eslint-disable no-await-in-loop, no-use-before-define, no-lonely-if */ | ||
/* eslint-disable no-console, no-inner-declarations, no-undef, import/no-unresolved */ | ||
import {expect} from "chai"; | ||
import path = require("path"); | ||
import fs = require("fs"); | ||
|
||
import * as dotenv from "dotenv"; | ||
dotenv.config({path: path.resolve(__dirname, "../../../.env")}); | ||
import {ethers, upgrades} from "hardhat"; | ||
const deployParameters = require("../deploy_parameters.json"); | ||
|
||
async function main() { | ||
const {trustedSequencer} = deployParameters; | ||
|
||
// Load provider | ||
let currentProvider = ethers.provider; | ||
if (deployParameters.multiplierGas || deployParameters.maxFeePerGas) { | ||
if (process.env.HARDHAT_NETWORK !== "hardhat") { | ||
currentProvider = ethers.getDefaultProvider( | ||
`https://${process.env.HARDHAT_NETWORK}.infura.io/v3/${process.env.INFURA_PROJECT_ID}` | ||
) as any; | ||
if (deployParameters.maxPriorityFeePerGas && deployParameters.maxFeePerGas) { | ||
console.log( | ||
`Hardcoded gas used: MaxPriority${deployParameters.maxPriorityFeePerGas} gwei, MaxFee${deployParameters.maxFeePerGas} gwei` | ||
); | ||
const FEE_DATA = new ethers.FeeData( | ||
null, | ||
ethers.parseUnits(deployParameters.maxFeePerGas, "gwei"), | ||
ethers.parseUnits(deployParameters.maxPriorityFeePerGas, "gwei") | ||
); | ||
|
||
currentProvider.getFeeData = async () => FEE_DATA; | ||
} else { | ||
console.log("Multiplier gas used: ", deployParameters.multiplierGas); | ||
async function overrideFeeData() { | ||
const feedata = await ethers.provider.getFeeData(); | ||
return new ethers.FeeData( | ||
null, | ||
((feedata.maxFeePerGas as bigint) * BigInt(deployParameters.multiplierGas)) / 1000n, | ||
((feedata.maxPriorityFeePerGas as bigint) * BigInt(deployParameters.multiplierGas)) / 1000n | ||
); | ||
} | ||
currentProvider.getFeeData = overrideFeeData; | ||
} | ||
} | ||
} | ||
|
||
// Load deployer | ||
let deployer; | ||
if (deployParameters.deployerPvtKey) { | ||
deployer = new ethers.Wallet(deployParameters.deployerPvtKey, currentProvider); | ||
} else if (process.env.MNEMONIC) { | ||
deployer = ethers.HDNodeWallet.fromMnemonic( | ||
ethers.Mnemonic.fromPhrase(process.env.MNEMONIC), | ||
"m/44'/60'/0'/0/0" | ||
).connect(currentProvider); | ||
} else { | ||
[deployer] = await ethers.getSigners(); | ||
} | ||
|
||
console.log("deploying with: ", deployer.address); | ||
|
||
/* | ||
*Deployment pol | ||
*/ | ||
const polTokenName = "Pol Token"; | ||
const polTokenSymbol = "POL"; | ||
const polTokenInitialBalance = ethers.parseEther("20000000"); | ||
|
||
const polTokenFactory = await ethers.getContractFactory("ERC20PermitMock", deployer); | ||
const polTokenContract = await polTokenFactory.deploy( | ||
polTokenName, | ||
polTokenSymbol, | ||
deployer.address, | ||
polTokenInitialBalance | ||
); | ||
await polTokenContract.waitForDeployment(); | ||
|
||
console.log("#######################\n"); | ||
console.log("pol deployed to:", polTokenContract.target); | ||
console.log("you can verify the new impl address with:"); | ||
console.log( | ||
`npx hardhat verify --constructor-args upgrade/arguments.js ${polTokenContract.target} --network ${process.env.HARDHAT_NETWORK}\n` | ||
); | ||
console.log("Copy the following constructor arguments on: upgrade/arguments.js \n", [ | ||
polTokenName, | ||
polTokenSymbol, | ||
deployer.address, | ||
polTokenInitialBalance, | ||
]); | ||
|
||
const tokensBalance = ethers.parseEther("100000"); | ||
await (await polTokenContract.transfer(trustedSequencer, tokensBalance)).wait(); | ||
} | ||
|
||
main().catch((e) => { | ||
console.error(e); | ||
process.exit(1); | ||
}); | ||
|
||
// OZ test functions | ||
function genOperation(target: any, value: any, data: any, predecessor: any, salt: any) { | ||
const id = ethers.solidityPackedKeccak256( | ||
["address", "uint256", "bytes", "uint256", "bytes32"], | ||
[target, value, data, predecessor, salt] | ||
); | ||
return { | ||
id, | ||
target, | ||
value, | ||
data, | ||
predecessor, | ||
salt, | ||
}; | ||
} |
Oops, something went wrong.