You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cp .env.sample .env
# start ganache (used to speed up test, truffle test without ganache is slow)
npx ganache-cli
# unit test
npm run test:unit
# integration test
npm run test:integration
# test mainnet forksource .env
npx ganache-cli \
-e 10000 \
--fork https://mainnet.infura.io/v3/$INFURA_API_KEY \
--unlock $DAI_WHALE \
--unlock $USDC_WHALE \
--unlock $USDT_WHALE \
--unlock $BUSD_WHALE \
--unlock $GUSD_WHALE \
--unlock $USDP_WHALE \
--unlock $WBTC_WHALE \
--unlock $EURS_WHALE \
--networkId 999
# NOTE# restart ganache when you see this error# Error: Returned error: Returned error: project ID does not have access to archive state# test specific file
npx truffle test --network mainnet_fork test/mainnet/path/to/test.ts
# test all (need to restart truffle after each test)
find test/mainnet -name "test-*.ts" -exec truffle test --network mainnet_fork {} \;
# Warning: Temporary delete any unnecessary contracts and clear the artifacts and build# otherwise these will also be part of the verified contract.
env $(cat .env) npx hardhat verify --network mainnet DEPLOYED_CONTRACT_ADDRESS CONSTRUCTOR_ARG_1 CONSTRUCTOR_ARG_2 ...
Flatten Contracts
npm run flat -- contracts/Contract.sol > flat.sol
Get Contract Size
cat build/contracts/Contract.json | jq -r '.deployedBytecode'| wc -c
# divide output by 2 to get size in bytes