Skip to content

Commit

Permalink
feat: add CLEAR_CACHE env var for ganache and hardhat
Browse files Browse the repository at this point in the history
  • Loading branch information
mds1 committed Dec 15, 2021
1 parent 86064b2 commit bd6ed43
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ export ETH_RPC_URL=https://eth-mainnet.alchemyapi.io/v2/yourAlchemyApiKey
export FORK_BLOCK=13724056
export GAS_LIMIT=30000000

# skip type-checking to avoid its perfomance impact
# clears caches for ganache and hardhat
export CLEAR_CACHE=0

# skip type-checking to avoid its performance impact
export TS_NODE_TRANSPILE_ONLY=1
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ uses about 16M gas and performs a number of token transfers

## Tips

Dapptools seems to fail when run on macOS, as explained in [this](https://github.com/dapphub/dapptools/issues/876), so you may need to skip that script on macOS
- Dapptools seems to fail when run on macOS, as explained in [this](https://github.com/dapphub/dapptools/issues/876), so you may need to skip that script on macOS
- Set `export CLEAR_CACHE=1` in your `.env` file to clear the Ganache and Hardhat caches
4 changes: 4 additions & 0 deletions scripts/benchmark-hardhat.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
. ./.env

if [ $CLEAR_CACHE = 1 ]; then
yarn hardhat clean
fi

time TS_NODE_FILES=true yarn ts-node ./scripts/convex.hardhat.ts
4 changes: 2 additions & 2 deletions scripts/convex.ganache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const chalk: any = require('chalk');
import * as ethers from 'ethers';
import Ganache from 'ganache';

const url = process.env['ETH_RPC_URL'] || 'mainnet';
const deleteCache = !!(process.env['DELETE_CACHE'] && process.env['DELETE_CACHE'] !== 'false');
const url = process.env.ETH_RPC_URL || 'mainnet';
const deleteCache = process.env.CLEAR_CACHE && Number(process.env.CLEAR_CACHE) === 1;
const blockGasLimit = ethers.BigNumber.from(process.env.GAS_LIMIT).toHexString();
const blockNumber = Number(process.env.FORK_BLOCK);
const defaultBalance = '0xffffffffffffffffffffff';
Expand Down

0 comments on commit bd6ed43

Please sign in to comment.