misc: minor tweaks

This commit is contained in:
vicnaum
2023-10-24 22:12:46 +02:00
parent cf9d787d2d
commit 4eb2162f48
6 changed files with 448 additions and 790 deletions

View File

@@ -5,7 +5,8 @@ libs = ['node_modules', 'lib']
test = 'test'
cache_path = 'forge-cache'
fs_permissions = [{ access = "read-write", path = "./"}]
solc_version = '0.8.19'
solc_version = '0.8.21'
evm_version = 'paris'
optimizer = true
optimizer_runs = 10
ignored_error_codes = []

View File

@@ -3,6 +3,8 @@ import { accounts } from './helpers/test-wallets';
import { eEthereumNetwork, eNetwork, ePolygonNetwork, eXDaiNetwork } from './helpers/types';
import { HARDHATEVM_CHAINID } from './helpers/hardhat-constants';
import { NETWORKS_RPC_URL } from './helper-hardhat-config';
import 'hardhat-preprocessor';
import fs from 'fs';
import dotenv from 'dotenv';
import glob from 'glob';
import path from 'path';
@@ -18,6 +20,14 @@ import 'hardhat-log-remover';
import 'hardhat-spdx-license-identifier';
import 'hardhat-tracer';
function getRemappings() {
return fs
.readFileSync('remappings.txt', 'utf8')
.split('\n')
.filter(Boolean) // remove empty lines
.map((line) => line.trim().split('='));
}
if (!process.env.SKIP_LOAD) {
glob.sync('./tasks/**/*.ts').forEach(function (file) {
require(path.resolve(file));
@@ -54,11 +64,13 @@ const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: '0.8.19',
version: '0.8.21',
settings: {
evmVersion: 'paris',
viaIR: true,
optimizer: {
enabled: true,
runs: 200,
runs: 10,
details: {
yul: true,
},
@@ -96,6 +108,25 @@ const config: HardhatUserConfig = {
etherscan: {
apiKey: BLOCK_EXPLORER_KEY,
},
preprocess: {
eachLine: (hre) => ({
transform: (line: string) => {
if (line.match(/^\s*import /i)) {
for (const [from, to] of getRemappings()) {
if (line.includes(from)) {
line = line.replace(from, to);
break;
}
}
}
return line;
},
}),
},
paths: {
sources: './contracts',
cache: './cache_hardhat',
},
};
export default config;

1062
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -57,7 +57,9 @@
}
},
"dependencies": {
"@openzeppelin/contracts": "4.8.0"
"@openzeppelin/contracts": "4.8.0",
"@openzeppelin/contracts-upgradeable": "^4.8.0",
"hardhat-preprocessor": "^0.1.5"
},
"author": "Lens",
"contributors": [

130
test/TestTest.t.sol Normal file

File diff suppressed because one or more lines are too long

View File

@@ -220,6 +220,10 @@ contract TestSetup is Test, ContractAddressesLoaderDeployer, ArrayHelpers {
upgradeToV2();
}
if (forkVersion == 2) {
lensVersion = 2;
}
vm.startPrank(deployer);
// Deploy the MockActionModule.