Initial build for QIE Mainnet Hackathon 3.0 (DeFi & Financial Infrastructure track). Includes: - packages/contracts: constant-product AMM (factory/pair/router), over-collateralized lending vault, and an oracle adapter wrapping QIE's real deployed price-feed contracts. 25/25 Foundry tests pass locally. Clean-room: no existing DEX/lending protocol source was read or copied. - packages/core: TypeScript SDK (viem-based) for QIE's chain, the real (corrected) oracle ABI, a fail-closed QUSDC helper, a Blockscout explorer client, and QIE Wallet connection constants. Live-verified against real testnet (chain 1983) and mainnet (chain 1990) RPCs and the real oracle contracts. - packages/cli: a small CLI built on @qie-forge/core. Real findings from building this, documented in README.md and docs/STATUS.md: the previously-documented testnet RPC URL is dead (replacement found and verified live); QIE's own oracle docs describe a getPrice(string) function that reverts on the real deployed contracts, which actually implement a Chainlink AggregatorV3-style interface (verified live via raw eth_call); the oracle is deployed on Mainnet only, not Testnet. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
106 lines
2.9 KiB
TypeScript
106 lines
2.9 KiB
TypeScript
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 hardhatDocgen from './hardhat/hardhat-solidity-docgen/plugin.ts';
|
|
import hardhatExposed from './hardhat/hardhat-exposed/plugin.ts';
|
|
import hardhatTranspiler from './hardhat/hardhat-transpiler/plugin.ts';
|
|
import hardhatOzContractsHelpers from './hardhat/hardhat-oz-contracts-helpers/plugin.ts';
|
|
import hardhatYul from './hardhat/hardhat-yul/plugin.ts';
|
|
import './hardhat/async-test-sanity.ts';
|
|
|
|
// Parameters
|
|
import yargs from 'yargs/yargs';
|
|
const argv = await yargs()
|
|
.env('')
|
|
.options({
|
|
compiler: { type: 'string', default: '0.8.35' },
|
|
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
|
|
hardhatDocgen,
|
|
hardhatExposed,
|
|
hardhatTranspiler,
|
|
hardhatOzContractsHelpers,
|
|
hardhatYul,
|
|
],
|
|
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'],
|
|
},
|
|
},
|
|
},
|
|
coverage: {
|
|
skipFiles: ['contracts/mocks/**', 'contracts-exposed/**', 'lib/**'],
|
|
},
|
|
warnings: {
|
|
'lib/**/*': 'off',
|
|
'npm/**/*': 'off',
|
|
'test/**/*': 'off',
|
|
'contracts-exposed/**/*': {
|
|
'code-size': 'off',
|
|
'initcode-size': 'off',
|
|
},
|
|
'*': {
|
|
'transient-storage': 'off',
|
|
6335: 'warn', // is-future-solidity-keyword
|
|
default: 'error',
|
|
},
|
|
},
|
|
exposed: {
|
|
initializers: true,
|
|
include: ['contracts/**/*.sol'],
|
|
exclude: ['**/*WithInit.sol'],
|
|
},
|
|
docgen: await import('./docs/config.mjs').then(m => m.default),
|
|
});
|