yarn install
# install slither, mythril, solc, and other tools in the docker image
yarn run setup-analyzers
Don't forget to copy the .env.example
file to .env
, then edit it to provide the required details.
Before using the analyzers, make sure to complete the Prerequisites step.
yarn run slither path/to/contract
yarn run mythril path/to/contract
yarn run lint
yarn run lint:fix
yarn hardhat test
# run tests and generate coverage report
yarn run coverage
# generate docs according to the contracts/ folder
yarn hardhat docgen
# start a local network at http://localhost:8545
yarn hardhat node
# start the blockscout explorer at http://localhost:80 for the local network
yarn run blockscout:start
yarn run blockscout:stop
yarn run blockscout:reset
# use this after restarting your node
yarn run blockscout:refresh
# deploy the contract to the local network
yarn run node:run scripts/deploy.ts
# verify the contract on the local network
yarn run node:verify --constructor-args ignition/modules/FooTokenArgs.ts <FOO_TOKEN_CONTRACT_ADDRESS>
# analyze the on-chain contract on the local network
yarn mythril --address <FOO_TOKEN_CONTRACT_ADDRESS> --rpc host.docker.internal:8545
To verify a contract, you first need to deploy it to a network.
In this project, copy the .env.example file to .env, then edit it to provide the required details:
- Enter the API key you obtained from an explorer (e.g., Etherscan) in the corresponding variable. (e.g., ETHERSCAN_API_KEY)
- Provide the RPC URL of the network you want to deploy to. (e.g., MAINNET_RPC_URL)
- Specify the private key of the account that will send the deployment transaction (DEPLOYER_WALLET_PRIVATE_KEY).
With a properly configured .env file, deploy your contract by running:
yarn hardhat run --network <YOUR_NETWORK> scripts/deploy.ts
You can also manually add the contract(s) to your Tenderly project using the output URL:
https://dashboard.tenderly.co/contract/<NETWORK_NAME>/<CONTRACT_ADDRESS>
Finally, verify the contract:
yarn hardhat verify --network <YOUR_NETWORK> <YOUR_CONTRACT_ADDRESS> "<CONSTRUCTOR_ARGUMENT(S)>"
# find outputs of specific contract and write to file
yarn hardhat finder --contract-path contracts/FooToken.sol --contract-name FooToken --write-to-file abi bytecode metadata --colorify --compact --prettify
# create lock file of storage layout for your contracts
yarn hardhat storage-lock
# check by comparing with existing lock file of storage layout
yarn hardhat storage-check
# generate a flattened version of the contract
yarn run flatten path/to/contract
# share the project with remix-ide
yarn run share
Contributions to this project are welcome! You can help by adding new features or fixing bugs. Here are some suggestions:
- Enhance diversity in the Workshop Contract
- Add tests for the Workshop Contract
- Include examples of Upgradeable Contracts
- Integrate OpenZeppelin Defender
- Integrate Tenderly
- Add the "Plugins" section