transpile.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env bash
  2. set -euo pipefail -x
  3. DIRNAME="$(dirname -- "${BASH_SOURCE[0]}")"
  4. bash "$DIRNAME/patch-apply.sh"
  5. npm run clean
  6. npm run compile
  7. build_info=($(jq -r '.input.sources | keys | if any(test("^contracts/mocks/.*\\bunreachable\\b")) then empty else input_filename end' artifacts/build-info/*))
  8. build_info_num=${#build_info[@]}
  9. if [ $build_info_num -ne 1 ]; then
  10. echo "found $build_info_num relevant build info files but expected just 1"
  11. exit 1
  12. fi
  13. # -D: delete original and excluded files
  14. # -b: use this build info file
  15. # -i: use included Initializable
  16. # -x: exclude proxy-related contracts with a few exceptions
  17. # -p: emit public initializer
  18. npx @openzeppelin/upgrade-safe-transpiler@latest -D \
  19. -b "$build_info" \
  20. -i contracts/proxy/utils/Initializable.sol \
  21. -x 'contracts-exposed/**/*' \
  22. -x 'contracts/proxy/**/*' \
  23. -x '!contracts/proxy/Clones.sol' \
  24. -x '!contracts/proxy/ERC1967/ERC1967Storage.sol' \
  25. -x '!contracts/proxy/ERC1967/ERC1967Upgrade.sol' \
  26. -x '!contracts/proxy/utils/UUPSUpgradeable.sol' \
  27. -x '!contracts/proxy/beacon/IBeacon.sol' \
  28. -p 'contracts/**/presets/**/*'