@@ -79,17 +79,31 @@ echo -e "${GREEN}✓ Contract name: ${CONTRACT_NAME}${NC}"
7979
8080# Check for duplicate hook names
8181EXISTING_DIRS=" "
82- case $TYPE in
83- " action" )
84- EXISTING_DIRS=" src/hooks/actions/${CONTRACT_NAME} "
85- ;;
86- " pricing-strategy" )
87- EXISTING_DIRS=" src/hooks/pricing/${CONTRACT_NAME} "
88- ;;
89- " pricing-action" )
90- EXISTING_DIRS=" src/hooks/pricingActions/${CONTRACT_NAME} "
91- ;;
92- esac
82+ if [ " $SCOPE " = " registry" ]; then
83+ case $TYPE in
84+ " action" )
85+ EXISTING_DIRS=" src/hooks/actions/${CONTRACT_NAME} "
86+ ;;
87+ " pricing-strategy" )
88+ EXISTING_DIRS=" src/hooks/pricing/${CONTRACT_NAME} "
89+ ;;
90+ " pricing-action" )
91+ EXISTING_DIRS=" src/hooks/pricingActions/${CONTRACT_NAME} "
92+ ;;
93+ esac
94+ else
95+ case $TYPE in
96+ " action" )
97+ EXISTING_DIRS=" src/custom/actions/${CONTRACT_NAME} "
98+ ;;
99+ " pricing-strategy" )
100+ EXISTING_DIRS=" src/custom/pricing/${CONTRACT_NAME} "
101+ ;;
102+ " pricing-action" )
103+ EXISTING_DIRS=" src/custom/pricingActions/${CONTRACT_NAME} "
104+ ;;
105+ esac
106+ fi
93107
94108if [ -d " $EXISTING_DIRS " ]; then
95109 echo -e " ${RED} ✗ Error: Hook '${CONTRACT_NAME} ' already exists at ${EXISTING_DIRS}${NC} "
107121echo -e " ${GREEN} ✓ Author: ${AUTHOR}${NC} "
108122echo
109123
110- # Set directory based on type
111- case $TYPE in
112- " action" )
113- DIR=" src/hooks/actions/${CONTRACT_NAME} "
114- ;;
115- " pricing-strategy" )
116- DIR=" src/hooks/pricing/${CONTRACT_NAME} "
117- ;;
118- " pricing-action" )
119- DIR=" src/hooks/pricingActions/${CONTRACT_NAME} "
120- ;;
121- esac
124+ # Set directory based on scope and type
125+ if [ " $SCOPE " = " registry" ]; then
126+ case $TYPE in
127+ " action" )
128+ DIR=" src/hooks/actions/${CONTRACT_NAME} "
129+ ;;
130+ " pricing-strategy" )
131+ DIR=" src/hooks/pricing/${CONTRACT_NAME} "
132+ ;;
133+ " pricing-action" )
134+ DIR=" src/hooks/pricingActions/${CONTRACT_NAME} "
135+ ;;
136+ esac
137+ else
138+ # Product-specific hooks go in custom directory
139+ case $TYPE in
140+ " action" )
141+ DIR=" src/custom/actions/${CONTRACT_NAME} "
142+ ;;
143+ " pricing-strategy" )
144+ DIR=" src/custom/pricing/${CONTRACT_NAME} "
145+ ;;
146+ " pricing-action" )
147+ DIR=" src/custom/pricingActions/${CONTRACT_NAME} "
148+ ;;
149+ esac
150+ fi
122151
123152# Create directory
124153mkdir -p " $DIR "
@@ -132,7 +161,7 @@ echo -e "${BLUE}Generating contract at: ${FILE_PATH}${NC}"
132161if [ " $SCOPE " = " registry" ] && [ " $TYPE " = " action" ]; then
133162 cat > " $FILE_PATH " << 'EOF '
134163// SPDX-License-Identifier: MIT
135- pragma solidity ^0.8.20 ;
164+ pragma solidity ^0.8.30 ;
136165
137166import {
138167 RegistryProductAction,
209238elif [ " $SCOPE " = " product" ] && [ " $TYPE " = " action" ]; then
210239 cat > " $FILE_PATH " << 'EOF '
211240// SPDX-License-Identifier: MIT
212- pragma solidity ^0.8.20 ;
241+ pragma solidity ^0.8.30 ;
213242
214243import {ProductAction, IProductsModule, IProductAction} from "@/utils/ProductAction.sol";
215244
265294elif [ " $SCOPE " = " registry" ] && [ " $TYPE " = " pricing-strategy" ]; then
266295 cat > " $FILE_PATH " << 'EOF '
267296// SPDX-License-Identifier: MIT
268- pragma solidity ^0.8.20 ;
297+ pragma solidity ^0.8.30 ;
269298
270299import {
271300 RegistryProductPrice,
325354elif [ " $SCOPE " = " product" ] && [ " $TYPE " = " pricing-strategy" ]; then
326355 cat > " $FILE_PATH " << 'EOF '
327356// SPDX-License-Identifier: MIT
328- pragma solidity ^0.8.20 ;
357+ pragma solidity ^0.8.30 ;
329358
330359import {ProductPrice, IProductsModule, IProductPrice} from "@/utils/ProductPrice.sol";
331360
366395elif [ " $SCOPE " = " registry" ] && [ " $TYPE " = " pricing-action" ]; then
367396 cat > " $FILE_PATH " << 'EOF '
368397// SPDX-License-Identifier: MIT
369- pragma solidity ^0.8.20 ;
398+ pragma solidity ^0.8.30 ;
370399
371400import {
372401 RegistryProductPriceAction,
459488elif [ " $SCOPE " = " product" ] && [ " $TYPE " = " pricing-action" ]; then
460489 cat > " $FILE_PATH " << 'EOF '
461490// SPDX-License-Identifier: MIT
462- pragma solidity ^0.8.20 ;
491+ pragma solidity ^0.8.30 ;
463492
464493import {
465494 ProductPriceAction,
@@ -633,7 +662,7 @@ if [ "$SCOPE" = "registry" ]; then
633662 if [ " $TYPE " = " action" ]; then
634663 cat > " $TEST_FILE " << 'EOF '
635664// SPDX-License-Identifier: MIT
636- pragma solidity ^0.8.20 ;
665+ pragma solidity ^0.8.30 ;
637666
638667import {RegistryProductAction, RegistryProductActionTest} from "@test/utils/RegistryProductActionTest.sol";
639668import {CONTRACT_NAME} from "@/hooks/actions/CONTRACT_NAME/CONTRACT_NAME.sol";
708737 elif [ " $TYPE " = " pricing-strategy" ]; then
709738 cat > " $TEST_FILE " << 'EOF '
710739// SPDX-License-Identifier: MIT
711- pragma solidity ^0.8.20 ;
740+ pragma solidity ^0.8.30 ;
712741
713742import {RegistryProductPrice, RegistryProductPriceTest} from "@test/utils/RegistryProductPriceTest.sol";
714743import {CONTRACT_NAME} from "@/hooks/pricing/CONTRACT_NAME/CONTRACT_NAME.sol";
763792 elif [ " $TYPE " = " pricing-action" ]; then
764793 cat > " $TEST_FILE " << 'EOF '
765794// SPDX-License-Identifier: MIT
766- pragma solidity ^0.8.20 ;
795+ pragma solidity ^0.8.30 ;
767796
768797import {RegistryProductPriceAction, RegistryProductPriceActionTest} from "@test/utils/RegistryProductPriceActionTest.sol";
769798import {CONTRACT_NAME} from "@/hooks/pricingActions/CONTRACT_NAME/CONTRACT_NAME.sol";
866895
867896echo
868897echo -e " ${YELLOW} Next steps:${NC} "
869- echo " 1. Review and customize the generated contract"
870- echo " 2. Implement your specific contract logic"
871- echo " 3. Update the test file with your test cases"
872- echo " 4. Run tests with 'forge test'"
873- echo " 5. Deploy using the deployment scripts"
898+ echo " 1. Customize the generated contract with your custom logic"
899+ echo " 2. Update the test file with your test cases"
900+ echo " 3. Run tests with 'forge test'"
901+ if [ " $SCOPE " = " registry" ]; then
902+ echo " 4. Deploy by running './script/deploy.sh'"
903+ fi
0 commit comments