Skip to content

Commit

Permalink
chore: add showContractCode task to verify l1Config in genesis file b…
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-armstrong committed Nov 7, 2023
1 parent 257b926 commit 2adb150
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 11 deletions.
25 changes: 19 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,22 @@
{
"type": "node",
"request": "launch",
"name": "task",
"name": "hardhat task",
"runtimeExecutable": "npx",
"args": [
"hardhat",
"run",
"--network",
// "polygonL2net",
"b2node",
"deployment/3_deployContracts.js",
// "deployment/2_deployPolygonZKEVMDeployer.js",
// "polygonL1net",
"showContractCode",
// "simpleTransfer",
// "showAccounts",
// "findTxOfAAddr",
// "debug",
// "PolygonZkEVM:parseLog",
// "--addr",
// "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
"--addrs",
"0x67d269191c92Caf3cD7723F116c85e6E9bf55933,0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
// "--txhash",
// "0x765730c24d1b99ee43c89f691f93c13cf9dfeac68280b2698e9cc4e349f34848"
// "--height",
Expand All @@ -49,6 +48,20 @@
// "info",
]
},
{
"type": "node",
"request": "launch",
"name": "hardhat script",
"runtimeExecutable": "npx",
"args": [
"hardhat",
"run",
"--network",
"b2node",
"deployment/3_deployContracts.js",
// "deployment/2_deployPolygonZKEVMDeployer.js",
]
},
{
"type": "node",
"request": "launch",
Expand Down
7 changes: 4 additions & 3 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ module.exports = {
},
},
polygonL1net: {
url: 'http://192.168.50.127:8545',
url: 'http://192.168.50.51:8545',
chainId: 1337,
accounts: {
mnemonic: 'test test test test test test test test test test test junk',
Expand All @@ -158,7 +158,7 @@ module.exports = {
},
},
polygonL2net: {
url: 'http://192.168.50.127:8123',
url: 'http://192.168.50.51:8123',
chainId: 1001,
accounts: {
mnemonic: 'test test test test test test test test test test test junk',
Expand All @@ -168,7 +168,8 @@ module.exports = {
},
},
b2node: {
url: "http://127.0.0.1:8555",
// url: "http://127.0.0.1:8545",
url: "http://192.168.50.127:8545",
chainId: 102,
accounts: {
mnemonic: "test test test test test test test test test test test junk",
Expand Down
11 changes: 10 additions & 1 deletion helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,22 @@ probe() {
# grep -Elr 'pragma solidity (\^|>|)0.8.20' --exclude-dir node_modules --include='*.sol' | xargs sed -i 's|0.8.20|0.8.13|g'
# return
# for net in polygonL1net polygonL2net; do
# for net in polygonL1net; do
# for net in polygonL2net; do
for net in b2node; do
# run $net simpleTransfer
# run $net simpleTransfer --help
# run $net simpleTransfer --init-account-balance 90000
# run $net showAccounts

# b2nodeADDR
# codeAddrs='0x67d269191c92Caf3cD7723F116c85e6E9bf55933,0x3Aa5ebB10DC797CAC828524e59A333d0A371443c,0x09635F643e140090A9A8Dcd712eD6285858ceBef'
# polygonAddr
# codeAddrs='0x610178dA211FEF7D417bC0e6FeD39F05609AD788,0x5FbDB2315678afecb367f032d93F642f64180aa3,0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6'
# run $net showContractCode --addrs $codeAddrs

# run $net init-fund-accounts
npm run deployRollupContract
# npm run deployRollupContract
# scanEOAAndContract
done
}
Expand Down
15 changes: 14 additions & 1 deletion task/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,17 @@ task("simpleTransfer", "acc1 transfer random eth to acc2")
let bal2 = new Map(tmp.entries());
bal2.set("tx", tx.hash);
console.log(bal2);
});
});

task("showContractCode", "")
.addParam("addrs")
.setAction(async (args, hre) => {
const provider = new hre.ethers.providers.JsonRpcProvider(hre.network.config.url);
const addrs = args.addrs.split(",");
let results = new Map();
for (const addr of addrs){
let code = await provider.getCode(addr);
results.set(addr, code);
}
console.log(results);
});

0 comments on commit 2adb150

Please # to comment.