Skip to content

Commit

Permalink
fix(preprocess): fix hardhat preprocessor configs (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Dec 1, 2022
1 parent 5bed261 commit 8bdbb3e
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions packages/protocol/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import "./tasks/deploy_L1"
import "@nomiclabs/hardhat-etherscan"
import "@nomiclabs/hardhat-waffle"
import "@openzeppelin/hardhat-upgrades"
import "@typechain/hardhat"
import "hardhat-abi-exporter"
import "hardhat-gas-reporter"
import "hardhat-preprocessor"
import { HardhatUserConfig } from "hardhat/config"
import "solidity-coverage"
import "solidity-docgen"
import { HardhatUserConfig } from "hardhat/config"
import "./tasks/deploy_L1"

const hardhatMnemonic =
"test test test test test test test test test test test taik"
Expand Down Expand Up @@ -91,24 +91,21 @@ const config: HardhatUserConfig = {
preprocess: {
eachLine: () => ({
transform: (line) => {
if (
process.env.CHAIN_ID &&
line.includes("uint256 public constant TAIKO_CHAIN_ID")
) {
return `${line.slice(0, line.indexOf(" ="))} = ${
process.env.CHAIN_ID
};`
}

if (
process.env.COMMIT_DELAY_CONFIRMATIONS &&
line.includes(
"uint256 public constant TAIKO_COMMIT_DELAY_CONFIRMATIONS"
)
) {
return `${line.slice(0, line.indexOf(" ="))} = ${
process.env.COMMIT_DELAY_CONFIRMATIONS
};`
for (const constantName of [
"TAIKO_CHAIN_ID",
"K_COMMIT_DELAY_CONFIRMATIONS",
"TAIKO_BLOCK_MAX_TXS",
"TAIKO_TXLIST_MAX_BYTES",
"TAIKO_BLOCK_MAX_GAS_LIMIT",
]) {
if (
process.env[constantName] &&
line.includes(`uint256 public constant ${constantName}`)
) {
return `${line.slice(0, line.indexOf(" ="))} = ${
process.env[constantName]
};`
}
}

return line
Expand Down

0 comments on commit 8bdbb3e

Please sign in to comment.