storage-snapshot.sh 1.16 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/usr/bin/env bash

set -e

if ! command -v forge &> /dev/null
then
    echo "forge could not be found. Please install forge by running:"
    echo "curl -L https://foundry.paradigm.xyz | bash"
    exit
fi

contracts=(
  L1CrossDomainMessenger
  L1StandardBridge
  L2OutputOracle
  OptimismPortal
  DeployerWhitelist
  GasPriceOracle
  L1Block
  L1BlockNumber
  L2CrossDomainMessenger
  L2StandardBridge
  L2ToL1MessagePasser
24
  LegacyERC20ETH
25 26 27 28 29 30
  SequencerFeeVault
  WETH9
  ProxyAdmin
  Proxy
  L1ChugSplashProxy
  OptimismMintableERC20
31
  OptimismMintableERC20Factory
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
)

dir=$(dirname "$0")

echo "Creating storage layout diagrams.."

echo "=======================" > $dir/../.storage-layout
echo "👁👁 STORAGE LAYOUT snapshot 👁👁" >> $dir/../.storage-layout
echo "=======================" >> $dir/../.storage-layout

for contract in ${contracts[@]}
do
  echo -e "\n=======================" >> $dir/../.storage-layout
  echo "➡ $contract">> $dir/../.storage-layout
  echo -e "=======================\n" >> $dir/../.storage-layout
  forge inspect --pretty $contract storage-layout >> $dir/../.storage-layout
done
echo "Storage layout snapshot stored at $dir/../.storage-layout"