forked from matter-labs/era-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
61 changed files
with
7,752 additions
and
7,936 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
module.exports = { | ||
...require('@matterlabs/prettier-config'), | ||
plugins: ['prettier-plugin-solidity'], | ||
overrides: [ | ||
{ | ||
files: '*.sol', | ||
options: { | ||
bracketSpacing: false, | ||
printWidth: 120, | ||
singleQuote: false, | ||
tabWidth: 4, | ||
useTabs: false | ||
} | ||
} | ||
] | ||
...require("@matterlabs/prettier-config"), | ||
plugins: ["prettier-plugin-solidity"], | ||
overrides: [ | ||
{ | ||
files: "*.sol", | ||
options: { | ||
bracketSpacing: false, | ||
printWidth: 120, | ||
singleQuote: false, | ||
tabWidth: 4, | ||
useTabs: false, | ||
}, | ||
}, | ||
], | ||
}; |
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 |
---|---|---|
@@ -1,121 +1,121 @@ | ||
import '@nomiclabs/hardhat-ethers'; | ||
import '@nomiclabs/hardhat-etherscan'; | ||
import '@nomiclabs/hardhat-solpp'; | ||
import '@nomiclabs/hardhat-waffle'; | ||
import 'hardhat-contract-sizer'; | ||
import 'hardhat-gas-reporter'; | ||
import 'hardhat-typechain'; | ||
import { TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS } from 'hardhat/builtin-tasks/task-names'; | ||
import { task } from 'hardhat/config'; | ||
import 'solidity-coverage'; | ||
import { getNumberFromEnv } from './scripts/utils'; | ||
import "@nomiclabs/hardhat-ethers"; | ||
import "@nomiclabs/hardhat-etherscan"; | ||
import "@nomiclabs/hardhat-solpp"; | ||
import "@nomiclabs/hardhat-waffle"; | ||
import "hardhat-contract-sizer"; | ||
import "hardhat-gas-reporter"; | ||
import "hardhat-typechain"; | ||
import { TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS } from "hardhat/builtin-tasks/task-names"; | ||
import { task } from "hardhat/config"; | ||
import "solidity-coverage"; | ||
import { getNumberFromEnv } from "./scripts/utils"; | ||
|
||
// If no network is specified, use the default config | ||
if (!process.env.CHAIN_ETH_NETWORK) { | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
require('dotenv').config(); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
require("dotenv").config(); | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const systemParams = require('../SystemConfig.json'); | ||
const systemParams = require("../SystemConfig.json"); | ||
|
||
const PRIORITY_TX_MAX_GAS_LIMIT = getNumberFromEnv('CONTRACTS_PRIORITY_TX_MAX_GAS_LIMIT'); | ||
const DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT = getNumberFromEnv('CONTRACTS_DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT'); | ||
const PRIORITY_TX_MAX_GAS_LIMIT = getNumberFromEnv("CONTRACTS_PRIORITY_TX_MAX_GAS_LIMIT"); | ||
const DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT = getNumberFromEnv("CONTRACTS_DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT"); | ||
|
||
const prodConfig = { | ||
UPGRADE_NOTICE_PERIOD: 0, | ||
// PRIORITY_EXPIRATION: 101, | ||
// NOTE: Should be greater than 0, otherwise zero approvals will be enough to make an instant upgrade! | ||
SECURITY_COUNCIL_APPROVALS_FOR_EMERGENCY_UPGRADE: 1, | ||
PRIORITY_TX_MAX_GAS_LIMIT, | ||
DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT, | ||
DUMMY_VERIFIER: false | ||
UPGRADE_NOTICE_PERIOD: 0, | ||
// PRIORITY_EXPIRATION: 101, | ||
// NOTE: Should be greater than 0, otherwise zero approvals will be enough to make an instant upgrade! | ||
SECURITY_COUNCIL_APPROVALS_FOR_EMERGENCY_UPGRADE: 1, | ||
PRIORITY_TX_MAX_GAS_LIMIT, | ||
DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT, | ||
DUMMY_VERIFIER: false, | ||
}; | ||
const testnetConfig = { | ||
UPGRADE_NOTICE_PERIOD: 0, | ||
// PRIORITY_EXPIRATION: 101, | ||
// NOTE: Should be greater than 0, otherwise zero approvals will be enough to make an instant upgrade! | ||
SECURITY_COUNCIL_APPROVALS_FOR_EMERGENCY_UPGRADE: 1, | ||
PRIORITY_TX_MAX_GAS_LIMIT, | ||
DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT, | ||
DUMMY_VERIFIER: true | ||
UPGRADE_NOTICE_PERIOD: 0, | ||
// PRIORITY_EXPIRATION: 101, | ||
// NOTE: Should be greater than 0, otherwise zero approvals will be enough to make an instant upgrade! | ||
SECURITY_COUNCIL_APPROVALS_FOR_EMERGENCY_UPGRADE: 1, | ||
PRIORITY_TX_MAX_GAS_LIMIT, | ||
DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT, | ||
DUMMY_VERIFIER: true, | ||
}; | ||
const testConfig = { | ||
UPGRADE_NOTICE_PERIOD: 0, | ||
PRIORITY_EXPIRATION: 101, | ||
SECURITY_COUNCIL_APPROVALS_FOR_EMERGENCY_UPGRADE: 2, | ||
PRIORITY_TX_MAX_GAS_LIMIT, | ||
DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT, | ||
DUMMY_VERIFIER: true | ||
UPGRADE_NOTICE_PERIOD: 0, | ||
PRIORITY_EXPIRATION: 101, | ||
SECURITY_COUNCIL_APPROVALS_FOR_EMERGENCY_UPGRADE: 2, | ||
PRIORITY_TX_MAX_GAS_LIMIT, | ||
DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT, | ||
DUMMY_VERIFIER: true, | ||
}; | ||
const localConfig = { | ||
...prodConfig, | ||
DUMMY_VERIFIER: true | ||
...prodConfig, | ||
DUMMY_VERIFIER: true, | ||
}; | ||
|
||
const contractDefs = { | ||
sepolia: testnetConfig, | ||
rinkeby: testnetConfig, | ||
ropsten: testnetConfig, | ||
goerli: testnetConfig, | ||
mainnet: prodConfig, | ||
test: testConfig, | ||
localhost: localConfig | ||
sepolia: testnetConfig, | ||
rinkeby: testnetConfig, | ||
ropsten: testnetConfig, | ||
goerli: testnetConfig, | ||
mainnet: prodConfig, | ||
test: testConfig, | ||
localhost: localConfig, | ||
}; | ||
|
||
export default { | ||
defaultNetwork: 'env', | ||
solidity: { | ||
version: '0.8.20', | ||
settings: { | ||
optimizer: { | ||
enabled: true, | ||
runs: 9999999 | ||
}, | ||
outputSelection: { | ||
'*': { | ||
'*': ['storageLayout'] | ||
} | ||
} | ||
} | ||
}, | ||
contractSizer: { | ||
runOnCompile: false, | ||
except: ['dev-contracts', 'zksync/upgrade-initializers', 'zksync/libraries', 'common/libraries'] | ||
}, | ||
paths: { | ||
sources: './contracts' | ||
defaultNetwork: "env", | ||
solidity: { | ||
version: "0.8.20", | ||
settings: { | ||
optimizer: { | ||
enabled: true, | ||
runs: 9999999, | ||
}, | ||
outputSelection: { | ||
"*": { | ||
"*": ["storageLayout"], | ||
}, | ||
}, | ||
}, | ||
solpp: { | ||
defs: (() => { | ||
const defs = process.env.CONTRACT_TESTS ? contractDefs.test : contractDefs[process.env.CHAIN_ETH_NETWORK]; | ||
}, | ||
contractSizer: { | ||
runOnCompile: false, | ||
except: ["dev-contracts", "zksync/upgrade-initializers", "zksync/libraries", "common/libraries"], | ||
}, | ||
paths: { | ||
sources: "./contracts", | ||
}, | ||
solpp: { | ||
defs: (() => { | ||
const defs = process.env.CONTRACT_TESTS ? contractDefs.test : contractDefs[process.env.CHAIN_ETH_NETWORK]; | ||
|
||
return { | ||
...systemParams, | ||
...defs | ||
}; | ||
})() | ||
}, | ||
networks: { | ||
env: { | ||
url: process.env.ETH_CLIENT_WEB3_URL?.split(',')[0] | ||
}, | ||
hardhat: { | ||
allowUnlimitedContractSize: false, | ||
forking: { | ||
url: 'https://eth-goerli.g.alchemy.com/v2/' + process.env.ALCHEMY_KEY, | ||
enabled: process.env.TEST_CONTRACTS_FORK === '1' | ||
} | ||
} | ||
return { | ||
...systemParams, | ||
...defs, | ||
}; | ||
})(), | ||
}, | ||
networks: { | ||
env: { | ||
url: process.env.ETH_CLIENT_WEB3_URL?.split(",")[0], | ||
}, | ||
etherscan: { | ||
apiKey: process.env.MISC_ETHERSCAN_API_KEY | ||
hardhat: { | ||
allowUnlimitedContractSize: false, | ||
forking: { | ||
url: "https://eth-goerli.g.alchemy.com/v2/" + process.env.ALCHEMY_KEY, | ||
enabled: process.env.TEST_CONTRACTS_FORK === "1", | ||
}, | ||
}, | ||
gasReporter: { | ||
enabled: true | ||
} | ||
}, | ||
etherscan: { | ||
apiKey: process.env.MISC_ETHERSCAN_API_KEY, | ||
}, | ||
gasReporter: { | ||
enabled: true, | ||
}, | ||
}; | ||
|
||
task('solpp', 'Preprocess Solidity source files').setAction(async (_, hre) => | ||
hre.run(TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS) | ||
task("solpp", "Preprocess Solidity source files").setAction(async (_, hre) => | ||
hre.run(TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS) | ||
); |
Oops, something went wrong.