Skip to content

Commit

Permalink
feat: added echidna configuration using forked network
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohsen-T committed Jan 8, 2024
1 parent 6ceb56a commit 9e74216
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 24 deletions.
1 change: 1 addition & 0 deletions crytic-export/combined_solc.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion echidna.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ testMode: assertion
# testLimit: 50000
# multi-abi: true
# corpusDir: "corpus"
cryticArgs: ["--solc-remaps", "@openzeppelin=node_modules/@openzeppelin"]
cryticArgs: ['--solc-remaps', '@openzeppelin=node_modules/@openzeppelin']
# contractAddr: '0xContractAddress'
# filterBlacklist: false
# filterFunctions: ["Operators.registerOperator(bytes,uint256)", "setOperatorWhitelist(uint64,address)"]

44 changes: 23 additions & 21 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dotenv/config';

import { HardhatUserConfig } from 'hardhat/config';
import { NetworkUserConfig } from "hardhat/types";
import { NetworkUserConfig } from 'hardhat/types';
import '@nomicfoundation/hardhat-toolbox';
import '@openzeppelin/hardhat-upgrades';
import 'hardhat-tracer';
Expand All @@ -14,13 +14,12 @@ import './tasks/upgrade';

type SSVNetworkConfig = NetworkUserConfig & {
ssvToken: string;
}

};

const config: HardhatUserConfig = {
// Your type-safe config goes here
mocha: {
timeout: 40000000000000000
timeout: 40000000000000000,
},
solidity: {
compilers: [
Expand All @@ -29,32 +28,35 @@ const config: HardhatUserConfig = {
settings: {
optimizer: {
enabled: true,
runs: 10000
}
}
}
runs: 10000,
},
},
},
],
},
networks: {
ganache: {
chainId: 1337,
url: "http://127.0.0.1:8585",
ssvToken: process.env.SSVTOKEN_ADDRESS // if empty, deploy SSV mock token
url: 'http://127.0.0.1:8585',
ssvToken: process.env.SSVTOKEN_ADDRESS, // if empty, deploy SSV mock token
} as SSVNetworkConfig,
hardhat: {
allowUnlimitedContractSize: true
}
forking: {
url: process.env.GOERLI_ETH_NODE_URL,
},
allowUnlimitedContractSize: true,
},
},
etherscan: {
// Your API key for Etherscan
// Obtain one at https://etherscan.io/
apiKey: process.env.ETHERSCAN_KEY
apiKey: process.env.ETHERSCAN_KEY,
},
gasReporter: {
enabled: true,
currency: 'USD',
gasPrice: 0.3
}
gasPrice: 0.3,
},
};

if (process.env.GOERLI_ETH_NODE_URL) {
Expand All @@ -69,13 +71,13 @@ if (process.env.GOERLI_ETH_NODE_URL) {
...config.networks,
goerli_development: {
...sharedConfig,
ssvToken: '0x6471F70b932390f527c6403773D082A0Db8e8A9F'
ssvToken: '0x6471F70b932390f527c6403773D082A0Db8e8A9F',
} as SSVNetworkConfig,
goerli_testnet: {
...sharedConfig,
ssvToken: '0x3a9f01091C446bdE031E39ea8354647AFef091E7'
ssvToken: '0x3a9f01091C446bdE031E39ea8354647AFef091E7',
} as SSVNetworkConfig,
}
};
}

if (process.env.MAINNET_ETH_NODE_URL) {
Expand All @@ -87,9 +89,9 @@ if (process.env.MAINNET_ETH_NODE_URL) {
accounts: [`0x${process.env.MAINNET_OWNER_PRIVATE_KEY}`],
gasPrice: +(process.env.GAS_PRICE || ''),
gas: +(process.env.GAS || ''),
ssvToken: '0x9D65fF81a3c488d585bBfb0Bfe3c7707c7917f54'
} as SSVNetworkConfig
}
ssvToken: '0x9D65fF81a3c488d585bBfb0Bfe3c7707c7917f54',
} as SSVNetworkConfig,
};
}

export default config;
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
"lint:fix": "eslint --fix . --ext .ts",
"solidity-coverage": "NO_GAS_ENFORCE=1 npx hardhat coverage",
"slither": "slither contracts --solc-remaps @openzeppelin=node_modules/@openzeppelin",
"size-contracts": "npx hardhat size-contracts"
"size-contracts": "npx hardhat size-contracts",
"install-echidna": "brew install echidna",
"run-echidna": "echidna --config echidna.yaml"
},
"devDependencies": {
"@crytic/echidna": "^0.0.6",
"@nomicfoundation/hardhat-toolbox": "^2.0.0",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-solhint": "^2.0.0",
Expand All @@ -36,4 +39,4 @@
"ts-node": "^10.7.0",
"typescript": "^4.6.3"
}
}
}

0 comments on commit 9e74216

Please sign in to comment.