Skip to content
Draft
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
df6b7ff
wip
Amxx Jan 14, 2026
feec869
new hook
Amxx Jan 22, 2026
7eaa9d6
It works! implemented exposed by rewritting context.solidity.build
Amxx Jan 23, 2026
a115cfe
move the solidity path push to the config hook
Amxx Jan 23, 2026
8c1f55c
test migration
Amxx Jan 27, 2026
a03c738
test network env
Amxx Jan 27, 2026
319dd41
update package.json scripts
Amxx Jan 27, 2026
75ed0fa
plugin update
Amxx Jan 28, 2026
8c53c5d
fix package logic
Amxx Jan 28, 2026
85bd93b
remove old unused file
Amxx Jan 28, 2026
52fc608
migrate generation logic
Amxx Jan 28, 2026
d6e4477
migrate inheritance-ordering and pragma check/minimize check
Amxx Jan 28, 2026
4f4c783
Merge branch 'master' into hardhat3
Amxx Jan 28, 2026
825a203
remove supperfluous test that doesn't run in hh3
Amxx Jan 28, 2026
2f62a2c
Merge remote-tracking branch 'amxx/hardhat3' into hardhat3
Amxx Jan 28, 2026
3b840e6
update patch
frangio Jan 30, 2026
561a427
update transpile.sh
frangio Jan 30, 2026
4f8812b
remove npmPackage name for internal plugins
Amxx Jan 30, 2026
eadb1bd
fix hardhat error for local plugins
frangio Jan 30, 2026
033bced
use .ts imports
frangio Jan 30, 2026
9e6dfd7
add --paths to transpiler
frangio Jan 30, 2026
75ce57f
fix heredoc
frangio Jan 30, 2026
6173cb9
add project prefix
frangio Jan 30, 2026
1f582f7
Merge branch 'hardhat3' into hardhat3-transpiler
frangio Jan 30, 2026
64f435a
Merge pull request #18 from frangio/hardhat3-transpiler
Amxx Jan 30, 2026
09b2af1
Hardhat transpile action
Amxx Jan 30, 2026
3c2ecd3
Use a JSON file for transpiler settings
Amxx Jan 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 0 additions & 124 deletions hardhat.config.js

This file was deleted.

94 changes: 94 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import { defineConfig } from 'hardhat/config';

// Plugins
import hardhatEthers from '@nomicfoundation/hardhat-ethers';
import hardhatEthersChaiMatchers from '@nomicfoundation/hardhat-ethers-chai-matchers';
import hardhatIgnoreWarnings from 'hardhat-ignore-warnings';
import hardhatMocha from '@nomicfoundation/hardhat-mocha';
import hardhatNetworkHelpers from '@nomicfoundation/hardhat-network-helpers';
import hardhatPredeploy from 'hardhat-predeploy';
import hardhatExposed from './hardhat/hardhat-exposed/plugin.js';
import hardhatOzContractsHelpers from './hardhat/hardhat-oz-contracts-helpers/plugin.js';
import './hardhat/async-test-sanity.js';

// Parameters
import yargs from 'yargs/yargs';
const argv = await yargs()
.env('')
.options({
compiler: { type: 'string', default: '0.8.31' },
src: { type: 'string', default: 'contracts' },
runs: { type: 'number', default: 200 },
ir: { type: 'boolean', default: false },
evm: { type: 'string', default: 'osaka' },
})
.parse();

// Configuration
export default defineConfig({
plugins: [
// Imported plugins
hardhatEthers,
hardhatEthersChaiMatchers,
hardhatIgnoreWarnings,
hardhatMocha,
hardhatNetworkHelpers,
hardhatPredeploy,
// Local plugins
hardhatExposed,
hardhatOzContractsHelpers,
],
paths: {
sources: argv.src,
},
solidity: {
version: argv.compiler,
settings: {
optimizer: {
enabled: true,
runs: argv.runs,
},
evmVersion: argv.evm,
viaIR: argv.ir,
outputSelection: { '*': { '*': ['storageLayout'] } },
},
},
networks: {
default: {
type: 'edr-simulated',
hardfork: argv.evm,
// Exposed contracts often exceed the maximum contract size. For normal contract,
// we rely on the `code-size` compiler warning, that will cause a compilation error.
allowUnlimitedContractSize: true,
},
},
test: {
solidity: {
fuzz: {
// runs: 5000,
// maxTestRejects: 150000,
},
fsPermissions: {
readDirectory: ['node_modules/hardhat-predeploy/bin'],
},
},
},
warnings: {
'npm/**/*': 'off',
'test/**/*': 'off',
'contracts-exposed/**/*': {
'code-size': 'off',
'initcode-size': 'off',
},
'*': {
'transient-storage': 'off',
default: 'error',
},
},
exposed: {
imports: true,
initializers: true,
include: ['contracts/**/*.sol'],
exclude: ['contracts/vendor/**/*', '**/*WithInit.sol'],
},
});
29 changes: 0 additions & 29 deletions hardhat/env-artifacts.js

This file was deleted.

26 changes: 26 additions & 0 deletions hardhat/hardhat-exposed/core/format-lines.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export type Lines = string | typeof whitespace | Lines[];

const whitespace = Symbol('whitespace');

export function formatLines(...lines: Lines[]): string {
return [...indentEach(0, lines)].join('\n') + '\n';
}

function* indentEach(indent: number, lines: Lines[]): Generator<string | typeof whitespace> {
for (const line of lines) {
if (line === whitespace) {
yield '';
} else if (Array.isArray(line)) {
yield* indentEach(indent + 1, line);
} else {
yield ' '.repeat(indent) + line;
}
}
}

export function spaceBetween(...lines: Lines[][]): Lines[] {
return lines
.filter(l => l.length > 0)
.flatMap<Lines>(l => [whitespace, ...l])
.slice(1);
}
Loading
Loading