uniswap-interface-uncensored/hardhat.config.js
Charles Bachmeier ccc94fdfc2
feat: update infura fork block height for cypress tests to be dynamic (#6998)
* import creation block from ur sdk

* update ur sdk
2023-07-24 18:00:29 -07:00

42 lines
1.0 KiB
JavaScript

import { ChainId } from '@uniswap/sdk-core'
import { UNIVERSAL_ROUTER_CREATION_BLOCK } from '@uniswap/universal-router-sdk'
/* eslint-env node */
require('dotenv').config()
const forkingConfig = {
httpHeaders: {
Origin: 'localhost:3000', // infura allowlists requests by origin
},
}
const forks = {
[ChainId.MAINNET]: {
url: `https://mainnet.infura.io/v3/${process.env.REACT_APP_INFURA_KEY}`,
blockNumber: UNIVERSAL_ROUTER_CREATION_BLOCK(ChainId.MAINNET),
...forkingConfig,
},
[ChainId.POLYGON]: {
url: `https://polygon-mainnet.infura.io/v3/${process.env.REACT_APP_INFURA_KEY}`,
blockNumber: UNIVERSAL_ROUTER_CREATION_BLOCK(ChainId.POLYGON),
...forkingConfig,
},
}
module.exports = {
forks,
networks: {
hardhat: {
chainId: ChainId.MAINNET,
forking: forks[ChainId.MAINNET],
accounts: {
count: 2,
},
mining: {
auto: true, // automine to make tests easier to write.
interval: 0, // do not interval mine so that tests remain deterministic
},
},
},
}